Skip to content

Commit 9c244ca

Browse files
authored
ESLint Configuration migration - PR#5 from glenn2223
Applied a migration for `eslint`'s config files
2 parents faad8d2 + 824c580 commit 9c244ca

File tree

2 files changed

+139
-113
lines changed

2 files changed

+139
-113
lines changed

.eslintrc.json

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

eslint.config.mjs

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
import typescriptEslint from '@typescript-eslint/eslint-plugin';
2+
import globals from 'globals';
3+
import tsParser from '@typescript-eslint/parser';
4+
import path from 'node:path';
5+
import { fileURLToPath } from 'node:url';
6+
import js from '@eslint/js';
7+
import { FlatCompat } from '@eslint/eslintrc';
8+
9+
const __filename = fileURLToPath(import.meta.url);
10+
const __dirname = path.dirname(__filename);
11+
const compat = new FlatCompat({
12+
baseDirectory: __dirname,
13+
recommendedConfig: js.configs.recommended,
14+
allConfig: js.configs.all,
15+
});
16+
17+
export default [
18+
...compat.extends(
19+
'eslint:recommended',
20+
'plugin:@typescript-eslint/recommended',
21+
),
22+
{
23+
plugins: {
24+
'@typescript-eslint': typescriptEslint,
25+
},
26+
27+
languageOptions: {
28+
globals: {
29+
...globals.browser,
30+
...globals.commonjs,
31+
...globals.node,
32+
},
33+
34+
parser: tsParser,
35+
ecmaVersion: 12,
36+
sourceType: 'commonjs',
37+
},
38+
39+
rules: {
40+
'@typescript-eslint/naming-convention': [
41+
'warn',
42+
{
43+
selector: 'function',
44+
format: ['camelCase'],
45+
},
46+
],
47+
48+
'@typescript-eslint/semi': 'warn',
49+
'@typescript-eslint/ban-ts-comment': 'off',
50+
'@typescript-eslint/no-non-null-assertion': 'off',
51+
semi: 'off',
52+
'getter-return': 'warn',
53+
'no-dupe-args': 'warn',
54+
'no-dupe-else-if': 'warn',
55+
'no-dupe-keys': 'warn',
56+
'no-duplicate-case': 'warn',
57+
'no-empty': 'warn',
58+
'accessor-pairs': 'warn',
59+
'array-callback-return': 'warn',
60+
'block-scoped-var': 'warn',
61+
'class-methods-use-this': 'warn',
62+
complexity: 'warn',
63+
'consistent-return': 'warn',
64+
curly: 'warn',
65+
'default-case': 'warn',
66+
'default-case-last': 'warn',
67+
'default-param-last': 'warn',
68+
'dot-location': 'off',
69+
'dot-notation': 'warn',
70+
eqeqeq: 'warn',
71+
'grouped-accessor-pairs': 'warn',
72+
'guard-for-in': 'off',
73+
'max-classes-per-file': ['warn', 2],
74+
'no-alert': 'warn',
75+
'no-caller': 'warn',
76+
'no-case-declarations': 'off',
77+
'no-constructor-return': 'warn',
78+
'no-div-regex': 'warn',
79+
'no-else-return': 'warn',
80+
'no-empty-function': 'warn',
81+
'no-empty-pattern': 'warn',
82+
'no-eq-null': 'warn',
83+
'no-eval': 'warn',
84+
'no-extend-native': 'off',
85+
'no-extra-bind': 'warn',
86+
'no-extra-label': 'warn',
87+
'no-fallthrough': 'warn',
88+
'no-floating-decimal': 'warn',
89+
'no-global-assign': 'warn',
90+
'no-implicit-coercion': 'warn',
91+
'no-implicit-globals': 'warn',
92+
'no-implied-eval': 'warn',
93+
'no-invalid-this': 'off',
94+
'no-iterator': 'warn',
95+
'no-labels': 'warn',
96+
'no-lone-blocks': 'warn',
97+
'no-loop-func': 'warn',
98+
'no-magic-numbers': 'off',
99+
'no-mixed-spaces-and-tabs': ['warn', 'smart-tabs'],
100+
'no-multi-spaces': 'warn',
101+
'no-multi-str': 'warn',
102+
'no-new': 'warn',
103+
'no-new-func': 'warn',
104+
'no-new-wrappers': 'warn',
105+
'no-octal': 'warn',
106+
'no-octal-escape': 'warn',
107+
'no-param-reassign': 'warn',
108+
'no-proto': 'warn',
109+
'no-redeclare': 'off',
110+
'no-restricted-properties': 'warn',
111+
'no-return-assign': 'warn',
112+
'no-return-await': 'warn',
113+
'no-script-url': 'warn',
114+
'no-self-assign': 'warn',
115+
'no-self-compare': 'warn',
116+
'no-sequences': 'warn',
117+
'no-throw-literal': 'warn',
118+
'no-unmodified-loop-condition': 'warn',
119+
'no-unused-expressions': 'warn',
120+
'no-unused-labels': 'warn',
121+
'no-useless-call': 'warn',
122+
'no-useless-catch': 'warn',
123+
'no-useless-concat': 'warn',
124+
'no-useless-escape': 'warn',
125+
'no-useless-return': 'warn',
126+
'no-void': 'warn',
127+
'no-warning-comments': 'warn',
128+
'no-with': 'warn',
129+
'prefer-named-capture-group': 'warn',
130+
'prefer-promise-reject-errors': 'off',
131+
'prefer-regex-literals': 'warn',
132+
radix: 'warn',
133+
'require-await': 'warn',
134+
'require-unicode-regexp': 'off',
135+
'vars-on-top': 'warn',
136+
'wrap-iife': 'warn',
137+
},
138+
},
139+
];

0 commit comments

Comments
 (0)