-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.js
More file actions
144 lines (136 loc) · 4.63 KB
/
Copy patheslint.config.js
File metadata and controls
144 lines (136 loc) · 4.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
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
import js from '@eslint/js';
import prettierConfig from 'eslint-config-prettier';
import importPlugin from 'eslint-plugin-import-x';
import jsoncPlugin from 'eslint-plugin-jsonc';
import prettierPlugin from 'eslint-plugin-prettier';
import globals from 'globals';
import jsoncParser from 'jsonc-eslint-parser';
export default [
// Config recommandée de base
js.configs.recommended,
// Config globale Node.js
{
languageOptions: {
ecmaVersion: 2022,
sourceType: 'module',
globals: {
...globals.node,
...globals.es2022,
},
},
plugins: {
'import-x': importPlugin,
prettier: prettierPlugin,
},
rules: {
'prettier/prettier': 'error',
indent: 'off',
'linebreak-style': ['error', 'unix'],
quotes: ['error', 'single', { avoidEscape: true, allowTemplateLiterals: true }],
semi: ['error', 'always'],
'no-unused-vars': ['warn', { argsIgnorePattern: '^_', varsIgnorePattern: '^_', caughtErrorsIgnorePattern: '^_' }],
'no-console': 'off',
'no-empty': 'warn',
'comma-dangle': ['error', 'only-multiline'],
'no-trailing-spaces': 'error',
'eol-last': ['error', 'always'],
'object-curly-spacing': ['error', 'always'],
'array-bracket-spacing': ['error', 'never'],
'space-before-function-paren': ['error', { anonymous: 'always', named: 'never', asyncArrow: 'always' }],
'keyword-spacing': ['error', { before: true, after: true }],
'space-infix-ops': 'error',
'comma-spacing': ['error', { before: false, after: true }],
'brace-style': ['error', '1tbs', { allowSingleLine: true }],
curly: ['error', 'all'],
'no-multi-spaces': 'error',
'import-x/order': [
'error',
{
groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'],
pathGroups: [{ pattern: 'node:**', group: 'builtin', position: 'before' }],
pathGroupsExcludedImportTypes: ['builtin'],
'newlines-between': 'never',
alphabetize: { order: 'asc', caseInsensitive: true },
},
],
'import-x/newline-after-import': ['error', { count: 1 }],
'import-x/no-duplicates': 'error',
},
},
// Override pour les fichiers JS côté navigateur (src/public/js/)
{
files: ['src/public/js/**/*.js'],
languageOptions: {
globals: {
...globals.browser,
ApexCharts: 'readonly',
Toastify: 'readonly',
Toast: 'readonly',
},
},
rules: {
'import-x/order': 'off',
'import-x/newline-after-import': 'off',
'no-inner-declarations': 'off',
},
},
// Override pour les fichiers JSON (package.json)
{
files: ['package.json', 'package-lock.json'],
plugins: { jsonc: jsoncPlugin },
languageOptions: { parser: jsoncParser },
rules: {
'jsonc/sort-keys': 'off',
'jsonc/indent': ['error', 'tab'],
},
},
// Override pour les autres JSON
{
files: ['*.json', '**/*.json'],
ignores: ['package.json', 'package-lock.json'],
plugins: { jsonc: jsoncPlugin },
languageOptions: { parser: jsoncParser },
rules: {
'jsonc/sort-keys': ['error', 'asc', { caseSensitive: false, natural: true }],
'jsonc/indent': ['error', 4],
},
},
// Override pour les fichiers de test (Vitest globals)
{
files: ['tests/**/*.test.js'],
languageOptions: {
globals: {
...globals.vitest,
},
},
},
// Prettier en dernier (désactive les règles de formatage conflictuelles)
prettierConfig,
// Ignorer les fichiers (remplace .eslintignore)
{
ignores: [
'_docs/',
'.agents/',
'.github/',
'.husky/',
'.project_docs/',
'.vscode/',
'playwright-report/',
'Puna/',
'Bruno/',
'storage/',
'test-results/',
'dist/',
'build/',
'node_modules/',
'coverage/',
'logs/',
'storage/',
'Puna/',
'tests/',
'**/*.hbs',
'**/*.min.js',
'src/public/plugins/',
],
},
];