Skip to content

Commit d8fe9f1

Browse files
committed
chore: update eslint to v9 and migrate to new config format
- Updated `eslint` to `v9.36.0` - Replace `@typescript-eslint/parser` and `@typescript-eslint/eslint-plugin` with `typescript-eslint` - Migrated to new flat config format using `eslint.config.mjs` - Updated related dependencies to compatible versions
1 parent 1665a60 commit d8fe9f1

5 files changed

Lines changed: 1339 additions & 135 deletions

File tree

.eslintignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

.eslintrc

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

eslint.config.mjs

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
import { defineConfig, globalIgnores } from 'eslint/config'
2+
import eslintPluginImport from 'eslint-plugin-import'
3+
import eslintPluginN from 'eslint-plugin-n'
4+
import eslintPluginPromise from 'eslint-plugin-promise'
5+
import globals from 'globals'
6+
import standard from 'eslint-config-standard'
7+
import tseslint from 'typescript-eslint'
8+
9+
export default defineConfig([
10+
{
11+
languageOptions: {
12+
parserOptions: {
13+
ecmaFeatures: standard.parserOptions.ecmaFeatures,
14+
ecmaVersion: 2022
15+
},
16+
globals: {
17+
...globals.es2021,
18+
...globals.node,
19+
document: 'readonly',
20+
navigator: 'readonly',
21+
window: 'readonly'
22+
}
23+
},
24+
name: 'zcli/standard',
25+
plugins: {
26+
import: eslintPluginImport,
27+
n: eslintPluginN,
28+
promise: eslintPluginPromise
29+
},
30+
rules: {
31+
...standard.rules,
32+
'no-unused-expressions': ['error', {
33+
allowShortCircuit: true,
34+
allowTernary: true,
35+
allowTaggedTemplates: true
36+
}]
37+
}
38+
},
39+
{
40+
extends: [tseslint.configs.recommended],
41+
files: ['**/*.ts', '**/*.test.ts'],
42+
languageOptions: {
43+
parser: tseslint.parser,
44+
parserOptions: {
45+
sourceType: 'module'
46+
}
47+
},
48+
name: 'zcli/monorepo',
49+
rules: {
50+
'@typescript-eslint/no-unused-expressions': ['error', {
51+
allowShortCircuit: true,
52+
allowTernary: true,
53+
allowTaggedTemplates: true
54+
}],
55+
'@typescript-eslint/camelcase': 'off',
56+
'@typescript-eslint/explicit-function-return-type': 'off',
57+
'@typescript-eslint/no-unused-vars': [2, { argsIgnorePattern: '^_', varsIgnorePattern: '^_.+', caughtErrorsIgnorePattern: '^_.+' }],
58+
'eol-last': ['error', 'always'],
59+
'space-before-blocks': ['error', 'always'],
60+
camelcase: 'off',
61+
indent: ['error', 2],
62+
semi: 'off'
63+
}
64+
},
65+
{
66+
files: ['**/*.test.ts'],
67+
languageOptions: {
68+
globals: globals.mocha,
69+
parser: tseslint.parser,
70+
parserOptions: {
71+
sourceType: 'module'
72+
}
73+
},
74+
name: 'zcli/tests'
75+
},
76+
globalIgnores([
77+
'node_modules',
78+
'packages/**/node_modules'
79+
])
80+
])

package.json

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,15 @@
1212
"@oclif/test": "=2.1.0",
1313
"@types/chai": "^4",
1414
"@types/express": "^4.17.3",
15+
"@types/glob": "^8.1.0",
1516
"@types/mocha": "^9.1.1",
1617
"@types/node": "^14.0.14",
17-
"@types/glob": "^8.1.0",
18-
"@typescript-eslint/eslint-plugin": "^5.30.0",
19-
"@typescript-eslint/parser": "^5.30.0",
2018
"chai": "^4",
21-
"eslint": "^8.18.0",
22-
"eslint-config-standard": "^17.0.0",
23-
"eslint-plugin-import": "2",
24-
"eslint-plugin-node": "^11.1.0",
25-
"eslint-plugin-promise": "^6.0.0",
19+
"eslint": "^9.36.0",
20+
"eslint-config-standard": "^17.1.0",
21+
"eslint-plugin-import": "^2.32.0",
22+
"eslint-plugin-n": "^17.23.1",
23+
"eslint-plugin-promise": "^7.2.1",
2624
"form-data": "^4.0.0",
2725
"lerna": "^5.6.2",
2826
"lerna-changelog": "^2.2.0",
@@ -32,6 +30,7 @@
3230
"standard": "^17.0.0",
3331
"ts-node": "^10.9.1",
3432
"typescript": "~4.7.4",
33+
"typescript-eslint": "^8.44.1",
3534
"yarn-audit-fix": "^10.1.1"
3635
},
3736
"engines": {
@@ -49,7 +48,7 @@
4948
"dev": "ts-node ./packages/zcli/bin/run",
5049
"git:check": "./scripts/git_check.sh",
5150
"link:bin": "bash ./scripts/link_dev.sh",
52-
"lint": "eslint . --ext .ts --config .eslintrc",
51+
"lint": "eslint",
5352
"test": "nyc --extension .ts mocha --config=.mocharc.json --forbid-only packages/**/src/**/*.test.ts",
5453
"test:functional": "mocha --config=.mocharc.json -r ts-node/register packages/**/tests/**/*.test.ts",
5554
"changelog": "lerna-changelog",

0 commit comments

Comments
 (0)