Skip to content

Commit aafdd47

Browse files
authored
Merge pull request #993 from crazy-max/eslint-flat
migrate to eslint v9 flat config
2 parents 7ad1857 + 6e348fa commit aafdd47

5 files changed

Lines changed: 98 additions & 2459 deletions

File tree

.prettierrc.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,5 @@
66
"singleQuote": true,
77
"trailingComma": "none",
88
"bracketSpacing": false,
9-
"arrowParens": "avoid",
10-
"parser": "typescript"
9+
"arrowParens": "avoid"
1110
}

eslint.config.cjs

Lines changed: 0 additions & 90 deletions
This file was deleted.

eslint.config.mjs

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
/**
2+
* Copyright 2025 actions-toolkit authors
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
import {defineConfig} from 'eslint/config';
18+
import js from '@eslint/js';
19+
import tseslint from '@typescript-eslint/eslint-plugin';
20+
import vitest from '@vitest/eslint-plugin';
21+
import globals from 'globals';
22+
import eslintConfigPrettier from 'eslint-config-prettier/flat';
23+
import eslintPluginPrettier from 'eslint-plugin-prettier';
24+
25+
export default defineConfig([
26+
{
27+
ignores: ['.yarn/**/*', 'coverage/**/*', 'lib/**/*']
28+
},
29+
js.configs.recommended,
30+
...tseslint.configs['flat/recommended'],
31+
eslintConfigPrettier,
32+
{
33+
languageOptions: {
34+
globals: {
35+
...globals.node
36+
}
37+
}
38+
},
39+
{
40+
files: ['__tests__/**'],
41+
...vitest.configs.recommended,
42+
languageOptions: {
43+
globals: {
44+
...globals.node,
45+
...vitest.environments.env.globals
46+
}
47+
},
48+
rules: {
49+
...vitest.configs.recommended.rules,
50+
'vitest/no-conditional-expect': 'error',
51+
'vitest/no-disabled-tests': 0
52+
}
53+
},
54+
{
55+
plugins: {
56+
prettier: eslintPluginPrettier
57+
},
58+
rules: {
59+
'prettier/prettier': 'error',
60+
'@typescript-eslint/no-require-imports': [
61+
'error',
62+
{
63+
allowAsImport: true
64+
}
65+
]
66+
}
67+
}
68+
]);

package.json

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,8 @@
55
"type": "module",
66
"scripts": {
77
"build": "tsc",
8-
"lint": "yarn run prettier && yarn run eslint",
9-
"format": "yarn run prettier:fix && yarn run eslint:fix",
10-
"eslint": "eslint --max-warnings=0 .",
11-
"eslint:fix": "eslint --fix .",
12-
"prettier": "prettier --check \"./**/*.ts\"",
13-
"prettier:fix": "prettier --write \"./**/*.ts\"",
8+
"lint": "eslint --max-warnings=0 .",
9+
"format": "eslint --fix .",
1410
"test": "vitest run -c vitest.config.ts",
1511
"test:coverage": "vitest run -c vitest.config.ts --coverage",
1612
"test:itg": "vitest run -c vitest.config.itg.ts --maxWorkers=1",
@@ -70,8 +66,6 @@
7066
"tmp": "^0.2.5"
7167
},
7268
"devDependencies": {
73-
"@eslint/compat": "^2.0.0",
74-
"@eslint/eslintrc": "^3.3.3",
7569
"@eslint/js": "^9.39.2",
7670
"@types/gunzip-maybe": "^1.4.3",
7771
"@types/he": "^1.2.3",
@@ -86,8 +80,8 @@
8680
"@vitest/eslint-plugin": "^1.6.9",
8781
"eslint": "^9.39.2",
8882
"eslint-config-prettier": "^10.1.8",
89-
"eslint-plugin-import": "^2.32.0",
9083
"eslint-plugin-prettier": "^5.5.4",
84+
"globals": "^14.0.0",
9185
"prettier": "^3.7.4",
9286
"rimraf": "^6.1.2",
9387
"typescript": "^5.9.3",

0 commit comments

Comments
 (0)