From 0c9fe00c12a89c8d4a546e176ce2ddb79ad91d45 Mon Sep 17 00:00:00 2001 From: Hazelnoot Date: Tue, 7 Oct 2025 19:52:01 -0400 Subject: [PATCH] fix frontend scripts lint --- packages/frontend/eslint.config.js | 25 +++++++++++++++++-- ...lugin-unwind-css-module-class-name.test.ts | 2 ++ packages/frontend/tsconfig.scripts.json | 24 ++++++++---------- 3 files changed, 36 insertions(+), 15 deletions(-) diff --git a/packages/frontend/eslint.config.js b/packages/frontend/eslint.config.js index 3c232931e8..e11c371eaf 100644 --- a/packages/frontend/eslint.config.js +++ b/packages/frontend/eslint.config.js @@ -217,11 +217,32 @@ export default [ }, }, { - files: ['*.js', '*.ts', 'lib/**/*.ts', 'lib/**/*.js'], + files: [ + '*.js', + '*.ts', + 'lib/**/*.ts', + 'lib/**/*.js', + 'scripts/**/*.ts', + 'scripts/**/*.js', + 'scripts/**/*.mjs', + 'scripts/**/*.cjs', + ], + ignores: [ + 'node_modules', + '.storybook', + 'vue-shims.d.ts', + 'src', + 'test', + '@types', + 'assets', + ], + globals: { + ...globals.node, + }, languageOptions: { parserOptions: { parser: tsParser, - project: ['./tsconfig.scripts.json'], + project: ['tsconfig.scripts.json'], sourceType: 'module', tsconfigRootDir: import.meta.dirname, }, diff --git a/packages/frontend/lib/rollup-plugin-unwind-css-module-class-name.test.ts b/packages/frontend/lib/rollup-plugin-unwind-css-module-class-name.test.ts index ccfa08575b..807a3a5792 100644 --- a/packages/frontend/lib/rollup-plugin-unwind-css-module-class-name.test.ts +++ b/packages/frontend/lib/rollup-plugin-unwind-css-module-class-name.test.ts @@ -171,6 +171,7 @@ const index_photos = /* @__PURE__ */ _export_sfc(_sfc_main, [["__cssModules", cs export { index_photos as default }; `.slice(1), { ecmaVersion: 'latest', sourceType: 'module' }); + // @ts-expect-error This is wrong, but not my problem unwindCssModuleClassName(ast); expect(generate(ast)).toBe(` import {c as api, d as store, i as i18n, aD as notePage, bN as ImgWithBlurhash, bY as getStaticImageUrl, _ as _export_sfc} from './app-!~{001}~.js'; @@ -438,6 +439,7 @@ const MkDateSeparatedList = /* @__PURE__ */ _export_sfc(_sfc_main, [["__cssModul export { MkDateSeparatedList as M }; `.slice(1), { ecmaVersion: 'latest', sourceType: 'module' }); + // @ts-expect-error This is wrong, but not my problem unwindCssModuleClassName(ast); expect(generate(ast)).toBe(` import {a7 as getCurrentInstance, b as defineComponent, G as useCssModule, a1 as h, H as TransitionGroup} from './!~{002}~.js'; diff --git a/packages/frontend/tsconfig.scripts.json b/packages/frontend/tsconfig.scripts.json index 408891a689..9119fd4212 100644 --- a/packages/frontend/tsconfig.scripts.json +++ b/packages/frontend/tsconfig.scripts.json @@ -1,25 +1,23 @@ { "$schema": "https://json.schemastore.org/tsconfig", "extends": "../shared/tsconfig.scripts.jsonc", - "compilerOptions": { - "typeRoots": [ - "./node_modules/@types", - "./node_modules" - ], - "types": [ - "vite/client", - "vitest/importMeta", - ] - }, "include": [ "*.js", "*.ts", "lib/**/*.ts", - "lib/**/*.js" + "lib/**/*.js", + "scripts/**/*.ts", + "scripts/**/*.js", + "scripts/**/*.mjs", + "scripts/**/*.cjs" ], "exclude": [ "node_modules", - ".storybook/**/*", - "vue-shims.d.ts" + ".storybook", + "vue-shims.d.ts", + "src", + "test", + "@types", + "assets" ] }