-
Notifications
You must be signed in to change notification settings - Fork 81
Expand file tree
/
Copy patheslint.config.js
More file actions
174 lines (169 loc) · 3.99 KB
/
eslint.config.js
File metadata and controls
174 lines (169 loc) · 3.99 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
167
168
169
170
171
172
173
174
import { defineConfig, globalIgnores } from 'eslint/config';
import jest from 'eslint-plugin-jest';
import goddaddyTypescript from 'eslint-config-godaddy-typescript';
import goddaddyReactTypescript from 'eslint-config-godaddy-react-typescript';
import unicorn from 'eslint-plugin-unicorn';
import vitest from '@vitest/eslint-plugin';
import jsdoc from 'eslint-plugin-jsdoc';
import typescriptParser from '@typescript-eslint/parser';
import typescriptPlugin from '@typescript-eslint/eslint-plugin';
export default defineConfig([
...goddaddyTypescript,
...goddaddyReactTypescript,
vitest.configs.recommended,
jsdoc.configs['flat/recommended'],
globalIgnores([
'**/node_modules/**',
'**/dist/**',
'**/cjs/**',
'**/react/**',
'**/generator/**',
'**/__mocks__/**',
'**/test/fixtures/**',
'**/gasket-redux/lib',
'**/template/dist',
'**/template/.next',
'**/template/.docs',
'**/template/next-env.d.ts'
]),
//
// Allow custom JSDoc tags
//
{
rules: {
'jsdoc/check-tag-names': ['warn', {
definedTags: ['jest-environment', 'swagger']
}]
}
},
//
// Configurations for Jest and Unicorn
//
{
plugins: {
jest,
unicorn
},
linterOptions: {
reportUnusedDisableDirectives: 'error'
},
languageOptions: {
globals: {
...jest.environments.globals.globals,
vi: 'readonly',
expect: 'readonly',
describe: 'readonly',
it: 'readonly',
test: 'readonly',
beforeEach: 'readonly',
afterEach: 'readonly',
beforeAll: 'readonly',
afterAll: 'readonly'
}
},
rules: {
...jest.configs.recommended.rules,
'unicorn/filename-case': 'error',
'no-sync': 'warn',
'vitest/expect-expect': 'warn'
}
},
//
// Configurations for TypeScript files
//
{
files: ['**/*.{ts,tsx}'],
extends: [
typescriptPlugin.configs['flat/recommended']
],
plugins: {
'@typescript-eslint': typescriptPlugin
},
languageOptions: {
parser: typescriptParser,
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
ecmaFeatures: {
jsx: true
}
}
},
rules: {
'no-unused-vars': 'off',
'no-unused-expressions': 'off',
'no-unused-labels': 'off',
'no-undef': 'warn',
'camelcase': 'off',
'spaced-comment': 'off',
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/no-unsafe-function-type': 'warn',
'@typescript-eslint/no-unused-vars': 'warn',
'@typescript-eslint/no-empty-object-type': 'off',
'jsdoc/require-returns': 'off',
'jsdoc/require-param': 'off'
}
},
//
// Disable certain rules for TypeScript test files
//
{
files: ['**/*.test.{ts,tsx}', '**/*.spec.{ts,tsx}'],
rules: {
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/no-unused-vars': 'off'
}
},
//
// Disable JSDoc rules for test files
//
{
files: ['**/*.test.{js,jsx}', '**/*.spec.{js,jsx}'],
rules: {
'jsdoc/require-jsdoc': 'off',
'jsdoc/require-returns': 'off',
'jsdoc/require-param': 'off'
}
},
//
// Disable certain rules for TypeScript definition files
//
{
files: ['**/*.d.ts'],
rules: {
'@typescript-eslint/triple-slash-reference': 'off'
}
},
//
// Disable certain rules for template scripts
//
{
files: ['scripts/npm.js'],
rules: {
'no-undefined': 'off',
'id-length': 'off'
}
},
//
// Allow sync methods and console in build/utility scripts
//
{
files: ['scripts/**/*.js'],
rules: {
'no-sync': 'off',
'no-console': 'off',
'no-process-exit': 'off',
'no-process-env': 'off'
}
},
//
// Allow console and process.exit in CLI tools
//
{
files: ['packages/gasket-cjs/**/*.js', 'packages/create-gasket-app/**/*.js'],
rules: {
'no-console': 'off',
'no-process-exit': 'off'
}
}
]);