diff --git a/packages/kcms/.eslintrc.json b/packages/kcms/.eslintrc.json deleted file mode 100644 index 28d63a33..00000000 --- a/packages/kcms/.eslintrc.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "env": { - "browser": false, - "es2021": true - }, - "extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended", "prettier"], - "parser": "@typescript-eslint/parser", - "parserOptions": { - "ecmaVersion": "latest", - "sourceType": "module" - }, - "plugins": ["@typescript-eslint"], - "rules": {} -} diff --git a/packages/kcms/eslint.config.js b/packages/kcms/eslint.config.js index a1193185..2ba8f181 100644 --- a/packages/kcms/eslint.config.js +++ b/packages/kcms/eslint.config.js @@ -10,7 +10,7 @@ const compat = new FlatCompat(); export default [ { // 対象ファイル - files: ['src/**/**.ts'], + files: ['src/**/*.ts'], }, { // 除外ファイル diff --git a/packages/kcms/package.json b/packages/kcms/package.json index b5af61dc..ab58074c 100644 --- a/packages/kcms/package.json +++ b/packages/kcms/package.json @@ -8,7 +8,7 @@ "start": "node ./build/main.js", "dev": "tsx ./src/main.ts", "build": "esbuild ./src/main.ts --bundle --sourcemap --platform=node --target=node16 --format=esm --packages=external --outfile=build/main.js", - "lint": "eslint --cache 'src/**/**.ts'", + "lint": "eslint --cache \"src/**/*.ts\"", "format": "prettier . --write", "test": "vitest run", "coverage": "vitest run --coverage", diff --git a/packages/kcmsf/.eslintrc.cjs b/packages/kcmsf/.eslintrc.cjs deleted file mode 100644 index 6e8698b7..00000000 --- a/packages/kcmsf/.eslintrc.cjs +++ /dev/null @@ -1,18 +0,0 @@ -module.exports = { - root: true, - env: { browser: true, es2020: true }, - extends: [ - "eslint:recommended", - "plugin:@typescript-eslint/recommended", - "plugin:react-hooks/recommended", - ], - ignorePatterns: ["dist", ".eslintrc.cjs"], - parser: "@typescript-eslint/parser", - plugins: ["react-refresh"], - rules: { - "react-refresh/only-export-components": [ - "warn", - { allowConstantExport: true }, - ], - }, -}; diff --git a/packages/kcmsf/.gitignore b/packages/kcmsf/.gitignore index 9efa1055..a5c6c79c 100644 --- a/packages/kcmsf/.gitignore +++ b/packages/kcmsf/.gitignore @@ -23,4 +23,5 @@ dist-ssr *.sln *.sw? -/coverage \ No newline at end of file +/coverage +.eslintcache diff --git a/packages/kcmsf/eslint.config.js b/packages/kcmsf/eslint.config.js new file mode 100644 index 00000000..b1d6f1f3 --- /dev/null +++ b/packages/kcmsf/eslint.config.js @@ -0,0 +1,47 @@ +import { FlatCompat } from "@eslint/eslintrc"; +import js from "@eslint/js"; +import typeScriptESLint from "@typescript-eslint/eslint-plugin"; +import typeScriptESLintParser from "@typescript-eslint/parser"; +import eslintConfigPrettier from "eslint-config-prettier"; +import reactRefresh from "eslint-plugin-react-refresh"; +import vitest from "eslint-plugin-vitest"; +import globals from "globals"; + +const compat = new FlatCompat(); + +export default [ + { + files: ["src/**/*.{ts,tsx}"], + }, + { + ignores: ["dist/**", "node_modules/**"], + }, + js.configs.recommended, + eslintConfigPrettier, + ...compat.extends("plugin:@typescript-eslint/recommended"), + ...compat.extends("plugin:react-hooks/recommended"), + { + languageOptions: { + parser: typeScriptESLintParser, + globals: { + ...globals.browser, + }, + }, + }, + { + plugins: { + "@typescript-eslint": typeScriptESLint, + "react-refresh": reactRefresh, + vitest, + }, + }, + { + rules: { + ...vitest.configs.recommended.rules, + "react-refresh/only-export-components": [ + "warn", + { allowConstantExport: true }, + ], + }, + }, +]; diff --git a/packages/kcmsf/package.json b/packages/kcmsf/package.json index a387b2fd..ccc42a41 100644 --- a/packages/kcmsf/package.json +++ b/packages/kcmsf/package.json @@ -6,7 +6,7 @@ "scripts": { "dev": "vite", "build": "tsc && vite build", - "lint": "eslint . --ext ts,tsx --report-unused-disable-directives", + "lint": "eslint --cache \"src/**/*.{ts,tsx}\" --report-unused-disable-directives", "preview": "vite preview", "format": "prettier --write .", "test": "vitest --watch --ui --coverage.enabled=true", @@ -40,6 +40,7 @@ "eslint": "^8.53.0", "eslint-plugin-react-hooks": "^4.6.0", "eslint-plugin-react-refresh": "^0.4.4", + "globals": "^15.8.0", "jsdom": "^24.0.0", "postcss": "^8.4.32", "postcss-preset-mantine": "^1.11.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index cdef3c1f..d10acfa0 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -147,6 +147,9 @@ importers: eslint-plugin-react-refresh: specifier: ^0.4.4 version: 0.4.7(eslint@8.57.0) + globals: + specifier: ^15.8.0 + version: 15.8.0 jsdom: specifier: ^24.0.0 version: 24.1.0 @@ -1489,6 +1492,10 @@ packages: resolution: {integrity: sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==} engines: {node: '>=18'} + globals@15.8.0: + resolution: {integrity: sha512-VZAJ4cewHTExBWDHR6yptdIBlx9YSSZuwojj9Nt5mBRXQzrKakDsVKQ1J63sklLvzAJm0X5+RpO4i3Y2hcOnFw==} + engines: {node: '>=18'} + globby@11.1.0: resolution: {integrity: sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==} engines: {node: '>=10'} @@ -3666,6 +3673,8 @@ snapshots: globals@14.0.0: {} + globals@15.8.0: {} + globby@11.1.0: dependencies: array-union: 2.1.0