-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy patheslint.config.mjs
More file actions
118 lines (112 loc) · 3.15 KB
/
Copy patheslint.config.mjs
File metadata and controls
118 lines (112 loc) · 3.15 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
107
108
109
110
111
112
113
114
115
116
117
118
import js from '@eslint/js';
import globals from 'globals';
import tsParser from '@typescript-eslint/parser';
import reactPlugin from 'eslint-plugin-react';
import reactHooksPlugin from 'eslint-plugin-react-hooks';
import jsxA11yPlugin from 'eslint-plugin-jsx-a11y';
import importXPlugin from 'eslint-plugin-import-x';
import simpleImportSort from 'eslint-plugin-simple-import-sort';
export default [
{ ignores: ['build/', 'dist/', 'node_modules/', 'coverage/'] },
// src JS/JSX
{
files: ['src/**/*.{js,jsx}'],
languageOptions: {
parser: tsParser,
ecmaVersion: 'latest',
sourceType: 'module',
parserOptions: {
ecmaFeatures: { jsx: true },
},
globals: {
...globals.browser,
globalThis: 'readonly',
},
},
settings: {
react: { version: '19.0.0' },
},
plugins: {
react: reactPlugin,
'react-hooks': reactHooksPlugin,
'jsx-a11y': jsxA11yPlugin,
'import-x': importXPlugin,
'simple-import-sort': simpleImportSort,
},
rules: {
...js.configs.recommended.rules,
...reactPlugin.configs.flat.recommended.rules,
...reactHooksPlugin.configs['recommended-latest'].rules,
...jsxA11yPlugin.flatConfigs.recommended.rules,
...importXPlugin.flatConfigs.recommended.rules,
// Preserved overrides from .eslintrc.json
'react/no-unused-prop-types': ['warn', { skipShapeProps: true }],
'react/react-in-jsx-scope': 'off',
'react/prop-types': 'off',
'react/display-name': 'off',
'array-bracket-spacing': ['warn', 'never'],
'max-len': ['warn', { code: 120 }],
'no-plusplus': 'error',
'no-undef': 'warn',
'no-unused-vars': 'warn',
'no-useless-assignment': 'off',
'jsx-a11y/no-autofocus': 'off',
'object-curly-spacing': ['warn', 'always'],
'import-x/named': 'off',
'simple-import-sort/imports': 'error',
'simple-import-sort/exports': 'error',
},
},
// server — Node.js globals + build-time injected constants
{
files: ['server/**/*.js'],
languageOptions: {
parser: tsParser,
ecmaVersion: 'latest',
sourceType: 'module',
parserOptions: {
ecmaFeatures: { jsx: true },
},
globals: {
...globals.node,
GIT_TAG: 'readonly',
GIT_COMMIT: 'readonly',
},
},
settings: {
react: { version: '19.0.0' },
},
},
// test files — vitest globals
{
files: [
'src/**/*.{test,spec}.{js,jsx}',
'src/**/__tests__/**/*.{js,jsx}',
],
languageOptions: {
globals: {
...globals.jest,
vi: 'readonly',
},
},
},
// Files using CommonJS require() — SSR-safe leaflet loading + test bootstrap
{
files: ['src/views/MapView/**/*.js', 'src/setupTests.js'],
languageOptions: {
globals: {
require: 'readonly',
},
},
},
// serviceWorker — dead CRA scaffolding not currently imported anywhere;
// process.env is the CRA-era pattern preserved for potential reactivation.
{
files: ['src/serviceWorker.js'],
languageOptions: {
globals: {
process: 'readonly',
},
},
},
];