Skip to content

Commit d07d111

Browse files
feat: add eslint 9 support (#3)
BREAKING CHANGE: needs @eslint/js and @estlint/eslintrc dependencies to work
1 parent 4d306b0 commit d07d111

File tree

9 files changed

+907
-1174
lines changed

9 files changed

+907
-1174
lines changed

.editorconfig

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# EditorConfig is awesome: https://EditorConfig.org
2+
3+
root = true
4+
5+
[*]
6+
indent_style = space
7+
indent_size = 2
8+
end_of_line = lf
9+
charset = utf-8
10+
trim_trailing_whitespace = true
11+
insert_final_newline = true
12+
13+
[*.md]
14+
max_line_length = off
15+
trim_trailing_whitespace = false

.eslintrc

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

eslint.config.mjs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import path from 'node:path';
2+
import { fileURLToPath } from 'node:url';
3+
4+
import { FlatCompat } from '@eslint/eslintrc';
5+
import js from '@eslint/js';
6+
7+
const __filename = fileURLToPath(import.meta.url);
8+
const __dirname = path.dirname(__filename);
9+
const compat = new FlatCompat({
10+
baseDirectory: __dirname,
11+
recommendedConfig: js.configs.recommended,
12+
allConfig: js.configs.all,
13+
});
14+
15+
export default [
16+
...compat.extends('./javascript.js', './imports.js', './react.js', './typescript.js'),
17+
{ rules: { 'max-len': 0 } },
18+
];

javascript/best-practices.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable no-magic-numbers */
21
module.exports = {
32
rules: {
43
// enforces getter/setter pairs in objects

javascript/style.js

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable no-magic-numbers */
21
module.exports = {
32
rules: {
43
// enforce line breaks after opening and before closing array brackets
@@ -135,7 +134,7 @@ module.exports = {
135134
// https://eslint.org/docs/rules/indent
136135
indent: [
137136
'warn',
138-
'tab',
137+
2,
139138
{ SwitchCase: 1 },
140139
],
141140

@@ -374,12 +373,7 @@ module.exports = {
374373

375374
// disallow dangling underscores in identifiers
376375
// https://eslint.org/docs/rules/no-underscore-dangle
377-
'no-underscore-dangle': [ 'warn', {
378-
allow: [ '_id' ],
379-
allowAfterThis: false,
380-
allowAfterSuper: false,
381-
enforceInMethodNames: true,
382-
} ],
376+
'no-underscore-dangle': 'off',
383377

384378
// disallow the use of Boolean literals in conditional expressions
385379
// also, prefer `a || b` over `a ? a : b`

javascript/variables.js

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -61,17 +61,6 @@ module.exports = {
6161
// disallow use of variables before they are defined
6262
'no-use-before-define': 'warn',
6363

64-
'no-magic-numbers': [ 'warn', {
65-
ignoreDefaultValues: true,
66-
ignoreArrayIndexes: true,
67-
ignoreClassFieldInitialValues: true,
68-
enforceConst: true,
69-
detectObjects: false,
70-
ignore: [
71-
0,
72-
1,
73-
-1,
74-
],
75-
} ],
64+
'no-magic-numbers': 'off'
7665
},
7766
};

0 commit comments

Comments
 (0)