-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.js
More file actions
106 lines (105 loc) · 3.4 KB
/
eslint.config.js
File metadata and controls
106 lines (105 loc) · 3.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
const nx = require('@nx/eslint-plugin');
const esxPlugin = require('eslint-plugin-es-x');
const nPlugin = require('eslint-plugin-n');
const globals = require('globals');
const tseslint = require('typescript-eslint');
module.exports = [
...nx.configs['flat/base'],
...nx.configs['flat/typescript'],
...nx.configs['flat/javascript'],
{
ignores: ['**/dist'],
},
{
files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'],
linterOptions: {
reportUnusedDisableDirectives: 'error',
},
rules: {
'@nx/enforce-module-boundaries': [
'error',
{
enforceBuildableLibDependency: true,
allow: ['^.*/eslint(\\.base)?\\.config\\.[cm]?js$'],
depConstraints: [
{
sourceTag: '*',
onlyDependOnLibsWithTags: ['*'],
},
],
},
],
},
},
{
files: ['**/*.ts', '**/*.tsx'],
languageOptions: {
parser: tseslint.parser,
parserOptions: {
projectService: true,
tsconfigRootDir: __dirname,
},
},
rules: {
'@typescript-eslint/no-deprecated': 'error',
'@typescript-eslint/no-non-null-assertion': 'error',
},
},
{
files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'],
plugins: {
'es-x': esxPlugin,
n: nPlugin,
},
rules: {
// Enforce node: protocol for built-in modules (supported in Node.js 18+)
'n/prefer-node-protocol': 'error',
// Ban Node.js 22+ features not available in Node.js 18
// RegExp Unicode Sets + /v flag (Node 22+)
'es-x/no-regexp-v-flag': 'error',
// Promise.withResolvers (Node 22+)
'es-x/no-promise-withresolvers': 'error',
// Array copy-by-value methods (Node 20+, uncertain in all Node 18.x)
'es-x/no-array-prototype-toreversed': 'error',
'es-x/no-array-prototype-tosorted': 'error',
'es-x/no-array-prototype-tospliced': 'error',
'es-x/no-array-prototype-with': 'error',
// Array findLast / findLastIndex (Node 20+)
'es-x/no-array-prototype-findlast-findlastindex': 'error',
// Iterator helpers (Experimental, Node 22+/24)
'es-x/no-iterator-prototype-map': 'error',
'es-x/no-iterator-prototype-filter': 'error',
'es-x/no-iterator-prototype-take': 'error',
'es-x/no-iterator-prototype-drop': 'error',
'es-x/no-iterator-prototype-flatmap': 'error',
'es-x/no-iterator-prototype-foreach': 'error',
'es-x/no-iterator-prototype-reduce': 'error',
'es-x/no-iterator-prototype-toarray': 'error',
'es-x/no-iterator-prototype-some': 'error',
'es-x/no-iterator-prototype-every': 'error',
'es-x/no-iterator-prototype-find': 'error',
// Set methods (Experimental, Stage 3)
'es-x/no-set-prototype-union': 'error',
'es-x/no-set-prototype-intersection': 'error',
'es-x/no-set-prototype-difference': 'error',
'es-x/no-set-prototype-symmetricdifference': 'error',
'es-x/no-set-prototype-issubsetof': 'error',
'es-x/no-set-prototype-issupersetof': 'error',
'es-x/no-set-prototype-isdisjointfrom': 'error',
},
},
{
files: ['**/*.spec.ts', '**/*.spec.tsx', '**/*.spec.js', '**/*.spec.jsx'],
languageOptions: {
globals: {
...globals.jest,
},
},
},
{
files: ['**/*.json'],
// Override or add rules here
rules: {},
languageOptions: { parser: require('jsonc-eslint-parser') },
},
];