Skip to content

Commit

Permalink
Merge pull request #843 from remap-keys/change-eslint-configuration-f…
Browse files Browse the repository at this point in the history
…ile-format

Migrate the ESLint configuration file as the Flat Config format.
  • Loading branch information
yoichiro authored Jun 9, 2024
2 parents c585503 + 8812142 commit 458cfb7
Show file tree
Hide file tree
Showing 4 changed files with 139 additions and 42 deletions.
41 changes: 0 additions & 41 deletions .eslintrc.json

This file was deleted.

67 changes: 67 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
// This file was generated automatically by `npx @eslint/migrate-config .eslintrc.json`.
// https://www.npmjs.com/package/@eslint/migrate-config

import { fixupConfigRules, fixupPluginRules } from "@eslint/compat";
import react from "eslint-plugin-react";
import prettier from "eslint-plugin-prettier";
import globals from "globals";
import tsParser from "@typescript-eslint/parser";
import path from "node:path";
import { fileURLToPath } from "node:url";
import js from "@eslint/js";
import { FlatCompat } from "@eslint/eslintrc";
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
});

export default [...fixupConfigRules(compat.extends(
"eslint:recommended",
"plugin:react/recommended",
"plugin:prettier/recommended",
"prettier/react",
)), {
files: ["**/*.ts", "**/*.tsx"],
plugins: {
react: fixupPluginRules(react),
prettier: fixupPluginRules(prettier),
},

languageOptions: {
globals: {
...globals.node,
...globals.browser,
HIDDevice: "readonly",
describe: "readonly",
test: "readonly",
expect: "readonly",
fail: "readonly",
assert: "readonly",
},

parser: tsParser,
ecmaVersion: 5,
sourceType: "module",

parserOptions: {
version: 2018,

ecmaFeatures: {
jsx: true,
},
},
},

rules: {
"prettier/prettier": ["warn", {}, {
usePrettierrc: true,
}],

"no-unused-vars": "warn",
"react/prop-types": "warn",
},
}];
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"scripts": {
"start": "vite",
"type-check": "tsc --noEmit",
"lint": "eslint src --ext .ts,.tsx",
"lint": "eslint src",
"build": "yarn type-check && yarn lint && vite build",
"test": "vitest",
"format": "prettier --write './src/**/*.{ts,tsx}'",
Expand All @@ -67,6 +67,9 @@
]
},
"devDependencies": {
"@eslint/compat": "^1.0.3",
"@eslint/eslintrc": "^3.1.0",
"@eslint/js": "^9.4.0",
"@storybook/addon-actions": "^6.1.14",
"@storybook/addon-essentials": "^6.1.15",
"@storybook/addon-links": "^6.1.14",
Expand Down Expand Up @@ -98,6 +101,7 @@
"eslint-config-prettier": "^7.0.0",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-react": "^7.21.5",
"globals": "^15.3.0",
"happy-dom": "^14.12.0",
"husky": "^4.3.6",
"json-schema-to-typescript": "^10.1.2",
Expand Down
67 changes: 67 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2083,6 +2083,13 @@ __metadata:
languageName: node
linkType: hard

"@eslint/compat@npm:^1.0.3":
version: 1.0.3
resolution: "@eslint/compat@npm:1.0.3"
checksum: 10c0/7d8392949c07e518dc487fb745379b08fbc22680039d52f1f370472154fb3e98197e21c4b692479b965739d7ec0c84523b376b43e03360ffbfde65b628788acf
languageName: node
linkType: hard

"@eslint/eslintrc@npm:^2.1.4":
version: 2.1.4
resolution: "@eslint/eslintrc@npm:2.1.4"
Expand All @@ -2100,13 +2107,37 @@ __metadata:
languageName: node
linkType: hard

"@eslint/eslintrc@npm:^3.1.0":
version: 3.1.0
resolution: "@eslint/eslintrc@npm:3.1.0"
dependencies:
ajv: "npm:^6.12.4"
debug: "npm:^4.3.2"
espree: "npm:^10.0.1"
globals: "npm:^14.0.0"
ignore: "npm:^5.2.0"
import-fresh: "npm:^3.2.1"
js-yaml: "npm:^4.1.0"
minimatch: "npm:^3.1.2"
strip-json-comments: "npm:^3.1.1"
checksum: 10c0/5b7332ed781edcfc98caa8dedbbb843abfb9bda2e86538529c843473f580e40c69eb894410eddc6702f487e9ee8f8cfa8df83213d43a8fdb549f23ce06699167
languageName: node
linkType: hard

"@eslint/js@npm:8.57.0":
version: 8.57.0
resolution: "@eslint/js@npm:8.57.0"
checksum: 10c0/9a518bb8625ba3350613903a6d8c622352ab0c6557a59fe6ff6178bf882bf57123f9d92aa826ee8ac3ee74b9c6203fe630e9ee00efb03d753962dcf65ee4bd94
languageName: node
linkType: hard

"@eslint/js@npm:^9.4.0":
version: 9.4.0
resolution: "@eslint/js@npm:9.4.0"
checksum: 10c0/7ffc508d3e9cd496cab7f08c5ba8f97851c8adaea3ebff8804b1c3b4662aa7aac7e9c3b597f7e47fdc29319a107bcf892865070a6b113c2e4d19f8fa1f99f569
languageName: node
linkType: hard

"@firebase/analytics-types@npm:0.6.0":
version: 0.6.0
resolution: "@firebase/analytics-types@npm:0.6.0"
Expand Down Expand Up @@ -5840,6 +5871,9 @@ __metadata:
dependencies:
"@emotion/react": "npm:^11.11.4"
"@emotion/styled": "npm:^11.11.5"
"@eslint/compat": "npm:^1.0.3"
"@eslint/eslintrc": "npm:^3.1.0"
"@eslint/js": "npm:^9.4.0"
"@mui/icons-material": "npm:^5.15.19"
"@mui/material": "npm:^5.15.19"
"@mui/styles": "npm:^5.15.19"
Expand Down Expand Up @@ -5880,6 +5914,7 @@ __metadata:
eslint-plugin-prettier: "npm:^5.1.3"
eslint-plugin-react: "npm:^7.21.5"
firebase: "npm:^8.2.1"
globals: "npm:^15.3.0"
happy-dom: "npm:^14.12.0"
husky: "npm:^4.3.6"
immer: "npm:^8.0.0"
Expand Down Expand Up @@ -9308,6 +9343,13 @@ __metadata:
languageName: node
linkType: hard

"eslint-visitor-keys@npm:^4.0.0":
version: 4.0.0
resolution: "eslint-visitor-keys@npm:4.0.0"
checksum: 10c0/76619f42cf162705a1515a6868e6fc7567e185c7063a05621a8ac4c3b850d022661262c21d9f1fc1d144ecf0d5d64d70a3f43c15c3fc969a61ace0fb25698cf5
languageName: node
linkType: hard

"eslint@npm:8.57.0":
version: 8.57.0
resolution: "eslint@npm:8.57.0"
Expand Down Expand Up @@ -9368,6 +9410,17 @@ __metadata:
languageName: node
linkType: hard

"espree@npm:^10.0.1":
version: 10.0.1
resolution: "espree@npm:10.0.1"
dependencies:
acorn: "npm:^8.11.3"
acorn-jsx: "npm:^5.3.2"
eslint-visitor-keys: "npm:^4.0.0"
checksum: 10c0/7c0f84afa0f9db7bb899619e6364ed832ef13fe8943691757ddde9a1805ae68b826ed66803323015f707a629a5507d0d290edda2276c25131fe0ad883b8b5636
languageName: node
linkType: hard

"espree@npm:^9.6.0, espree@npm:^9.6.1":
version: 9.6.1
resolution: "espree@npm:9.6.1"
Expand Down Expand Up @@ -10500,6 +10553,20 @@ __metadata:
languageName: node
linkType: hard

"globals@npm:^14.0.0":
version: 14.0.0
resolution: "globals@npm:14.0.0"
checksum: 10c0/b96ff42620c9231ad468d4c58ff42afee7777ee1c963013ff8aabe095a451d0ceeb8dcd8ef4cbd64d2538cef45f787a78ba3a9574f4a634438963e334471302d
languageName: node
linkType: hard

"globals@npm:^15.3.0":
version: 15.3.0
resolution: "globals@npm:15.3.0"
checksum: 10c0/edbef1c528185d02636ed6d72a1688168b922d6176031904386214f8b59d893f1d0a28da519b95665f557d366b17ea1affb9f433ea451e7372e2808fb31079d7
languageName: node
linkType: hard

"globalthis@npm:^1.0.0, globalthis@npm:^1.0.3":
version: 1.0.4
resolution: "globalthis@npm:1.0.4"
Expand Down

0 comments on commit 458cfb7

Please sign in to comment.