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 8a2b8b63ed
commit 7e975dd116
15 changed files with 34 additions and 24 deletions

View File

@ -41,3 +41,13 @@ jobs:
run: yarn build run: yarn build
- name: Test - name: Test
run: yarn 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", "gulp": "gulp build",
"clean": "gulp clean", "clean": "gulp clean",
"cleanall": "gulp cleanall", "cleanall": "gulp cleanall",
"lint": "gulp lint", "lint": "tslint 'src/**/*.ts'",
"test": "cross-env TS_NODE_FILES=true gulp test", "test": "cross-env TS_NODE_FILES=true gulp test",
"format": "gulp format" "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; 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 getVbyList(h: ASN1S, currentIndex: Idx<ASN1ObjectString>, nthList: Mutable<Nth[]>, checkingTag?: string, removeUnusedbits?: boolean): ASN1V;
public static hextooidstr(hex: ASN1OIDV): OID; public static hextooidstr(hex: ASN1OIDV): OID;
@ -620,9 +621,7 @@ declare module 'jsrsasign' {
public encrypt(text: string): HexString | null; public encrypt(text: string): HexString | null;
public encryptOAEP(text: string, hash?: string, hashLen?: number): HexString | null; public encryptOAEP(text: string, hash?: string | ((s: string) => string), hashLen?: number): HexString | null;
public encryptOAEP(text: string, hash?: (s: string) => string, hashLen?: number): HexString | null;
//// RSA PRIVATE //// RSA PRIVATE
@ -638,9 +637,7 @@ declare module 'jsrsasign' {
public decrypt(ctext: HexString): string; public decrypt(ctext: HexString): string;
public decryptOAEP(ctext: HexString, hash?: string, hashLen?: number): string | null; public decryptOAEP(ctext: HexString, hash?: string | ((s: string) => string), hashLen?: number): string | null;
public encryptOAEP(ctext: HexString, hash?: (s: string) => string, hashLen?: number): string | null;
//// RSA PEM //// RSA PEM

View File

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

View File

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

View File

@ -124,7 +124,7 @@ export default class MiOS extends EventEmitter {
} else { } else {
// Get token from localStorage // Get token from localStorage
const i = localStorage.getItem('i'); const i = localStorage.getItem('i');
fetchme(i, me => { fetchme(i, me => {
if (me) { if (me) {
this.store.dispatch('login', 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!.includes(keyword)
: note.text!.toLowerCase().includes(keyword.toLowerCase()) : note.text!.toLowerCase().includes(keyword.toLowerCase())
)); ));
if (!matched) return false; if (!matched) return false;
} }
@ -61,7 +61,7 @@ export async function checkHitAntenna(antenna: Antenna, note: Note, noteUser: Us
? note.text!.includes(keyword) ? note.text!.includes(keyword)
: note.text!.toLowerCase().includes(keyword.toLowerCase()) : note.text!.toLowerCase().includes(keyword.toLowerCase())
)); ));
if (matched) return false; if (matched) return false;
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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