Skip to content

Commit 5561dba

Browse files
committed
Update eslint to v9 format - flat config
Add tests to take a snapshot of the rules and check the configuration
1 parent e342d38 commit 5561dba

File tree

5 files changed

+6186
-1769
lines changed

5 files changed

+6186
-1769
lines changed

index.js

Lines changed: 46 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,48 @@
1-
module.exports = {
2-
'env': {
3-
'es6': true,
4-
'node': true,
1+
import js from "@eslint/js";
2+
import prettierConfig from "eslint-config-prettier";
3+
import * as typescriptEslintPlugin from "@typescript-eslint/eslint-plugin";
4+
import sonarjs from "eslint-plugin-sonarjs";
5+
6+
export default [
7+
js.configs.recommended,
8+
sonarjs.configs.recommended,
9+
prettierConfig,
10+
{
11+
files: ["**/*.{js,ts,jsx,tsx}"],
12+
languageOptions: {
13+
globals: {
14+
Atomics: "readonly",
15+
SharedArrayBuffer: "readonly",
16+
es6: true,
17+
node: true,
18+
},
19+
parser: typescriptEslintPlugin.parser,
20+
parserOptions: {
21+
ecmaVersion: 2018,
22+
sourceType: "module",
23+
},
24+
},
25+
plugins: {
26+
"@typescript-eslint": typescriptEslintPlugin,
27+
// sonarjs,
28+
},
29+
rules: {
30+
"@typescript-eslint/no-use-before-define": "off",
31+
"@typescript-eslint/no-inferrable-types": "off",
32+
"@typescript-eslint/no-unused-vars": "error",
33+
"@typescript-eslint/interface-name-prefix": "off",
34+
"@typescript-eslint/consistent-type-assertions": [
35+
"error",
36+
{ assertionStyle: "angle-bracket" },
37+
],
38+
"@typescript-eslint/no-explicit-any": "off",
39+
"@typescript-eslint/explicit-function-return-type": "off",
40+
},
541
},
6-
'extends': [
7-
'plugin:@typescript-eslint/recommended',
8-
'plugin:sonarjs/recommended',
9-
'prettier'
10-
],
11-
'globals': {
12-
'Atomics': 'readonly',
13-
'SharedArrayBuffer': 'readonly',
42+
{
43+
files: ["**/*(specs|tests)/**", "**/*.spec.ts"],
44+
rules: {
45+
"@typescript-eslint/no-empty-function": "off",
46+
},
1447
},
15-
'parser': '@typescript-eslint/parser',
16-
'parserOptions': {
17-
'ecmaVersion': 2018,
18-
'sourceType': 'module',
19-
},
20-
'plugins': [
21-
'@typescript-eslint',
22-
'sonarjs'
23-
],
24-
'overrides': [
25-
{
26-
'files': ['**/*(specs|tests)/**', '**/*.spec.ts'],
27-
'rules': {
28-
'@typescript-eslint/no-empty-function': 'off',
29-
'sonarjs/no-identical-functions': 'off',
30-
'sonarjs/no-duplicate-string': 'off'
31-
}
32-
}
33-
],
34-
'rules': {
35-
'@typescript-eslint/no-use-before-define': 'off',
36-
'@typescript-eslint/no-inferrable-types': 'off',
37-
'@typescript-eslint/explicit-function-return-type': 'error',
38-
'@typescript-eslint/no-unused-vars': 'error',
39-
'@typescript-eslint/no-explicit-any': 'error',
40-
'@typescript-eslint/interface-name-prefix': 'off',
41-
'@typescript-eslint/consistent-type-assertions': ['error', {
42-
assertionStyle: 'angle-bracket'
43-
}],
44-
'@typescript-eslint/no-explicit-any': 'off',
45-
'@typescript-eslint/explicit-function-return-type': 'off'
46-
}
47-
};
48+
];

0 commit comments

Comments
 (0)