@tb-dev/eslint-config 6.1.3 → 6.1.5
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/dist/index.cjs +47 -44
- package/dist/index.d.ts +4 -0
- package/dist/index.js +47 -44
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -294,52 +294,55 @@ async function vue(options) {
|
|
|
294
294
|
}
|
|
295
295
|
|
|
296
296
|
async function react(options) {
|
|
297
|
-
if (!isEnabled(options.features, "react")) return
|
|
297
|
+
if (!isEnabled(options.features, "react")) return [];
|
|
298
298
|
const plugin = await interopDefault(import('eslint-plugin-react'));
|
|
299
|
-
return
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
"
|
|
305
|
-
{
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
299
|
+
return [
|
|
300
|
+
{
|
|
301
|
+
plugins: { react: plugin },
|
|
302
|
+
rules: {
|
|
303
|
+
"react/button-has-type": "error",
|
|
304
|
+
"react/function-component-definition": "off",
|
|
305
|
+
"react/hook-use-state": ["error", { allowDestructuredState: true }],
|
|
306
|
+
"react/jsx-boolean-value": ["error", "never", { assumeUndefinedIsFalse: true }],
|
|
307
|
+
"react/jsx-key": [
|
|
308
|
+
"error",
|
|
309
|
+
{
|
|
310
|
+
checkFragmentShorthand: true,
|
|
311
|
+
checkKeyMustBeforeSpread: false,
|
|
312
|
+
warnOnDuplicates: true
|
|
313
|
+
}
|
|
314
|
+
],
|
|
315
|
+
"react/jsx-no-script-url": "error",
|
|
316
|
+
"react/jsx-no-useless-fragment": "error",
|
|
317
|
+
"react/jsx-pascal-case": [
|
|
318
|
+
"error",
|
|
319
|
+
{
|
|
320
|
+
allowAllCaps: false,
|
|
321
|
+
allowNamespace: true,
|
|
322
|
+
allowLeadingUnderscore: false
|
|
323
|
+
}
|
|
324
|
+
],
|
|
325
|
+
"react/jsx-props-no-spread-multi": "error",
|
|
326
|
+
"react/no-access-state-in-setstate": "error",
|
|
327
|
+
"react/no-array-index-key": "error",
|
|
328
|
+
"react/no-danger": "error",
|
|
329
|
+
"react/no-deprecated": "error",
|
|
330
|
+
"react/no-direct-mutation-state": "error",
|
|
331
|
+
"react/no-find-dom-node": "error",
|
|
332
|
+
"react/no-is-mounted": "error",
|
|
333
|
+
"react/no-render-return-value": "error",
|
|
334
|
+
"react/no-unsafe": "error",
|
|
335
|
+
...options.overrides?.react
|
|
336
|
+
}
|
|
337
|
+
},
|
|
338
|
+
{
|
|
339
|
+
settings: {
|
|
340
|
+
react: {
|
|
341
|
+
version: options.reactVersion ?? "19.0"
|
|
328
342
|
}
|
|
329
|
-
|
|
330
|
-
"react/jsx-props-no-spread-multi": "error",
|
|
331
|
-
"react/no-access-state-in-setstate": "error",
|
|
332
|
-
"react/no-array-index-key": "error",
|
|
333
|
-
"react/no-danger": "error",
|
|
334
|
-
"react/no-deprecated": "error",
|
|
335
|
-
"react/no-direct-mutation-state": "error",
|
|
336
|
-
"react/no-find-dom-node": "error",
|
|
337
|
-
"react/no-is-mounted": "error",
|
|
338
|
-
"react/no-render-return-value": "error",
|
|
339
|
-
"react/no-unsafe": "error",
|
|
340
|
-
...options.overrides?.react
|
|
343
|
+
}
|
|
341
344
|
}
|
|
342
|
-
|
|
345
|
+
];
|
|
343
346
|
}
|
|
344
347
|
|
|
345
348
|
async function svelte(options) {
|
|
@@ -1055,7 +1058,7 @@ async function defineConfig(options) {
|
|
|
1055
1058
|
typescript(options),
|
|
1056
1059
|
...await vue(options),
|
|
1057
1060
|
...await svelte(options),
|
|
1058
|
-
react(options),
|
|
1061
|
+
...await react(options),
|
|
1059
1062
|
reactHooks(options),
|
|
1060
1063
|
reactCompiler(options),
|
|
1061
1064
|
perfectionist(options),
|
package/dist/index.d.ts
CHANGED
|
@@ -12,6 +12,8 @@ declare interface ConfigObject {
|
|
|
12
12
|
plugins?: Record<string, unknown>;
|
|
13
13
|
processor?: unknown;
|
|
14
14
|
rules: Rules;
|
|
15
|
+
/** @see https://eslint.org/docs/latest/use/configure/configuration-files#configuring-shared-settings */
|
|
16
|
+
settings?: Record<string, unknown>;
|
|
15
17
|
}
|
|
16
18
|
|
|
17
19
|
declare interface ConfigOptions {
|
|
@@ -33,6 +35,8 @@ declare interface ConfigOptions {
|
|
|
33
35
|
};
|
|
34
36
|
/** @see https://typescript-eslint.io/rules/no-floating-promises#allowforknownsafepromises */
|
|
35
37
|
knownSafePromises?: KnownSafePromise[];
|
|
38
|
+
/** @see https://github.com/jsx-eslint/eslint-plugin-react#configuration */
|
|
39
|
+
reactVersion?: string;
|
|
36
40
|
}
|
|
37
41
|
|
|
38
42
|
export declare function defineConfig(options: ConfigOptions): Promise<Partial<ConfigObject>[]>;
|
package/dist/index.js
CHANGED
|
@@ -290,52 +290,55 @@ async function vue(options) {
|
|
|
290
290
|
}
|
|
291
291
|
|
|
292
292
|
async function react(options) {
|
|
293
|
-
if (!isEnabled(options.features, "react")) return
|
|
293
|
+
if (!isEnabled(options.features, "react")) return [];
|
|
294
294
|
const plugin = await interopDefault(import('eslint-plugin-react'));
|
|
295
|
-
return
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
"
|
|
301
|
-
{
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
295
|
+
return [
|
|
296
|
+
{
|
|
297
|
+
plugins: { react: plugin },
|
|
298
|
+
rules: {
|
|
299
|
+
"react/button-has-type": "error",
|
|
300
|
+
"react/function-component-definition": "off",
|
|
301
|
+
"react/hook-use-state": ["error", { allowDestructuredState: true }],
|
|
302
|
+
"react/jsx-boolean-value": ["error", "never", { assumeUndefinedIsFalse: true }],
|
|
303
|
+
"react/jsx-key": [
|
|
304
|
+
"error",
|
|
305
|
+
{
|
|
306
|
+
checkFragmentShorthand: true,
|
|
307
|
+
checkKeyMustBeforeSpread: false,
|
|
308
|
+
warnOnDuplicates: true
|
|
309
|
+
}
|
|
310
|
+
],
|
|
311
|
+
"react/jsx-no-script-url": "error",
|
|
312
|
+
"react/jsx-no-useless-fragment": "error",
|
|
313
|
+
"react/jsx-pascal-case": [
|
|
314
|
+
"error",
|
|
315
|
+
{
|
|
316
|
+
allowAllCaps: false,
|
|
317
|
+
allowNamespace: true,
|
|
318
|
+
allowLeadingUnderscore: false
|
|
319
|
+
}
|
|
320
|
+
],
|
|
321
|
+
"react/jsx-props-no-spread-multi": "error",
|
|
322
|
+
"react/no-access-state-in-setstate": "error",
|
|
323
|
+
"react/no-array-index-key": "error",
|
|
324
|
+
"react/no-danger": "error",
|
|
325
|
+
"react/no-deprecated": "error",
|
|
326
|
+
"react/no-direct-mutation-state": "error",
|
|
327
|
+
"react/no-find-dom-node": "error",
|
|
328
|
+
"react/no-is-mounted": "error",
|
|
329
|
+
"react/no-render-return-value": "error",
|
|
330
|
+
"react/no-unsafe": "error",
|
|
331
|
+
...options.overrides?.react
|
|
332
|
+
}
|
|
333
|
+
},
|
|
334
|
+
{
|
|
335
|
+
settings: {
|
|
336
|
+
react: {
|
|
337
|
+
version: options.reactVersion ?? "19.0"
|
|
324
338
|
}
|
|
325
|
-
|
|
326
|
-
"react/jsx-props-no-spread-multi": "error",
|
|
327
|
-
"react/no-access-state-in-setstate": "error",
|
|
328
|
-
"react/no-array-index-key": "error",
|
|
329
|
-
"react/no-danger": "error",
|
|
330
|
-
"react/no-deprecated": "error",
|
|
331
|
-
"react/no-direct-mutation-state": "error",
|
|
332
|
-
"react/no-find-dom-node": "error",
|
|
333
|
-
"react/no-is-mounted": "error",
|
|
334
|
-
"react/no-render-return-value": "error",
|
|
335
|
-
"react/no-unsafe": "error",
|
|
336
|
-
...options.overrides?.react
|
|
339
|
+
}
|
|
337
340
|
}
|
|
338
|
-
|
|
341
|
+
];
|
|
339
342
|
}
|
|
340
343
|
|
|
341
344
|
async function svelte(options) {
|
|
@@ -1051,7 +1054,7 @@ async function defineConfig(options) {
|
|
|
1051
1054
|
typescript(options),
|
|
1052
1055
|
...await vue(options),
|
|
1053
1056
|
...await svelte(options),
|
|
1054
|
-
react(options),
|
|
1057
|
+
...await react(options),
|
|
1055
1058
|
reactHooks(options),
|
|
1056
1059
|
reactCompiler(options),
|
|
1057
1060
|
perfectionist(options),
|