Skip to content

Commit b1dde7d

Browse files
authored
Update ESLint and related dependencies to v9 (#475)
1 parent 7b6afe8 commit b1dde7d

20 files changed

Lines changed: 3466 additions & 2049 deletions

File tree

.eslintrc.json

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

.github/workflows/branch-validations.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- uses: actions/checkout@v4
1919
- uses: actions/setup-node@v4
2020
with:
21-
node-version: 16
21+
node-version: 20
2222

2323
- name: Cache dependencies
2424
id: cache-dependencies
@@ -42,7 +42,7 @@ jobs:
4242
- uses: actions/checkout@v4
4343
- uses: actions/setup-node@v4
4444
with:
45-
node-version: 16
45+
node-version: 20
4646

4747
- name: Cache dependencies
4848
id: cache-dependencies
@@ -64,7 +64,7 @@ jobs:
6464
- uses: actions/checkout@v4
6565
- uses: actions/setup-node@v4
6666
with:
67-
node-version: 16
67+
node-version: 20
6868

6969
- name: Cache dependencies
7070
id: cache-dependencies
@@ -89,7 +89,7 @@ jobs:
8989
- uses: actions/checkout@v4
9090
- uses: actions/setup-node@v4
9191
with:
92-
node-version: 16
92+
node-version: 20
9393

9494
- name: Cache dependencies
9595
id: cache-dependencies

.github/workflows/deploy-published-releases.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
- uses: actions/checkout@v4
1313
- uses: actions/setup-node@v4
1414
with:
15-
node-version: 16
15+
node-version: 20
1616

1717
- name: Cache dependencies
1818
id: cache-dependencies

eslint.config.js

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
const eslintPlugin = require('eslint-plugin-eslint-plugin');
2+
const tseslint = require('@typescript-eslint/eslint-plugin');
3+
const tsParser = require('@typescript-eslint/parser');
4+
const jest = require('eslint-plugin-jest');
5+
const importPlugin = require('eslint-plugin-import');
6+
const eslintComments = require('eslint-plugin-eslint-comments');
7+
8+
module.exports = [
9+
eslintPlugin.configs['flat/recommended'],
10+
{
11+
files: ['src/**/*.ts'],
12+
plugins: {
13+
'@typescript-eslint': tseslint,
14+
'jest': jest,
15+
'import': importPlugin,
16+
'eslint-comments': eslintComments,
17+
},
18+
languageOptions: {
19+
parser: tsParser,
20+
parserOptions: {
21+
project: ['./tsconfig.json'],
22+
},
23+
},
24+
rules: {
25+
// TypeScript ESLint recommended rules
26+
...tseslint.configs.recommended.rules,
27+
28+
// TypeScript specific rules from @croct/typescript config
29+
'@typescript-eslint/array-type': ['error', {
30+
default: 'array-simple',
31+
}],
32+
'@typescript-eslint/prefer-as-const': 'error',
33+
'@typescript-eslint/adjacent-overload-signatures': 'error',
34+
'@typescript-eslint/strict-boolean-expressions': ['error', {
35+
allowString: false,
36+
allowNumber: false,
37+
allowNullableObject: false,
38+
}],
39+
'@typescript-eslint/prefer-optional-chain': 'error',
40+
'@typescript-eslint/no-shadow': ['error', {
41+
ignoreTypeValueShadow: true,
42+
ignoreFunctionTypeParameterNameValueShadow: true,
43+
}],
44+
'@typescript-eslint/no-empty-interface': 'off',
45+
'@typescript-eslint/explicit-member-accessibility': ['error'],
46+
'@typescript-eslint/explicit-module-boundary-types': 'off',
47+
'@typescript-eslint/explicit-function-return-type': ['error'],
48+
'@typescript-eslint/no-explicit-any': 'off',
49+
'@typescript-eslint/no-use-before-define': 'off',
50+
'@typescript-eslint/no-unused-expressions': 'error',
51+
'@typescript-eslint/no-unused-vars': ['error', {
52+
args: 'after-used',
53+
ignoreRestSiblings: true,
54+
}],
55+
'@typescript-eslint/no-non-null-assertion': 'off',
56+
'@typescript-eslint/no-namespace': 'off',
57+
58+
// Disable base rules in favor of TypeScript versions
59+
'no-shadow': 'off',
60+
'no-use-before-define': 'off',
61+
'no-unused-expressions': 'off',
62+
'no-unused-vars': 'off',
63+
'no-undef': 'off',
64+
65+
// JavaScript rules from @croct/javascript config (subset relevant for this project)
66+
'indent': ['error', 4, {SwitchCase: 1}],
67+
'linebreak-style': ['error', 'unix'],
68+
'quotes': ['error', 'single', {avoidEscape: true}],
69+
'semi': ['error', 'always'],
70+
'comma-dangle': ['error', 'always-multiline'],
71+
'max-len': ['error', {code: 120}],
72+
'no-multiple-empty-lines': ['error', {max: 1, maxEOF: 0, maxBOF: 0}],
73+
'eol-last': ['error', 'always'],
74+
'object-curly-spacing': ['error', 'never'],
75+
76+
// Import rules
77+
'import/no-duplicates': 'error',
78+
'import/first': 'error',
79+
'import/newline-after-import': 'error',
80+
81+
// ESLint comments rules
82+
'eslint-comments/disable-enable-pair': ['error', {allowWholeFile: true}],
83+
'eslint-comments/no-unused-disable': 'error',
84+
},
85+
},
86+
{
87+
files: ['src/**/*.test.ts'],
88+
plugins: {
89+
'jest': jest,
90+
},
91+
rules: {
92+
...jest.configs.recommended.rules,
93+
'jest/consistent-test-it': ['error', {fn: 'it'}],
94+
'jest/prefer-lowercase-title': ['error', {ignore: ['describe']}],
95+
'@typescript-eslint/explicit-function-return-type': 'off',
96+
},
97+
},
98+
];

0 commit comments

Comments
 (0)