Skip to content

Commit

Permalink
feat: ESLint Flat Config対応
Browse files Browse the repository at this point in the history
  • Loading branch information
yamadashy committed May 18, 2024
1 parent 5e70664 commit 6d68ac1
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 40 deletions.
38 changes: 0 additions & 38 deletions .eslintrc.js

This file was deleted.

42 changes: 42 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import js from '@eslint/js';
import typescriptEslintParser from '@typescript-eslint/parser';
import typescriptEslint from '@typescript-eslint/eslint-plugin';
import importPlugin from 'eslint-plugin-import';
import eslintPluginPrettier from 'eslint-plugin-prettier';
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
import globals from 'globals';

export default [
{
files: ['**/*.ts'],
languageOptions: {
globals: {
...globals.es2021,
...globals.browser,
...globals.webextensions,
},
parser: typescriptEslintParser,
},
plugins: {
'js': js,
'@typescript-eslint': typescriptEslint,
'import': importPlugin,
'prettier': eslintPluginPrettier,
},
rules: {
...js.configs.recommended.rules,

...typescriptEslint.configs.recommended.rules,
...typescriptEslint.configs.strict.rules,
...typescriptEslint.configs.stylistic.rules,
'@typescript-eslint/no-var-requires': 'off',

...importPlugin.configs.typescript.rules,
'import/no-unresolved': 'off',
'import/prefer-default-export': 'off',

...eslintPluginPrettierRecommended.rules,
'prettier/prettier': 'warn',
},
},
];
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"scripts": {
"dev": "webextension-toolbox dev",
"build": "webextension-toolbox build",
"lint": "eslint ./app/scripts --ext .ts --cache --format 'node_modules/eslint-formatter-friendly'",
"lint": "eslint ./app --max-warnings 0 --cache --format friendly",
"lint:fix": "yarn lint --fix",
"supported-browsers": "yarn browserslist",
"archive": "git archive HEAD -o storage/source.zip",
Expand Down Expand Up @@ -38,13 +38,15 @@
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/preset-env": "^7.23.6",
"@babel/preset-typescript": "^7.23.3",
"@eslint/js": "^9.3.0",
"@types/babel__core": "^7.20.5",
"@types/babel__preset-env": "^7.9.6",
"@types/chrome": "^0.0.268",
"@types/core-js": "2.5.8",
"@types/eslint": "^8.56.0",
"@types/eslint-config-prettier": "^6.11.3",
"@types/eslint-plugin-prettier": "^3.1.3",
"@types/eslint__js": "~8.42.3",
"@types/jquery": "^3.5.29",
"@types/prettier": "^3.0.0",
"@types/webpack-bundle-analyzer": "^4.6.3",
Expand All @@ -57,6 +59,7 @@
"eslint-formatter-friendly": "^7.0.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-prettier": "^5.1.1",
"globals": "^15.2.0",
"prettier": "^3.1.1",
"renovate": "^37.326.2",
"typescript": "^5.3.3",
Expand Down
21 changes: 20 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2492,7 +2492,7 @@ __metadata:
languageName: node
linkType: hard

"@eslint/js@npm:9.3.0":
"@eslint/js@npm:9.3.0, @eslint/js@npm:^9.3.0":
version: 9.3.0
resolution: "@eslint/js@npm:9.3.0"
checksum: 10/3fb4b30561c34b52e7c6c6b55ea61df1cead73a525e1ccd77b1454d893dcf06f99fe9c46bf410a044ef7d3339c455bc4f75769b40c4734343f5b46d2d76b89ef
Expand Down Expand Up @@ -4287,6 +4287,15 @@ __metadata:
languageName: node
linkType: hard

"@types/eslint__js@npm:~8.42.3":
version: 8.42.3
resolution: "@types/eslint__js@npm:8.42.3"
dependencies:
"@types/eslint": "npm:*"
checksum: 10/e31f19de642d35a664695d0cab873ce6de19b8a3506755835b91f8a49a8c41099dcace449df49f1a486de6fa6565d21ceb1fa33be6004fc7adef9226e5d256a1
languageName: node
linkType: hard

"@types/estree@npm:*, @types/estree@npm:^1.0.5":
version: 1.0.5
resolution: "@types/estree@npm:1.0.5"
Expand Down Expand Up @@ -8019,6 +8028,13 @@ __metadata:
languageName: node
linkType: hard

"globals@npm:^15.2.0":
version: 15.2.0
resolution: "globals@npm:15.2.0"
checksum: 10/a3cb67b037c84bfae1a6bedbe316a392a0e40a602b7730fe846312bcc460dd7b08059210762ae6f0e4343259334d473a821d537246983399b10c30c6911b7f9c
languageName: node
linkType: hard

"globalthis@npm:^1.0.1, globalthis@npm:^1.0.3":
version: 1.0.4
resolution: "globalthis@npm:1.0.4"
Expand Down Expand Up @@ -8092,13 +8108,15 @@ __metadata:
"@babel/plugin-proposal-class-properties": "npm:^7.18.6"
"@babel/preset-env": "npm:^7.23.6"
"@babel/preset-typescript": "npm:^7.23.3"
"@eslint/js": "npm:^9.3.0"
"@types/babel__core": "npm:^7.20.5"
"@types/babel__preset-env": "npm:^7.9.6"
"@types/chrome": "npm:^0.0.268"
"@types/core-js": "npm:2.5.8"
"@types/eslint": "npm:^8.56.0"
"@types/eslint-config-prettier": "npm:^6.11.3"
"@types/eslint-plugin-prettier": "npm:^3.1.3"
"@types/eslint__js": "npm:~8.42.3"
"@types/jquery": "npm:^3.5.29"
"@types/prettier": "npm:^3.0.0"
"@types/webpack-bundle-analyzer": "npm:^4.6.3"
Expand All @@ -8112,6 +8130,7 @@ __metadata:
eslint-formatter-friendly: "npm:^7.0.0"
eslint-plugin-import: "npm:^2.29.1"
eslint-plugin-prettier: "npm:^5.1.1"
globals: "npm:^15.2.0"
prettier: "npm:^3.1.1"
renovate: "npm:^37.326.2"
typescript: "npm:^5.3.3"
Expand Down

0 comments on commit 6d68ac1

Please sign in to comment.