@jimmy.codes/eslint-config 4.3.0 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -9
- package/dist/astro-Z5RFF624.js +71 -0
- package/dist/chunk-72FT76PY.js +9 -0
- package/dist/chunk-BJU7UEJ3.js +12 -0
- package/dist/chunk-N5KZEOXT.js +80 -0
- package/dist/chunk-OCS4JNPP.js +55 -0
- package/dist/{index.d.cts → index.d.ts} +2500 -367
- package/dist/index.js +542 -0
- package/dist/jest-AHG2WRSU.js +72 -0
- package/dist/nextjs-RCR4GYMK.js +35 -0
- package/dist/playwright-U4PCWDYV.js +49 -0
- package/dist/react-X5DWOH4Y.js +189 -0
- package/dist/storybook-4KS3DD3C.js +37 -0
- package/dist/tanstack-query-UHBVVQ7V.js +32 -0
- package/dist/testing-library-7RTMAEOX.js +42 -0
- package/dist/typescript-IBCLQD7Q.js +85 -0
- package/dist/vitest-YI6KNRZE.js +85 -0
- package/package.json +6 -14
- package/dist/index.cjs +0 -1
- package/dist/index.d.mts +0 -15929
- package/dist/index.mjs +0 -1
package/dist/index.js
ADDED
|
@@ -0,0 +1,542 @@
|
|
|
1
|
+
import {
|
|
2
|
+
hasAstro,
|
|
3
|
+
hasJest,
|
|
4
|
+
hasNext,
|
|
5
|
+
hasPlaywright,
|
|
6
|
+
hasReact,
|
|
7
|
+
hasReactQuery,
|
|
8
|
+
hasStorybook,
|
|
9
|
+
hasTestingLibrary,
|
|
10
|
+
hasTypescript,
|
|
11
|
+
hasVitest
|
|
12
|
+
} from "./chunk-OCS4JNPP.js";
|
|
13
|
+
import {
|
|
14
|
+
GLOB_CJS,
|
|
15
|
+
GLOB_IGNORES,
|
|
16
|
+
GLOB_TESTS
|
|
17
|
+
} from "./chunk-N5KZEOXT.js";
|
|
18
|
+
|
|
19
|
+
// src/configs/commonjs.ts
|
|
20
|
+
import globals from "globals";
|
|
21
|
+
var commonjsConfig = () => {
|
|
22
|
+
return [
|
|
23
|
+
{
|
|
24
|
+
files: [GLOB_CJS],
|
|
25
|
+
languageOptions: {
|
|
26
|
+
globals: globals.commonjs
|
|
27
|
+
},
|
|
28
|
+
name: "jimmy.codes/commonjs"
|
|
29
|
+
}
|
|
30
|
+
];
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
// src/configs/eslint-comments.ts
|
|
34
|
+
import comments2 from "@eslint-community/eslint-plugin-eslint-comments/configs";
|
|
35
|
+
|
|
36
|
+
// src/rules/eslint-comments.ts
|
|
37
|
+
import comments from "@eslint-community/eslint-plugin-eslint-comments/configs";
|
|
38
|
+
var eslintCommentsRules = {
|
|
39
|
+
...comments.recommended.rules,
|
|
40
|
+
"@eslint-community/eslint-comments/no-unused-disable": "off",
|
|
41
|
+
"@eslint-community/eslint-comments/require-description": "error"
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
// src/configs/eslint-comments.ts
|
|
45
|
+
var eslintCommentsConfig = () => {
|
|
46
|
+
return [
|
|
47
|
+
{
|
|
48
|
+
...comments2.recommended,
|
|
49
|
+
name: "jimmy.codes/eslint-comments",
|
|
50
|
+
rules: eslintCommentsRules
|
|
51
|
+
}
|
|
52
|
+
];
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
// src/configs/ignores.ts
|
|
56
|
+
var ignoresConfig = (ignores) => {
|
|
57
|
+
return [
|
|
58
|
+
{
|
|
59
|
+
ignores: [...GLOB_IGNORES, ...ignores],
|
|
60
|
+
name: "jimmy.codes/ignores"
|
|
61
|
+
}
|
|
62
|
+
];
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
// src/configs/imports.ts
|
|
66
|
+
import { createTypeScriptImportResolver } from "eslint-import-resolver-typescript";
|
|
67
|
+
import importX2 from "eslint-plugin-import-x";
|
|
68
|
+
import nodePlugin from "eslint-plugin-n";
|
|
69
|
+
|
|
70
|
+
// src/rules/imports.ts
|
|
71
|
+
import importX from "eslint-plugin-import-x";
|
|
72
|
+
var importsRules = {
|
|
73
|
+
...importX.configs.recommended.rules,
|
|
74
|
+
"import-x/consistent-type-specifier-style": ["error", "prefer-top-level"],
|
|
75
|
+
"import-x/extensions": [
|
|
76
|
+
"error",
|
|
77
|
+
"never",
|
|
78
|
+
{ checkTypedImports: true, svg: "always" }
|
|
79
|
+
],
|
|
80
|
+
"import-x/first": "error",
|
|
81
|
+
// ! can't get this rule to work
|
|
82
|
+
"import-x/namespace": "off",
|
|
83
|
+
"import-x/newline-after-import": "error",
|
|
84
|
+
"import-x/no-absolute-path": "error",
|
|
85
|
+
"import-x/no-duplicates": "error",
|
|
86
|
+
"import-x/no-empty-named-blocks": "error",
|
|
87
|
+
"import-x/no-named-as-default": "error",
|
|
88
|
+
"import-x/no-named-as-default-member": "error",
|
|
89
|
+
"import-x/no-self-import": "error",
|
|
90
|
+
"import-x/no-unresolved": ["error", { ignore: [String.raw`\.svg$`] }],
|
|
91
|
+
"import-x/no-useless-path-segments": "error"
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
// src/configs/imports.ts
|
|
95
|
+
var importsTypescriptConfig = () => {
|
|
96
|
+
const { rules, settings } = importX2.configs.typescript;
|
|
97
|
+
return [
|
|
98
|
+
{
|
|
99
|
+
name: "jimmy.codes/imports/typescript",
|
|
100
|
+
rules,
|
|
101
|
+
settings: {
|
|
102
|
+
"import-x/extensions": settings["import-x/extensions"],
|
|
103
|
+
"import-x/external-module-folders": settings["import-x/external-module-folders"],
|
|
104
|
+
"import-x/parsers": settings["import-x/parsers"],
|
|
105
|
+
"import-x/resolver-next": [
|
|
106
|
+
createTypeScriptImportResolver({
|
|
107
|
+
alwaysTryTypes: true
|
|
108
|
+
})
|
|
109
|
+
]
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
];
|
|
113
|
+
};
|
|
114
|
+
var importsConfig = ({
|
|
115
|
+
typescript = false
|
|
116
|
+
} = {}) => {
|
|
117
|
+
return [
|
|
118
|
+
{
|
|
119
|
+
name: "jimmy.codes/imports",
|
|
120
|
+
plugins: {
|
|
121
|
+
"import-x": importX2,
|
|
122
|
+
"n": nodePlugin
|
|
123
|
+
},
|
|
124
|
+
rules: importsRules
|
|
125
|
+
},
|
|
126
|
+
...typescript ? importsTypescriptConfig() : []
|
|
127
|
+
];
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
// src/rules/javascript.ts
|
|
131
|
+
import eslint from "@eslint/js";
|
|
132
|
+
var additionalRules = {
|
|
133
|
+
"array-callback-return": [
|
|
134
|
+
"error",
|
|
135
|
+
{
|
|
136
|
+
allowImplicit: true
|
|
137
|
+
// Allow implicit return for flexibility while enforcing return consistency
|
|
138
|
+
}
|
|
139
|
+
],
|
|
140
|
+
"arrow-body-style": ["error", "always"],
|
|
141
|
+
// Enforce `{}` in arrow functions for consistency (open to revisiting)
|
|
142
|
+
"class-methods-use-this": "error",
|
|
143
|
+
// Ensures class methods are used within their class (avoids unnecessary methods)
|
|
144
|
+
"consistent-return": "error",
|
|
145
|
+
// Prevents inconsistent function returns (e.g., sometimes returning `undefined`)
|
|
146
|
+
"curly": ["error", "all"],
|
|
147
|
+
// Enforce `{}` around all control statements (avoids accidental bugs)
|
|
148
|
+
"default-case": "error",
|
|
149
|
+
// Require `default` case in switch statements (prevents unintended fallthrough)
|
|
150
|
+
"default-case-last": "error",
|
|
151
|
+
// Ensure the `default` case is the last one in `switch`
|
|
152
|
+
"no-console": "warn",
|
|
153
|
+
// Allow logging in development, but should be reviewed for production builds
|
|
154
|
+
"no-implicit-coercion": "error",
|
|
155
|
+
// Prevents shorthand type conversions (e.g., `!!value`, `+var`)
|
|
156
|
+
"no-implicit-globals": "error",
|
|
157
|
+
// Prevents defining variables in the global scope
|
|
158
|
+
"no-loop-func": "error",
|
|
159
|
+
// Disallow function declarations inside loops (prevents scoping issues)
|
|
160
|
+
"no-magic-numbers": ["error", { ignore: [0, 1, -1, 2] }],
|
|
161
|
+
// Helps catch unexplained numbers while allowing common values
|
|
162
|
+
"no-new-wrappers": "error",
|
|
163
|
+
// Prevents `new String()`, `new Number()`, etc. (use literals instead)
|
|
164
|
+
"no-param-reassign": ["error", { props: true }],
|
|
165
|
+
// Disallow reassigning function parameters but allow modifying object properties
|
|
166
|
+
"no-promise-executor-return": "error",
|
|
167
|
+
// Ensures `new Promise` executors always return something
|
|
168
|
+
"no-self-compare": "error",
|
|
169
|
+
// Disallows `x === x` (usually a mistake)
|
|
170
|
+
"no-template-curly-in-string": "error",
|
|
171
|
+
// Flags unintended use of `${}` inside strings without backticks
|
|
172
|
+
"no-throw-literal": "error",
|
|
173
|
+
// Prevents throwing non-error objects (e.g., `throw "error"` should be `throw new Error("error")`)
|
|
174
|
+
"no-unmodified-loop-condition": "error",
|
|
175
|
+
// Ensures loop conditions change, preventing infinite loops
|
|
176
|
+
"no-unreachable-loop": "error",
|
|
177
|
+
// Prevents loops that can never execute
|
|
178
|
+
"no-use-before-define": [
|
|
179
|
+
"error",
|
|
180
|
+
{
|
|
181
|
+
allowNamedExports: false,
|
|
182
|
+
classes: false,
|
|
183
|
+
functions: true,
|
|
184
|
+
// Allow function hoisting
|
|
185
|
+
variables: true
|
|
186
|
+
}
|
|
187
|
+
],
|
|
188
|
+
"no-useless-computed-key": "error",
|
|
189
|
+
// Disallows unnecessary computed keys in objects (e.g., `{["key"]: value}` instead of `{ key: value }`)
|
|
190
|
+
"no-useless-constructor": "error",
|
|
191
|
+
// Disallows empty constructors
|
|
192
|
+
"no-useless-rename": "error",
|
|
193
|
+
// Disallows renaming variables to the same name in import/export/destructuring
|
|
194
|
+
"no-useless-return": "error",
|
|
195
|
+
// Prevents redundant `return;` statements
|
|
196
|
+
"no-var": "error",
|
|
197
|
+
// Enforce `let` and `const` (modern best practice)
|
|
198
|
+
"object-shorthand": "error",
|
|
199
|
+
// Enforces `{ foo }` instead of `{ foo: foo }`
|
|
200
|
+
"prefer-arrow-callback": "error",
|
|
201
|
+
// Enforces arrow functions in callbacks where possible
|
|
202
|
+
"prefer-const": "error",
|
|
203
|
+
// Requires `const` when a variable isn’t reassigned
|
|
204
|
+
"prefer-destructuring": [
|
|
205
|
+
"error",
|
|
206
|
+
{
|
|
207
|
+
AssignmentExpression: {
|
|
208
|
+
array: false,
|
|
209
|
+
// Allow `x = arr[0]`, don't force `[x] = arr`
|
|
210
|
+
object: false
|
|
211
|
+
// Allow `x = obj.x`, don't force `{ x } = obj`
|
|
212
|
+
},
|
|
213
|
+
VariableDeclarator: {
|
|
214
|
+
array: false,
|
|
215
|
+
object: true
|
|
216
|
+
// Enforce destructuring for objects (`const { x } = obj`)
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
],
|
|
220
|
+
"prefer-object-spread": "error",
|
|
221
|
+
// Enforces `{ ...obj }` over `Object.assign()`
|
|
222
|
+
"prefer-rest-params": "error",
|
|
223
|
+
// Use `...args` instead of `arguments`
|
|
224
|
+
"prefer-spread": "error",
|
|
225
|
+
// Use `[...arr]` instead of `arr.concat()`
|
|
226
|
+
"prefer-template": "error",
|
|
227
|
+
// Use template literals instead of string concatenation
|
|
228
|
+
"radix": "error",
|
|
229
|
+
// Require a radix argument in `parseInt`
|
|
230
|
+
"require-await": "error",
|
|
231
|
+
// Disallows async functions without `await` (prevents unnecessary `async`)
|
|
232
|
+
"strict": ["error", "safe"],
|
|
233
|
+
// Enforces `"use strict"` only where needed (safe mode)
|
|
234
|
+
"symbol-description": "error"
|
|
235
|
+
// Requires descriptions when creating `Symbol()`
|
|
236
|
+
};
|
|
237
|
+
var javascriptRules = {
|
|
238
|
+
...eslint.configs.recommended.rules,
|
|
239
|
+
...additionalRules
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
// src/configs/javascript.ts
|
|
243
|
+
var javascriptConfig = () => {
|
|
244
|
+
return [
|
|
245
|
+
{
|
|
246
|
+
linterOptions: {
|
|
247
|
+
reportUnusedDisableDirectives: true
|
|
248
|
+
},
|
|
249
|
+
name: "jimmy.codes/javascript",
|
|
250
|
+
rules: javascriptRules
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
files: GLOB_TESTS,
|
|
254
|
+
name: "jimmy.codes/javascript/testing",
|
|
255
|
+
rules: {
|
|
256
|
+
"no-magic-numbers": "off"
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
];
|
|
260
|
+
};
|
|
261
|
+
|
|
262
|
+
// src/configs/jsdoc.ts
|
|
263
|
+
import jsdocPlugin2 from "eslint-plugin-jsdoc";
|
|
264
|
+
|
|
265
|
+
// src/rules/jsdoc.ts
|
|
266
|
+
import jsdocPlugin from "eslint-plugin-jsdoc";
|
|
267
|
+
var jsdocRules = () => {
|
|
268
|
+
return {
|
|
269
|
+
...jsdocPlugin.configs["flat/recommended-typescript-error"].rules,
|
|
270
|
+
"jsdoc/require-jsdoc": "off",
|
|
271
|
+
// Disable enforced JSDoc (TypeScript provides type info)
|
|
272
|
+
"jsdoc/require-param": "off",
|
|
273
|
+
// Avoid redundant param documentation (rely on TypeScript)
|
|
274
|
+
"jsdoc/require-returns": "off",
|
|
275
|
+
// Avoid redundant return type documentation (rely on TypeScript)
|
|
276
|
+
"jsdoc/tag-lines": [
|
|
277
|
+
"error",
|
|
278
|
+
"always",
|
|
279
|
+
{
|
|
280
|
+
applyToEndTag: false,
|
|
281
|
+
// No need for a blank line before closing JSDoc
|
|
282
|
+
startLines: 1
|
|
283
|
+
// Require exactly one blank line before the first tag
|
|
284
|
+
}
|
|
285
|
+
]
|
|
286
|
+
};
|
|
287
|
+
};
|
|
288
|
+
|
|
289
|
+
// src/configs/jsdoc.ts
|
|
290
|
+
var jsdocConfig = () => {
|
|
291
|
+
return [
|
|
292
|
+
{
|
|
293
|
+
...jsdocPlugin2.configs["flat/recommended-typescript-error"],
|
|
294
|
+
name: "jimmy.codes/jsdoc",
|
|
295
|
+
rules: jsdocRules()
|
|
296
|
+
}
|
|
297
|
+
];
|
|
298
|
+
};
|
|
299
|
+
|
|
300
|
+
// src/configs/node.ts
|
|
301
|
+
import nodePlugin2 from "eslint-plugin-n";
|
|
302
|
+
|
|
303
|
+
// src/rules/node.ts
|
|
304
|
+
var nodeRules = {
|
|
305
|
+
"n/no-process-exit": "off",
|
|
306
|
+
// TODO [2025-12-31]: enable this rule
|
|
307
|
+
"n/prefer-node-protocol": "error"
|
|
308
|
+
};
|
|
309
|
+
|
|
310
|
+
// src/configs/node.ts
|
|
311
|
+
var nodeConfig = () => {
|
|
312
|
+
return [
|
|
313
|
+
{
|
|
314
|
+
name: "jimmy.codes/node",
|
|
315
|
+
plugins: {
|
|
316
|
+
n: nodePlugin2
|
|
317
|
+
},
|
|
318
|
+
rules: nodeRules
|
|
319
|
+
}
|
|
320
|
+
];
|
|
321
|
+
};
|
|
322
|
+
|
|
323
|
+
// src/configs/perfectionist.ts
|
|
324
|
+
import perfectionist2 from "eslint-plugin-perfectionist";
|
|
325
|
+
|
|
326
|
+
// src/rules/perfectionist.ts
|
|
327
|
+
import perfectionist from "eslint-plugin-perfectionist";
|
|
328
|
+
var perfectionistRules = {
|
|
329
|
+
...perfectionist.configs["recommended-natural"].rules,
|
|
330
|
+
"perfectionist/sort-imports": [
|
|
331
|
+
"error",
|
|
332
|
+
{
|
|
333
|
+
customGroups: { type: {}, value: {} },
|
|
334
|
+
environment: "node",
|
|
335
|
+
groups: [
|
|
336
|
+
"side-effect-style",
|
|
337
|
+
"builtin",
|
|
338
|
+
"type",
|
|
339
|
+
"external",
|
|
340
|
+
"internal-type",
|
|
341
|
+
"internal",
|
|
342
|
+
["parent-type", "sibling-type", "index-type"],
|
|
343
|
+
["parent", "sibling", "index"],
|
|
344
|
+
"object",
|
|
345
|
+
"style",
|
|
346
|
+
"unknown"
|
|
347
|
+
],
|
|
348
|
+
internalPattern: ["^~/.*", "^@/.*"],
|
|
349
|
+
order: "asc",
|
|
350
|
+
type: "natural"
|
|
351
|
+
}
|
|
352
|
+
],
|
|
353
|
+
// TODO: enable perfectionist/sort-modules
|
|
354
|
+
// "perfectionist/sort-modules": [
|
|
355
|
+
// "error",
|
|
356
|
+
// {
|
|
357
|
+
// customGroups: [],
|
|
358
|
+
// groups: [
|
|
359
|
+
// "declare-enum",
|
|
360
|
+
// "enum",
|
|
361
|
+
// "export-enum",
|
|
362
|
+
// ["declare-interface", "declare-type"],
|
|
363
|
+
// ["interface", "type"],
|
|
364
|
+
// ["export-interface", "export-type"],
|
|
365
|
+
// "declare-class",
|
|
366
|
+
// "class",
|
|
367
|
+
// "export-class",
|
|
368
|
+
// "declare-function",
|
|
369
|
+
// "function",
|
|
370
|
+
// "export-function",
|
|
371
|
+
// ],
|
|
372
|
+
// ignoreCase: true,
|
|
373
|
+
// newlinesBetween: "ignore",
|
|
374
|
+
// order: "asc",
|
|
375
|
+
// partitionByComment: false,
|
|
376
|
+
// partitionByNewLine: false,
|
|
377
|
+
// specialCharacters: "keep",
|
|
378
|
+
// type: "natural",
|
|
379
|
+
// },
|
|
380
|
+
// ],
|
|
381
|
+
"perfectionist/sort-modules": "off"
|
|
382
|
+
};
|
|
383
|
+
|
|
384
|
+
// src/configs/perfectionist.ts
|
|
385
|
+
var perfectionistConfig = () => {
|
|
386
|
+
return [
|
|
387
|
+
{
|
|
388
|
+
name: "jimmy.codes/perfectionist",
|
|
389
|
+
plugins: {
|
|
390
|
+
// TODO: remove unknown conversion
|
|
391
|
+
perfectionist: perfectionist2
|
|
392
|
+
},
|
|
393
|
+
rules: perfectionistRules
|
|
394
|
+
}
|
|
395
|
+
];
|
|
396
|
+
};
|
|
397
|
+
|
|
398
|
+
// src/configs/prettier.ts
|
|
399
|
+
import eslintConfigPrettier from "eslint-config-prettier/flat";
|
|
400
|
+
var prettierConfig = () => {
|
|
401
|
+
return [
|
|
402
|
+
{ ...eslintConfigPrettier, name: "jimmy.codes/prettier" }
|
|
403
|
+
];
|
|
404
|
+
};
|
|
405
|
+
|
|
406
|
+
// src/configs/regexp.ts
|
|
407
|
+
import * as regexpPlugin2 from "eslint-plugin-regexp";
|
|
408
|
+
|
|
409
|
+
// src/rules/regexp.ts
|
|
410
|
+
import * as regexpPlugin from "eslint-plugin-regexp";
|
|
411
|
+
var regexpRules = {
|
|
412
|
+
...regexpPlugin.configs["flat/recommended"].rules,
|
|
413
|
+
"regexp/confusing-quantifier": "error",
|
|
414
|
+
"regexp/no-empty-alternative": "error",
|
|
415
|
+
"regexp/no-lazy-ends": "error",
|
|
416
|
+
"regexp/no-potentially-useless-backreference": "error",
|
|
417
|
+
"regexp/no-useless-flag": "error",
|
|
418
|
+
"regexp/optimal-lookaround-quantifier": "error"
|
|
419
|
+
};
|
|
420
|
+
|
|
421
|
+
// src/configs/regexp.ts
|
|
422
|
+
var regexpConfig = () => {
|
|
423
|
+
return [
|
|
424
|
+
{
|
|
425
|
+
name: "jimmy.codes/regexp",
|
|
426
|
+
plugins: { regexp: regexpPlugin2 },
|
|
427
|
+
rules: regexpRules
|
|
428
|
+
}
|
|
429
|
+
];
|
|
430
|
+
};
|
|
431
|
+
|
|
432
|
+
// src/configs/unicorn.ts
|
|
433
|
+
import eslintPluginUnicorn2 from "eslint-plugin-unicorn";
|
|
434
|
+
|
|
435
|
+
// src/rules/unicorn.ts
|
|
436
|
+
import eslintPluginUnicorn from "eslint-plugin-unicorn";
|
|
437
|
+
var unicornRules = {
|
|
438
|
+
...eslintPluginUnicorn.configs["flat/recommended"].rules,
|
|
439
|
+
"unicorn/filename-case": "off",
|
|
440
|
+
"unicorn/import-style": "off",
|
|
441
|
+
"unicorn/no-abusive-eslint-disable": "off",
|
|
442
|
+
"unicorn/no-anonymous-default-export": "off",
|
|
443
|
+
"unicorn/no-array-callback-reference": "off",
|
|
444
|
+
// TODO: enable when https://github.com/sindresorhus/eslint-plugin-unicorn/issues/781 is resolved.
|
|
445
|
+
"unicorn/no-array-reduce": "off",
|
|
446
|
+
"unicorn/no-null": "off",
|
|
447
|
+
"unicorn/no-process-exit": "off",
|
|
448
|
+
"unicorn/no-useless-undefined": [
|
|
449
|
+
"error",
|
|
450
|
+
{ checkArguments: false, checkArrowFunctionBody: false }
|
|
451
|
+
],
|
|
452
|
+
"unicorn/prefer-node-protocol": "off",
|
|
453
|
+
"unicorn/prevent-abbreviations": "off"
|
|
454
|
+
};
|
|
455
|
+
|
|
456
|
+
// src/configs/unicorn.ts
|
|
457
|
+
var unicornConfig = () => {
|
|
458
|
+
return [
|
|
459
|
+
{
|
|
460
|
+
...eslintPluginUnicorn2.configs["flat/recommended"],
|
|
461
|
+
name: "jimmy.codes/unicorn",
|
|
462
|
+
rules: unicornRules
|
|
463
|
+
}
|
|
464
|
+
];
|
|
465
|
+
};
|
|
466
|
+
|
|
467
|
+
// src/utils/unwrap.ts
|
|
468
|
+
var unwrap = async (module) => {
|
|
469
|
+
const resolved = await module;
|
|
470
|
+
if (typeof resolved.default === "function") {
|
|
471
|
+
return resolved.default();
|
|
472
|
+
}
|
|
473
|
+
return resolved;
|
|
474
|
+
};
|
|
475
|
+
|
|
476
|
+
// src/factory.ts
|
|
477
|
+
var defineConfig = async ({
|
|
478
|
+
astro = false,
|
|
479
|
+
autoDetect = true,
|
|
480
|
+
ignores = [],
|
|
481
|
+
jest = false,
|
|
482
|
+
nextjs = false,
|
|
483
|
+
overrides = [],
|
|
484
|
+
playwright = false,
|
|
485
|
+
react = false,
|
|
486
|
+
storybook = false,
|
|
487
|
+
tanstackQuery = false,
|
|
488
|
+
testingLibrary = false,
|
|
489
|
+
typescript = false,
|
|
490
|
+
vitest = false
|
|
491
|
+
} = {}, ...moreOverrides) => {
|
|
492
|
+
const resolveFlag = (explicit, detector) => {
|
|
493
|
+
return explicit || autoDetect && detector();
|
|
494
|
+
};
|
|
495
|
+
const isTypescriptEnabled = resolveFlag(typescript, hasTypescript);
|
|
496
|
+
const isReactEnabled = resolveFlag(react, hasReact);
|
|
497
|
+
const isAstroEnabled = resolveFlag(astro, hasAstro);
|
|
498
|
+
const isTanstackQueryEnabled = resolveFlag(tanstackQuery, hasReactQuery);
|
|
499
|
+
const isTestingLibraryEnabled = resolveFlag(
|
|
500
|
+
testingLibrary,
|
|
501
|
+
hasTestingLibrary
|
|
502
|
+
);
|
|
503
|
+
const isPlaywrightEnabled = resolveFlag(playwright, hasPlaywright);
|
|
504
|
+
const isStorybookEnabled = resolveFlag(storybook, hasStorybook);
|
|
505
|
+
const isNextjsEnabled = resolveFlag(nextjs, hasNext);
|
|
506
|
+
const isJestEnabled = resolveFlag(jest, hasJest);
|
|
507
|
+
const isVitestEnabled = resolveFlag(vitest, hasVitest);
|
|
508
|
+
const baseConfigs = [
|
|
509
|
+
javascriptConfig(),
|
|
510
|
+
perfectionistConfig(),
|
|
511
|
+
nodeConfig(),
|
|
512
|
+
unicornConfig(),
|
|
513
|
+
eslintCommentsConfig(),
|
|
514
|
+
regexpConfig(),
|
|
515
|
+
jsdocConfig(),
|
|
516
|
+
importsConfig({ typescript: isTypescriptEnabled })
|
|
517
|
+
];
|
|
518
|
+
const featureConfigs = await Promise.all([
|
|
519
|
+
isTypescriptEnabled && unwrap(import("./typescript-IBCLQD7Q.js")),
|
|
520
|
+
isReactEnabled && unwrap(import("./react-X5DWOH4Y.js")),
|
|
521
|
+
isTanstackQueryEnabled && unwrap(import("./tanstack-query-UHBVVQ7V.js")),
|
|
522
|
+
isAstroEnabled && unwrap(import("./astro-Z5RFF624.js")),
|
|
523
|
+
isJestEnabled && unwrap(import("./jest-AHG2WRSU.js")),
|
|
524
|
+
isVitestEnabled && unwrap(import("./vitest-YI6KNRZE.js")),
|
|
525
|
+
isTestingLibraryEnabled && unwrap(import("./testing-library-7RTMAEOX.js")),
|
|
526
|
+
isPlaywrightEnabled && unwrap(import("./playwright-U4PCWDYV.js")),
|
|
527
|
+
isStorybookEnabled && unwrap(import("./storybook-4KS3DD3C.js")),
|
|
528
|
+
isNextjsEnabled && unwrap(import("./nextjs-RCR4GYMK.js"))
|
|
529
|
+
]);
|
|
530
|
+
return [
|
|
531
|
+
...baseConfigs,
|
|
532
|
+
...featureConfigs.filter(Boolean),
|
|
533
|
+
commonjsConfig(),
|
|
534
|
+
ignoresConfig(ignores),
|
|
535
|
+
prettierConfig(),
|
|
536
|
+
overrides,
|
|
537
|
+
moreOverrides
|
|
538
|
+
].flat();
|
|
539
|
+
};
|
|
540
|
+
export {
|
|
541
|
+
defineConfig
|
|
542
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import {
|
|
2
|
+
interopDefault
|
|
3
|
+
} from "./chunk-72FT76PY.js";
|
|
4
|
+
import {
|
|
5
|
+
GLOB_E2E,
|
|
6
|
+
GLOB_TESTS
|
|
7
|
+
} from "./chunk-N5KZEOXT.js";
|
|
8
|
+
|
|
9
|
+
// src/rules/jest.ts
|
|
10
|
+
var jestRules = async () => {
|
|
11
|
+
const jestPlugin = await interopDefault(import("eslint-plugin-jest"));
|
|
12
|
+
return {
|
|
13
|
+
...jestPlugin.configs["flat/recommended"].rules,
|
|
14
|
+
...jestPlugin.configs["flat/style"].rules,
|
|
15
|
+
"jest/consistent-test-it": [
|
|
16
|
+
"error",
|
|
17
|
+
{
|
|
18
|
+
fn: "test",
|
|
19
|
+
withinDescribe: "it"
|
|
20
|
+
}
|
|
21
|
+
],
|
|
22
|
+
"jest/expect-expect": "error",
|
|
23
|
+
"jest/no-alias-methods": "error",
|
|
24
|
+
"jest/no-commented-out-tests": "error",
|
|
25
|
+
"jest/no-conditional-in-test": "error",
|
|
26
|
+
"jest/no-confusing-set-timeout": "error",
|
|
27
|
+
"jest/no-duplicate-hooks": "error",
|
|
28
|
+
"jest/no-hooks": "off",
|
|
29
|
+
"jest/no-large-snapshots": "off",
|
|
30
|
+
"jest/no-restricted-jest-methods": "off",
|
|
31
|
+
"jest/no-restricted-matchers": "off",
|
|
32
|
+
"jest/no-test-return-statement": "error",
|
|
33
|
+
"jest/no-untyped-mock-factory": "off",
|
|
34
|
+
// requires typescript
|
|
35
|
+
"jest/prefer-called-with": "error",
|
|
36
|
+
"jest/prefer-comparison-matcher": "error",
|
|
37
|
+
"jest/prefer-each": "error",
|
|
38
|
+
"jest/prefer-equality-matcher": "error",
|
|
39
|
+
"jest/prefer-expect-assertions": "off",
|
|
40
|
+
"jest/prefer-expect-resolves": "error",
|
|
41
|
+
"jest/prefer-hooks-in-order": "error",
|
|
42
|
+
"jest/prefer-hooks-on-top": "error",
|
|
43
|
+
"jest/prefer-lowercase-title": "off",
|
|
44
|
+
"jest/prefer-mock-promise-shorthand": "error",
|
|
45
|
+
"jest/prefer-snapshot-hint": "error",
|
|
46
|
+
"jest/prefer-spy-on": "off",
|
|
47
|
+
"jest/prefer-strict-equal": "error",
|
|
48
|
+
"jest/prefer-todo": "warn",
|
|
49
|
+
"jest/require-hook": "error",
|
|
50
|
+
"jest/require-to-throw-message": "error",
|
|
51
|
+
"jest/require-top-level-describe": "off",
|
|
52
|
+
"jest/unbound-method": "off"
|
|
53
|
+
// requires typescript
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
// src/configs/jest.ts
|
|
58
|
+
async function jestConfig() {
|
|
59
|
+
const jestPlugin = await interopDefault(import("eslint-plugin-jest"));
|
|
60
|
+
return [
|
|
61
|
+
{
|
|
62
|
+
files: GLOB_TESTS,
|
|
63
|
+
ignores: GLOB_E2E,
|
|
64
|
+
...jestPlugin.configs["flat/recommended"],
|
|
65
|
+
name: "jimmy.codes/jest",
|
|
66
|
+
rules: await jestRules()
|
|
67
|
+
}
|
|
68
|
+
];
|
|
69
|
+
}
|
|
70
|
+
export {
|
|
71
|
+
jestConfig as default
|
|
72
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import {
|
|
2
|
+
warningAsErrors
|
|
3
|
+
} from "./chunk-BJU7UEJ3.js";
|
|
4
|
+
import {
|
|
5
|
+
interopDefault
|
|
6
|
+
} from "./chunk-72FT76PY.js";
|
|
7
|
+
import {
|
|
8
|
+
GLOB_NEXTJS
|
|
9
|
+
} from "./chunk-N5KZEOXT.js";
|
|
10
|
+
|
|
11
|
+
// src/rules/nextjs.ts
|
|
12
|
+
var nextjsRules = async () => {
|
|
13
|
+
const nextjsPlugin = await interopDefault(import("@next/eslint-plugin-next"));
|
|
14
|
+
return warningAsErrors(
|
|
15
|
+
nextjsPlugin.configs.recommended.rules
|
|
16
|
+
);
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
// src/configs/nextjs.ts
|
|
20
|
+
async function nextjsConfig() {
|
|
21
|
+
const nextjsPlugin = await interopDefault(import("@next/eslint-plugin-next"));
|
|
22
|
+
return [
|
|
23
|
+
{
|
|
24
|
+
files: GLOB_NEXTJS,
|
|
25
|
+
name: "jimmy.codes/nextjs",
|
|
26
|
+
plugins: {
|
|
27
|
+
"@next/next": nextjsPlugin
|
|
28
|
+
},
|
|
29
|
+
rules: await nextjsRules()
|
|
30
|
+
}
|
|
31
|
+
];
|
|
32
|
+
}
|
|
33
|
+
export {
|
|
34
|
+
nextjsConfig as default
|
|
35
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import {
|
|
2
|
+
interopDefault
|
|
3
|
+
} from "./chunk-72FT76PY.js";
|
|
4
|
+
import {
|
|
5
|
+
GLOB_PLAYWRIGHT
|
|
6
|
+
} from "./chunk-N5KZEOXT.js";
|
|
7
|
+
|
|
8
|
+
// src/rules/playwright.ts
|
|
9
|
+
var playwrightRules = async () => {
|
|
10
|
+
const playwrightPlugin = await interopDefault(
|
|
11
|
+
import("eslint-plugin-playwright")
|
|
12
|
+
);
|
|
13
|
+
return {
|
|
14
|
+
...playwrightPlugin.configs["flat/recommended"].rules,
|
|
15
|
+
"playwright/expect-expect": "error",
|
|
16
|
+
"playwright/max-nested-describe": "error",
|
|
17
|
+
"playwright/no-conditional-expect": "error",
|
|
18
|
+
"playwright/no-conditional-in-test": "error",
|
|
19
|
+
"playwright/no-element-handle": "error",
|
|
20
|
+
"playwright/no-eval": "error",
|
|
21
|
+
"playwright/no-force-option": "error",
|
|
22
|
+
"playwright/no-nested-step": "error",
|
|
23
|
+
"playwright/no-page-pause": "error",
|
|
24
|
+
"playwright/no-skipped-test": "error",
|
|
25
|
+
"playwright/no-slowed-test": "error",
|
|
26
|
+
"playwright/no-useless-await": "error",
|
|
27
|
+
"playwright/no-useless-not": "error",
|
|
28
|
+
"playwright/no-wait-for-selector": "error",
|
|
29
|
+
"playwright/no-wait-for-timeout": "error"
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
// src/configs/playwright.ts
|
|
34
|
+
async function playwrightConfig() {
|
|
35
|
+
const playwrightPlugin = await interopDefault(
|
|
36
|
+
import("eslint-plugin-playwright")
|
|
37
|
+
);
|
|
38
|
+
return [
|
|
39
|
+
{
|
|
40
|
+
...playwrightPlugin.configs["flat/recommended"],
|
|
41
|
+
files: GLOB_PLAYWRIGHT,
|
|
42
|
+
name: "jimmy.codes/playwright",
|
|
43
|
+
rules: await playwrightRules()
|
|
44
|
+
}
|
|
45
|
+
];
|
|
46
|
+
}
|
|
47
|
+
export {
|
|
48
|
+
playwrightConfig as default
|
|
49
|
+
};
|