From 2d3269273fb4ab8ff2456954fece92e6aee4aad1 Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Mon, 31 Jul 2023 03:56:33 +0200 Subject: [PATCH] eslintrc-tsnocheck --- .github/workflows/lint.yml | 1 + packages/frontend/.eslintrc-tsnocheck.cjs | 10 ++++++++++ .../frontend/{.eslintrc.js => .eslintrc.cjs} | 0 packages/frontend/.storybook/fakes.ts | 2 ++ ...llup-plugin-unwind-css-module-class-name.ts | 1 + packages/frontend/package.json | 3 ++- packages/frontend/tsconfig.json | 8 +++++--- packages/misskey-js/etc/misskey-js.api.md | 18 ++++++++++++++++-- packages/misskey-js/src/entities.ts | 14 +++++++++++++- 9 files changed, 50 insertions(+), 7 deletions(-) create mode 100644 packages/frontend/.eslintrc-tsnocheck.cjs rename packages/frontend/{.eslintrc.js => .eslintrc.cjs} (100%) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 0f3702f958..30ab9f34f7 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -62,6 +62,7 @@ jobs: matrix: workspace: - backend + - frontend - misskey-js steps: - uses: actions/checkout@v3.3.0 diff --git a/packages/frontend/.eslintrc-tsnocheck.cjs b/packages/frontend/.eslintrc-tsnocheck.cjs new file mode 100644 index 0000000000..d110d14065 --- /dev/null +++ b/packages/frontend/.eslintrc-tsnocheck.cjs @@ -0,0 +1,10 @@ +// Split from .eslintrc, so that the default eslintrc can still show error for ts-nocheck +module.exports = { + root: true, + extends: [ + './.eslintrc.cjs', + ], + rules: { + '@typescript-eslint/ban-ts-comment': ['error', { 'ts-nocheck': false }] + } +}; diff --git a/packages/frontend/.eslintrc.js b/packages/frontend/.eslintrc.cjs similarity index 100% rename from packages/frontend/.eslintrc.js rename to packages/frontend/.eslintrc.cjs diff --git a/packages/frontend/.storybook/fakes.ts b/packages/frontend/.storybook/fakes.ts index a4289cff7d..2098fbb86e 100644 --- a/packages/frontend/.storybook/fakes.ts +++ b/packages/frontend/.storybook/fakes.ts @@ -70,6 +70,7 @@ export function userDetailed(id = 'someuserid', username = 'miskist', host = 'mi avatarUrl: 'https://github.com/misskey-dev/misskey/blob/master/packages/frontend/assets/about-icon.png?raw=true', avatarBlurhash: 'eQFRshof5NWBRi},juayfPju53WB?0ofs;s*a{ofjuay^SoMEJR%ay', emojis: [], + alsoKnownAs: [], bannerBlurhash: 'eQA^IW^-MH8w9tE8I=S^o{$*R4RikXtSxutRozjEnNR.RQadoyozog', bannerColor: '#000000', bannerUrl: 'https://github.com/misskey-dev/misskey/blob/master/packages/frontend/assets/fedi.jpg?raw=true', @@ -102,6 +103,7 @@ export function userDetailed(id = 'someuserid', username = 'miskist', host = 'mi isSuspended: false, lang: 'en', location: 'Fediverse', + movedTo: null, notesCount: 65536, pinnedNoteIds: [], pinnedNotes: [], diff --git a/packages/frontend/lib/rollup-plugin-unwind-css-module-class-name.ts b/packages/frontend/lib/rollup-plugin-unwind-css-module-class-name.ts index 18c817e0f5..5355d83021 100644 --- a/packages/frontend/lib/rollup-plugin-unwind-css-module-class-name.ts +++ b/packages/frontend/lib/rollup-plugin-unwind-css-module-class-name.ts @@ -258,6 +258,7 @@ export function unwindCssModuleClassName(ast: estree.Node): void { type: 'ArrayExpression', elements: node.declarations[0].init.arguments[1].elements.slice(0, __cssModulesIndex).concat(node.declarations[0].init.arguments[1].elements.slice(__cssModulesIndex + 1)), }], + optional: false, }, }], kind: 'const', diff --git a/packages/frontend/package.json b/packages/frontend/package.json index 36763065fa..969bf7b1dd 100644 --- a/packages/frontend/package.json +++ b/packages/frontend/package.json @@ -12,7 +12,8 @@ "test-and-coverage": "vitest --run --coverage", "typecheck": "vue-tsc --noEmit", "eslint": "eslint --quiet \"src/**/*.{ts,vue}\"", - "lint": "pnpm typecheck && pnpm eslint" + "lint-full": "pnpm typecheck && pnpm eslint", + "lint": "pnpm typecheck && pnpm eslint -c .eslintrc-tsnocheck.cjs" }, "dependencies": { "@discordapp/twemoji": "14.1.2", diff --git a/packages/frontend/tsconfig.json b/packages/frontend/tsconfig.json index 4fe703bd99..eaaa5df5ba 100644 --- a/packages/frontend/tsconfig.json +++ b/packages/frontend/tsconfig.json @@ -19,7 +19,6 @@ "experimentalDecorators": true, "resolveJsonModule": true, "allowSyntheticDefaultImports": true, - "isolatedModules": true, "useDefineForClassFields": true, "baseUrl": ".", "paths": { @@ -37,7 +36,8 @@ "esnext", "dom" ], - "jsx": "preserve" + "jsx": "preserve", + "skipLibCheck": true }, "compileOnSave": false, "include": [ @@ -46,6 +46,8 @@ "./**/*.vue" ], "exclude": [ - ".storybook/**/*" + ".storybook/**/*", + "lib/**/*", + "test/**/*" ] } diff --git a/packages/misskey-js/etc/misskey-js.api.md b/packages/misskey-js/etc/misskey-js.api.md index 9d872f98e7..2f136c0da5 100644 --- a/packages/misskey-js/etc/misskey-js.api.md +++ b/packages/misskey-js/etc/misskey-js.api.md @@ -2254,7 +2254,8 @@ declare namespace entities { Invite, InviteLimit, UserSorting, - OriginType + OriginType, + Role } } export { entities } @@ -2651,6 +2652,18 @@ type PageEvent = { // @public (undocumented) export const permissions: string[]; +// @public (undocumented) +type Role = { + id: string; + name: string; + color: string | null; + iconUrl: string | null; + description: string; + isModerator: boolean; + isAdministrator: boolean; + displayOrder: number; +}; + // @public (undocumented) type ServerInfo = { machine: string; @@ -2762,7 +2775,7 @@ type UserDetailed = UserLite & { lang: string | null; lastFetchedAt?: DateString; location: string | null; - movedTo: string; + movedTo: string | null; notesCount: number; pinnedNoteIds: ID[]; pinnedNotes: Note[]; @@ -2770,6 +2783,7 @@ type UserDetailed = UserLite & { pinnedPageId: string | null; publicReactions: boolean; securityKeys: boolean; + roles: Role[]; twoFactorEnabled: boolean; updatedAt: DateString | null; uri: string | null; diff --git a/packages/misskey-js/src/entities.ts b/packages/misskey-js/src/entities.ts index b9771d1964..dcb9e99400 100644 --- a/packages/misskey-js/src/entities.ts +++ b/packages/misskey-js/src/entities.ts @@ -57,7 +57,7 @@ export type UserDetailed = UserLite & { lang: string | null; lastFetchedAt?: DateString; location: string | null; - movedTo: string; + movedTo: string | null; notesCount: number; pinnedNoteIds: ID[]; pinnedNotes: Note[]; @@ -65,6 +65,7 @@ export type UserDetailed = UserLite & { pinnedPageId: string | null; publicReactions: boolean; securityKeys: boolean; + roles: Role[], twoFactorEnabled: boolean; updatedAt: DateString | null; uri: string | null; @@ -546,3 +547,14 @@ export type UserSorting = | '+updatedAt' | '-updatedAt'; export type OriginType = 'combined' | 'local' | 'remote'; + +export type Role = { + id: string; + name: string; + color: string | null; + iconUrl: string | null; + description: string; + isModerator: boolean; + isAdministrator: boolean; + displayOrder: number; +}