forked from Talenttrust/Talenttrust-Frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.js
More file actions
87 lines (86 loc) · 2.63 KB
/
Copy patheslint.config.js
File metadata and controls
87 lines (86 loc) · 2.63 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
const js = require('@eslint/js');
const globals = require('globals');
const nextPlugin = require('@next/eslint-plugin-next');
const tsPlugin = require('@typescript-eslint/eslint-plugin');
const tsParser = require('@typescript-eslint/parser');
module.exports = [
// Ignore stray files that should never be linted
// - `test_check.js` and `coverage/**` are generated/test artefacts that
// would otherwise pollute lint output during CI.
// - `.next/**` is the Next.js build cache (regenerated on every build).
// - `node_modules/**` is third-party code.
// - `src/declarations.d.ts` holds ambient declarations (no executable code).
{
ignores: [
'**/test_check.js',
'**/.next/**',
'**/node_modules/**',
'**/coverage/**',
'**/src/declarations.d.ts',
],
},
// Filter deprecated/removed rules that crash ESLint 10+ (e.g. no-unassigned-vars)
(() => {
const unsupported = new Set(['no-unassigned-vars', 'no-useless-assignment', 'preserve-caught-error']);
const filteredRules = {};
for (const [key, value] of Object.entries(js.configs.recommended.rules)) {
if (!unsupported.has(key)) {
filteredRules[key] = value;
}
}
return { ...js.configs.recommended, rules: filteredRules };
})(),
// Next.js recommended rules (from @next/eslint-plugin-next, not the
// eslint-config-next wrapper which exports an array incompatible with
// direct plugin registration in flat config).
{
name: 'next/recommended',
files: ['**/*.{js,jsx,ts,tsx,mjs}'],
plugins: {
'@next/next': nextPlugin,
},
rules: {
...nextPlugin.configs.recommended.rules,
},
},
// TypeScript configuration
{
name: 'typescript/rules',
files: ['**/*.{ts,tsx}'],
languageOptions: {
parser: tsParser,
parserOptions: {
ecmaFeatures: { jsx: true },
},
},
plugins: {
'@typescript-eslint': tsPlugin,
},
rules: {
// Disable base rule — @typescript-eslint/no-unused-vars handles TS correctly
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': ['error', {
vars: 'all',
args: 'after-used',
ignoreRestSiblings: true,
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_',
}],
},
},
// Shared globals for all source files (browser, Node, Jest, React, JSX)
{
name: 'shared/globals',
files: ['**/*.{js,jsx,ts,tsx,mjs}'],
languageOptions: {
globals: {
...globals.browser,
...globals.node,
...globals.jest,
React: 'readonly',
JSX: 'readonly',
},
},
},
];