Skip to content

Commit

Permalink
chore: ESLintの設定を修正・Flat Configに移行 (#84)
Browse files Browse the repository at this point in the history
* chore: `.eslintrc.json`を削除

* chore: backendのlintのパスを修正

* chore: frontendのlintをflat configへ移行

* chore: frontendのlintコマンドを修正

* chore: frontendのlintのキャッシュファイルをignore

* chore: パッケージ更新
  • Loading branch information
tufusa authored Jul 8, 2024
1 parent 78ddfb1 commit 17b26bd
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 36 deletions.
14 changes: 0 additions & 14 deletions packages/kcms/.eslintrc.json

This file was deleted.

2 changes: 1 addition & 1 deletion packages/kcms/eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const compat = new FlatCompat();
export default [
{
// 対象ファイル
files: ['src/**/**.ts'],
files: ['src/**/*.ts'],
},
{
// 除外ファイル
Expand Down
2 changes: 1 addition & 1 deletion packages/kcms/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
18 changes: 0 additions & 18 deletions packages/kcmsf/.eslintrc.cjs

This file was deleted.

3 changes: 2 additions & 1 deletion packages/kcmsf/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ dist-ssr
*.sln
*.sw?

/coverage
/coverage
.eslintcache
47 changes: 47 additions & 0 deletions packages/kcmsf/eslint.config.js
Original file line number Diff line number Diff line change
@@ -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 },
],
},
},
];
3 changes: 2 additions & 1 deletion packages/kcmsf/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
9 changes: 9 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 17b26bd

Please sign in to comment.