-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.js
More file actions
166 lines (149 loc) · 5.32 KB
/
eslint.config.js
File metadata and controls
166 lines (149 loc) · 5.32 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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
import eslint from '@eslint/js';
import tseslint from '@typescript-eslint/eslint-plugin';
import tsParser from '@typescript-eslint/parser';
import prettierConfig from 'eslint-config-prettier';
import jsdocPlugin from 'eslint-plugin-jsdoc';
import perfectionistPlugin from 'eslint-plugin-perfectionist';
import promisePlugin from 'eslint-plugin-promise';
import securityPlugin from 'eslint-plugin-security';
import simpleImportSort from 'eslint-plugin-simple-import-sort';
import globals from 'globals';
const TSCONFIG_PATH = './tsconfig.json';
export default [
// Global ignores
{
ignores: [
'.env*',
'**/*.md',
'**/*.mdx',
'**/*.min.js',
'**/build/**',
'**/coverage/**',
'**/dist/**',
'**/node_modules/**',
'.pnpm-store/**',
'**/.pnpm-store/**',
'vite.config.ts.timestamp-*',
'CLAUDE.md',
'.rules',
],
},
// TypeScript files
{
files: ['**/*.ts'],
languageOptions: {
parser: tsParser,
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
project: TSCONFIG_PATH,
},
globals: {
...globals.browser,
...globals.es2022,
},
},
plugins: {
'@typescript-eslint': tseslint,
jsdoc: jsdocPlugin,
perfectionist: perfectionistPlugin,
promise: promisePlugin,
security: securityPlugin,
'simple-import-sort': simpleImportSort,
},
rules: {
// Base ESLint rules
...eslint.configs.recommended.rules,
'no-console': 'off',
'no-debugger': 'error',
'no-unused-vars': 'off', // TypeScript handles this
// TypeScript rules
...tseslint.configs.recommended.rules,
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-non-null-assertion': 'warn',
'@typescript-eslint/consistent-type-imports': ['error', { prefer: 'type-imports' }],
'@typescript-eslint/naming-convention': 'off',
// Import sorting
'simple-import-sort/imports': 'error',
'simple-import-sort/exports': 'error',
// JSDoc rules
'jsdoc/check-alignment': 'warn',
'jsdoc/check-param-names': 'warn',
'jsdoc/check-tag-names': 'warn',
'jsdoc/require-jsdoc': [
'warn',
{
require: {
FunctionDeclaration: true,
MethodDefinition: true,
ClassDeclaration: true,
},
contexts: ['TSInterfaceDeclaration', 'TSTypeAliasDeclaration'],
},
],
'jsdoc/require-param': 'warn',
'jsdoc/require-returns': 'warn',
'jsdoc/require-description': 'warn',
// Code quality rules
complexity: ['warn', { max: 15 }],
// Promise rules
...promisePlugin.configs.recommended.rules,
'promise/always-return': 'warn',
'promise/catch-or-return': 'warn',
'promise/no-return-wrap': 'error',
'promise/param-names': 'error',
'promise/no-nesting': 'warn',
// Security rules
...securityPlugin.configs.recommended.rules,
'security/detect-object-injection': 'warn',
// General code style
'max-len': ['warn', { code: 120, ignoreUrls: true, ignoreStrings: true }],
},
},
// JavaScript config files
{
files: ['**/*.js', '**/*.mjs', '**/*.cjs'],
languageOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
globals: {
...globals.node,
...globals.es2022,
},
},
plugins: {
jsdoc: jsdocPlugin,
perfectionist: perfectionistPlugin,
promise: promisePlugin,
security: securityPlugin,
},
rules: {
...eslint.configs.recommended.rules,
'no-console': 'off',
'no-debugger': 'error',
'no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
// JSDoc rules (relaxed for JS config files)
'jsdoc/check-alignment': 'warn',
'jsdoc/check-param-names': 'warn',
'jsdoc/check-tag-names': 'warn',
// Code quality rules
complexity: ['warn', { max: 15 }],
// Security rules
'security/detect-object-injection': 'warn',
// General code style
'max-len': ['warn', { code: 120, ignoreUrls: true, ignoreStrings: true }],
},
},
// Config files - relaxed rules
{
files: ['*.config.js', '*.config.ts', '*.config.mjs'],
rules: {
'jsdoc/require-jsdoc': 'off',
},
},
// Prettier config (must be last)
prettierConfig,
];