lintをGitHub Actions でするように (#6101)

* package.json の lint スクリプトを修正

* lint アクションを追加

* yarn lint --fix

* 手動修正
This commit is contained in:
rinsuki 2020-03-04 11:45:33 +09:00 committed by GitHub
parent 678ff17d0f
commit c18f6fde80
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 34 additions and 24 deletions

View File

@ -41,3 +41,13 @@ jobs:
run: yarn build
- name: Test
run: yarn test
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12.x
- run: yarn install
- run: yarn lint

View File

@ -21,7 +21,7 @@
"gulp": "gulp build",
"clean": "gulp clean",
"cleanall": "gulp cleanall",
"lint": "gulp lint",
"lint": "tslint 'src/**/*.ts'",
"test": "cross-env TS_NODE_FILES=true gulp test",
"format": "gulp format"
},

View File

@ -171,6 +171,7 @@ declare module 'jsrsasign' {
public static getTLVbyList(h: ASN1S, currentIndex: Idx<ASN1ObjectString>, nthList: Mutable<Nth[]>, checkingTag?: string): ASN1TLV;
// tslint:disable-next-line:bool-param-default
public static getVbyList(h: ASN1S, currentIndex: Idx<ASN1ObjectString>, nthList: Mutable<Nth[]>, checkingTag?: string, removeUnusedbits?: boolean): ASN1V;
public static hextooidstr(hex: ASN1OIDV): OID;
@ -620,9 +621,7 @@ declare module 'jsrsasign' {
public encrypt(text: string): HexString | null;
public encryptOAEP(text: string, hash?: string, hashLen?: number): HexString | null;
public encryptOAEP(text: string, hash?: (s: string) => string, hashLen?: number): HexString | null;
public encryptOAEP(text: string, hash?: string | ((s: string) => string), hashLen?: number): HexString | null;
//// RSA PRIVATE
@ -638,9 +637,7 @@ declare module 'jsrsasign' {
public decrypt(ctext: HexString): string;
public decryptOAEP(ctext: HexString, hash?: string, hashLen?: number): string | null;
public encryptOAEP(ctext: HexString, hash?: (s: string) => string, hashLen?: number): string | null;
public decryptOAEP(ctext: HexString, hash?: string | ((s: string) => string), hashLen?: number): string | null;
//// RSA PEM

View File

@ -59,7 +59,7 @@ export default {
const ro = new ResizeObserver((entries, observer) => {
calc();
});
ro.observe(el);
el._ro_ = ro;

View File

@ -81,14 +81,14 @@ if (lang == null) {
// Detect the user agent
const ua = navigator.userAgent.toLowerCase();
let isMobile = /mobile|iphone|ipad|android/.test(ua);
const isMobile = /mobile|iphone|ipad|android/.test(ua);
// Get the <head> element
const head = document.getElementsByTagName('head')[0];
// If mobile, insert the viewport meta tag
if (isMobile || window.innerWidth <= 1024) {
const viewport = document.getElementsByName("viewport").item(0);
const viewport = document.getElementsByName('viewport').item(0);
viewport.setAttribute('content',
`${viewport.getAttribute('content')},minimum-scale=1,maximum-scale=1,user-scalable=no`);
head.appendChild(viewport);

View File

@ -124,7 +124,7 @@ export default class MiOS extends EventEmitter {
} else {
// Get token from localStorage
const i = localStorage.getItem('i');
fetchme(i, me => {
if (me) {
this.store.dispatch('login', me);

View File

@ -48,7 +48,7 @@ export async function checkHitAntenna(antenna: Antenna, note: Note, noteUser: Us
? note.text!.includes(keyword)
: note.text!.toLowerCase().includes(keyword.toLowerCase())
));
if (!matched) return false;
}
@ -61,7 +61,7 @@ export async function checkHitAntenna(antenna: Antenna, note: Note, noteUser: Us
? note.text!.includes(keyword)
: note.text!.toLowerCase().includes(keyword.toLowerCase())
));
if (matched) return false;
}

View File

@ -8,7 +8,7 @@ import { id } from '../id';
export class ClipNote {
@PrimaryColumn(id())
public id: string;
@Index()
@Column({
...id(),

View File

@ -98,7 +98,7 @@ export class UserRepository extends Repository<User> {
public async getHasUnreadAntenna(userId: User['id']): Promise<boolean> {
const antennas = await Antennas.find({ userId });
const unread = antennas.length > 0 ? await AntennaNotes.findOne({
antennaId: In(antennas.map(x => x.id)),
read: false
@ -112,7 +112,7 @@ export class UserRepository extends Repository<User> {
muterId: userId
});
const mutedUserIds = mute.map(m => m.muteeId);
const count = await Notifications.count({
where: {
notifieeId: userId,

View File

@ -82,7 +82,7 @@ export default define(meta, async (ps, user) => {
id: ps.userListId,
userId: user.id,
});
if (userList == null) {
throw new ApiError(meta.errors.noSuchUserList);
}
@ -91,7 +91,7 @@ export default define(meta, async (ps, user) => {
userGroupId: ps.userGroupId,
userId: user.id,
});
if (userGroupJoining == null) {
throw new ApiError(meta.errors.noSuchUserGroup);
}

View File

@ -101,7 +101,7 @@ export default define(meta, async (ps, user) => {
id: ps.userListId,
userId: user.id,
});
if (userList == null) {
throw new ApiError(meta.errors.noSuchUserList);
}
@ -110,7 +110,7 @@ export default define(meta, async (ps, user) => {
userGroupId: ps.userGroupId,
userId: user.id,
});
if (userGroupJoining == null) {
throw new ApiError(meta.errors.noSuchUserGroup);
}

View File

@ -11,7 +11,8 @@ export default class extends Channel {
public async init(params: any) {
// Subscribe main stream channel
this.subscriber.on(`mainStream:${this.user!.id}`, async data => {
let { type, body } = data;
const { type } = data;
let { body } = data;
switch (type) {
case 'notification': {

View File

@ -38,7 +38,7 @@ export async function addNoteToAntenna(antenna: Antenna, note: Note, noteUser: U
if (note.renoteId != null) {
_note.renote = await Notes.findOne(note.renoteId).then(ensure);
}
if (shouldMuteThisNote(_note, mutings.map(x => x.muteeId))) {
return;
}

View File

@ -223,7 +223,7 @@ export default async (user: User, data: Option, silent = false) => new Promise<N
.getMany();
const followers = followings.map(f => f.followerId);
for (const antenna of antennas) {
checkHitAntenna(antenna, note, user, followers).then(hit => {
if (hit) {

View File

@ -61,7 +61,9 @@
"no-duplicated-branches": false,
"no-identical-conditions": false,
"no-useless-cast": false,
"no-hardcoded-credentials": false
"no-hardcoded-credentials": false,
"no-nested-switch": false,
"unified-signatures": false
},
"rulesDirectory": []
}