@ncontiero/eslint-config 8.1.0 → 8.2.1
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.d.mts +37 -11
- package/dist/index.mjs +14 -8
- package/package.json +9 -9
package/dist/index.d.mts
CHANGED
|
@@ -277,10 +277,18 @@ interface RuleOptions {
|
|
|
277
277
|
* Disallow dependencies in favor of more performant or secure alternatives
|
|
278
278
|
*/
|
|
279
279
|
'e18e/ban-dependencies'?: Linter.RuleEntry<E18EBanDependencies>;
|
|
280
|
+
/**
|
|
281
|
+
* Disallow `delete` on properties — V8 deoptimizes the object to dictionary mode
|
|
282
|
+
*/
|
|
283
|
+
'e18e/no-delete-property'?: Linter.RuleEntry<[]>;
|
|
280
284
|
/**
|
|
281
285
|
* Prefer optimized alternatives to `indexOf()` equality checks
|
|
282
286
|
*/
|
|
283
287
|
'e18e/no-indexof-equality'?: Linter.RuleEntry<[]>;
|
|
288
|
+
/**
|
|
289
|
+
* Disallow spreading the accumulator inside a `reduce` callback (O(N²) growth)
|
|
290
|
+
*/
|
|
291
|
+
'e18e/no-spread-in-reduce'?: Linter.RuleEntry<[]>;
|
|
284
292
|
/**
|
|
285
293
|
* Prefer Array.prototype.at() over length-based indexing
|
|
286
294
|
*/
|
|
@@ -294,7 +302,7 @@ interface RuleOptions {
|
|
|
294
302
|
*/
|
|
295
303
|
'e18e/prefer-array-from-map'?: Linter.RuleEntry<[]>;
|
|
296
304
|
/**
|
|
297
|
-
* Prefer Array.some() over Array.find() when checking for element existence
|
|
305
|
+
* Prefer Array.some() over Array.find() and Array.filter().length checks when checking for element existence
|
|
298
306
|
*/
|
|
299
307
|
'e18e/prefer-array-some'?: Linter.RuleEntry<[]>;
|
|
300
308
|
/**
|
|
@@ -321,6 +329,10 @@ interface RuleOptions {
|
|
|
321
329
|
* Prefer .includes() over indexOf() comparisons for arrays and strings
|
|
322
330
|
*/
|
|
323
331
|
'e18e/prefer-includes'?: Linter.RuleEntry<[]>;
|
|
332
|
+
/**
|
|
333
|
+
* Prefer String.prototype.{includes,startsWith,endsWith} over equivalent regex.test() calls
|
|
334
|
+
*/
|
|
335
|
+
'e18e/prefer-includes-over-regex-test'?: Linter.RuleEntry<[]>;
|
|
324
336
|
/**
|
|
325
337
|
* Prefer inline equality checks over temporary object creation for simple comparisons
|
|
326
338
|
*/
|
|
@@ -341,10 +353,18 @@ interface RuleOptions {
|
|
|
341
353
|
* Prefer spread syntax over Array.concat(), Array.from(), Object.assign({}, ...), and Function.apply()
|
|
342
354
|
*/
|
|
343
355
|
'e18e/prefer-spread-syntax'?: Linter.RuleEntry<[]>;
|
|
356
|
+
/**
|
|
357
|
+
* Prefer hoisting an `Intl.Collator` instance over calling localeCompare in a sort callback
|
|
358
|
+
*/
|
|
359
|
+
'e18e/prefer-static-collator'?: Linter.RuleEntry<[]>;
|
|
344
360
|
/**
|
|
345
361
|
* Prefer defining regular expressions at module scope to avoid re-compilation on every function call
|
|
346
362
|
*/
|
|
347
363
|
'e18e/prefer-static-regex'?: Linter.RuleEntry<[]>;
|
|
364
|
+
/**
|
|
365
|
+
* Prefer String.fromCharCode() over String.fromCodePoint() for code points below 0x10000
|
|
366
|
+
*/
|
|
367
|
+
'e18e/prefer-string-fromcharcode'?: Linter.RuleEntry<[]>;
|
|
348
368
|
/**
|
|
349
369
|
* Prefer passing function and arguments directly to setTimeout/setInterval instead of wrapping in an arrow function or using bind
|
|
350
370
|
*/
|
|
@@ -3719,42 +3739,42 @@ interface RuleOptions {
|
|
|
3719
3739
|
'react/immutability'?: Linter.RuleEntry<[]>;
|
|
3720
3740
|
/**
|
|
3721
3741
|
* Disallows passing 'children' as a prop.
|
|
3722
|
-
* @see https://eslint-react.xyz/docs/rules/no-children-prop
|
|
3742
|
+
* @see https://eslint-react.xyz/docs/rules/jsx-no-children-prop
|
|
3723
3743
|
*/
|
|
3724
3744
|
'react/jsx-no-children-prop'?: Linter.RuleEntry<[]>;
|
|
3725
3745
|
/**
|
|
3726
3746
|
* Disallows passing 'children' as a prop when children are also passed as nested content.
|
|
3727
|
-
* @see https://eslint-react.xyz/docs/rules/no-children-prop-with-children
|
|
3747
|
+
* @see https://eslint-react.xyz/docs/rules/jsx-no-children-prop-with-children
|
|
3728
3748
|
*/
|
|
3729
3749
|
'react/jsx-no-children-prop-with-children'?: Linter.RuleEntry<[]>;
|
|
3730
3750
|
/**
|
|
3731
3751
|
* Prevents comment strings from being accidentally inserted into a JSX element's text nodes.
|
|
3732
|
-
* @see https://eslint-react.xyz/docs/rules/no-comment-textnodes
|
|
3752
|
+
* @see https://eslint-react.xyz/docs/rules/jsx-no-comment-textnodes
|
|
3733
3753
|
*/
|
|
3734
3754
|
'react/jsx-no-comment-textnodes'?: Linter.RuleEntry<[]>;
|
|
3735
3755
|
/**
|
|
3736
3756
|
* Prevent patterns that cause deoptimization when using the automatic JSX runtime.
|
|
3737
|
-
* @see https://eslint-react.xyz/docs/rules/no-key-after-spread
|
|
3757
|
+
* @see https://eslint-react.xyz/docs/rules/jsx-no-key-after-spread
|
|
3738
3758
|
*/
|
|
3739
3759
|
'react/jsx-no-key-after-spread'?: Linter.RuleEntry<[]>;
|
|
3740
3760
|
/**
|
|
3741
3761
|
* Catches `$` before `{expr}` in JSX — typically from template literal `${expr}` being copy-pasted into JSX without removing the `$`. The `$` "leaks" into the rendered output.
|
|
3742
|
-
* @see https://eslint-react.xyz/docs/rules/no-leaked-dollar
|
|
3762
|
+
* @see https://eslint-react.xyz/docs/rules/jsx-no-leaked-dollar
|
|
3743
3763
|
*/
|
|
3744
3764
|
'react/jsx-no-leaked-dollar'?: Linter.RuleEntry<[]>;
|
|
3745
3765
|
/**
|
|
3746
3766
|
* Catches `;` at the start of JSX text nodes — typically from accidentally placing a statement-ending `;` inside JSX. The `;` "leaks" into the rendered output.
|
|
3747
|
-
* @see https://eslint-react.xyz/docs/rules/no-leaked-semicolon
|
|
3767
|
+
* @see https://eslint-react.xyz/docs/rules/jsx-no-leaked-semicolon
|
|
3748
3768
|
*/
|
|
3749
3769
|
'react/jsx-no-leaked-semicolon'?: Linter.RuleEntry<[]>;
|
|
3750
3770
|
/**
|
|
3751
3771
|
* Disallow JSX namespace syntax, as React does not support them.
|
|
3752
|
-
* @see https://eslint-react.xyz/docs/rules/no-namespace
|
|
3772
|
+
* @see https://eslint-react.xyz/docs/rules/jsx-no-namespace
|
|
3753
3773
|
*/
|
|
3754
3774
|
'react/jsx-no-namespace'?: Linter.RuleEntry<[]>;
|
|
3755
3775
|
/**
|
|
3756
3776
|
* Disallows useless fragment elements.
|
|
3757
|
-
* @see https://eslint-react.xyz/docs/rules/no-useless-fragment
|
|
3777
|
+
* @see https://eslint-react.xyz/docs/rules/jsx-no-useless-fragment
|
|
3758
3778
|
*/
|
|
3759
3779
|
'react/jsx-no-useless-fragment'?: Linter.RuleEntry<ReactJsxNoUselessFragment>;
|
|
3760
3780
|
/**
|
|
@@ -3984,7 +4004,7 @@ interface RuleOptions {
|
|
|
3984
4004
|
'react/refs'?: Linter.RuleEntry<[]>;
|
|
3985
4005
|
/**
|
|
3986
4006
|
* Validates and transforms React Client/Server Function definitions.
|
|
3987
|
-
* @see https://eslint-react.xyz/docs/rules/function-definition
|
|
4007
|
+
* @see https://eslint-react.xyz/docs/rules/rsc-function-definition
|
|
3988
4008
|
*/
|
|
3989
4009
|
'react/rsc-function-definition'?: Linter.RuleEntry<[]>;
|
|
3990
4010
|
/**
|
|
@@ -16707,6 +16727,12 @@ interface OptionsConfig {
|
|
|
16707
16727
|
* @default true
|
|
16708
16728
|
*/
|
|
16709
16729
|
unicorn?: boolean | OptionsUnicorn;
|
|
16730
|
+
/**
|
|
16731
|
+
* Options for eslint-plugin-perfectionist.
|
|
16732
|
+
*
|
|
16733
|
+
* @default true
|
|
16734
|
+
*/
|
|
16735
|
+
perfectionist?: boolean | OptionsOverrides;
|
|
16710
16736
|
/**
|
|
16711
16737
|
* Options for [@e18e/eslint-plugin](https://github.com/e18e/eslint-plugin)
|
|
16712
16738
|
*
|
|
@@ -16843,7 +16869,7 @@ declare function node(): FlatConfigItem[];
|
|
|
16843
16869
|
*
|
|
16844
16870
|
* @see https://github.com/azat-io/eslint-plugin-perfectionist
|
|
16845
16871
|
*/
|
|
16846
|
-
declare function perfectionist(): FlatConfigItem[];
|
|
16872
|
+
declare function perfectionist(options?: OptionsOverrides): FlatConfigItem[];
|
|
16847
16873
|
//#endregion
|
|
16848
16874
|
//#region src/configs/prettier.d.ts
|
|
16849
16875
|
declare function prettier(options?: PrettierOptions): Promise<FlatConfigItem[]>;
|
package/dist/index.mjs
CHANGED
|
@@ -465,7 +465,7 @@ function javascript(options = {}) {
|
|
|
465
465
|
"no-useless-escape": "error",
|
|
466
466
|
"no-useless-rename": "error",
|
|
467
467
|
"no-var": "error",
|
|
468
|
-
"no-void": "error",
|
|
468
|
+
"no-void": ["error", { allowAsStatement: true }],
|
|
469
469
|
"no-with": "error",
|
|
470
470
|
"object-shorthand": [
|
|
471
471
|
"error",
|
|
@@ -785,7 +785,8 @@ function node() {
|
|
|
785
785
|
*
|
|
786
786
|
* @see https://github.com/azat-io/eslint-plugin-perfectionist
|
|
787
787
|
*/
|
|
788
|
-
function perfectionist() {
|
|
788
|
+
function perfectionist(options = {}) {
|
|
789
|
+
const { overrides = {} } = options;
|
|
789
790
|
return [{
|
|
790
791
|
name: "ncontiero/perfectionist/rules",
|
|
791
792
|
plugins: { perfectionist: pluginPerfectionist },
|
|
@@ -823,7 +824,8 @@ function perfectionist() {
|
|
|
823
824
|
type: "natural"
|
|
824
825
|
}],
|
|
825
826
|
"perfectionist/sort-named-exports": ["warn", { groups: ["type-export", "value-export"] }],
|
|
826
|
-
"perfectionist/sort-named-imports": ["warn", { groups: ["type-import", "value-import"] }]
|
|
827
|
+
"perfectionist/sort-named-imports": ["warn", { groups: ["type-import", "value-import"] }],
|
|
828
|
+
...overrides
|
|
827
829
|
}
|
|
828
830
|
}];
|
|
829
831
|
}
|
|
@@ -1387,7 +1389,7 @@ async function typescript(options = {}) {
|
|
|
1387
1389
|
"ts/no-floating-promises": "error",
|
|
1388
1390
|
"ts/no-for-in-array": "error",
|
|
1389
1391
|
"ts/no-implied-eval": "error",
|
|
1390
|
-
"ts/no-misused-promises": "error",
|
|
1392
|
+
"ts/no-misused-promises": ["error", { checksVoidReturn: { attributes: false } }],
|
|
1391
1393
|
"ts/no-unnecessary-type-arguments": "error",
|
|
1392
1394
|
"ts/no-unnecessary-type-assertion": "error",
|
|
1393
1395
|
"ts/no-unsafe-argument": "error",
|
|
@@ -1401,8 +1403,11 @@ async function typescript(options = {}) {
|
|
|
1401
1403
|
"ts/require-await": "error",
|
|
1402
1404
|
"ts/restrict-plus-operands": "error",
|
|
1403
1405
|
"ts/restrict-template-expressions": "error",
|
|
1404
|
-
"ts/return-await": ["error", "
|
|
1405
|
-
"ts/strict-boolean-expressions": ["error", {
|
|
1406
|
+
"ts/return-await": ["error", "in-try-catch"],
|
|
1407
|
+
"ts/strict-boolean-expressions": ["error", {
|
|
1408
|
+
allowNullableBoolean: true,
|
|
1409
|
+
allowNullableString: true
|
|
1410
|
+
}],
|
|
1406
1411
|
"ts/switch-exhaustiveness-check": ["error", { considerDefaultExhaustiveForUnions: true }],
|
|
1407
1412
|
"ts/unbound-method": "error"
|
|
1408
1413
|
};
|
|
@@ -1720,7 +1725,7 @@ function getStyleOptions(options) {
|
|
|
1720
1725
|
* @returns Merged ESLint configurations based on provided options.
|
|
1721
1726
|
*/
|
|
1722
1727
|
function ncontiero(options = {}, ...userConfigs) {
|
|
1723
|
-
const { deMorgan: enableDeMorgan = true, e18e: enableE18e = true, gitignore: enableGitignore = true, html: enableHtml = true, ignores: userIgnores = [], imports: enableImports = true, jsdoc: enableJsdoc = true, jsonc: enableJsonc = true, jsx: enableJsx = true, markdown: enableMarkdown = true, nextjs: enableNextJs = hasNextJs, node: enableNode = true, prettier: enablePrettier = true, promise: enablePromise = true, react: enableReact = hasReact, regexp: enableRegexp = true, tailwindcss: enableTailwindCSS = hasTailwind, tanstackQuery: enableTanStackQuery = false, typescript: enableTypescript = hasTypeScript, unicorn: enableUnicorn = true } = options;
|
|
1728
|
+
const { deMorgan: enableDeMorgan = true, e18e: enableE18e = true, gitignore: enableGitignore = true, html: enableHtml = true, ignores: userIgnores = [], imports: enableImports = true, jsdoc: enableJsdoc = true, jsonc: enableJsonc = true, jsx: enableJsx = true, markdown: enableMarkdown = true, nextjs: enableNextJs = hasNextJs, node: enableNode = true, perfectionist: enablePerfectionist = true, prettier: enablePrettier = true, promise: enablePromise = true, react: enableReact = hasReact, regexp: enableRegexp = true, tailwindcss: enableTailwindCSS = hasTailwind, tanstackQuery: enableTanStackQuery = false, typescript: enableTypescript = hasTypeScript, unicorn: enableUnicorn = true } = options;
|
|
1724
1729
|
const prettierOptions = typeof options.prettier === "object" ? options.prettier : {};
|
|
1725
1730
|
const styleOptions = getStyleOptions(prettierOptions);
|
|
1726
1731
|
const configs = [];
|
|
@@ -1734,7 +1739,8 @@ function ncontiero(options = {}, ...userConfigs) {
|
|
|
1734
1739
|
})]));
|
|
1735
1740
|
const typescriptOptions = resolveSubOptions(options, "typescript");
|
|
1736
1741
|
const tsconfigPath = "tsconfigPath" in typescriptOptions ? typescriptOptions.tsconfigPath : void 0;
|
|
1737
|
-
configs.push(ignores(userIgnores, !enableTypescript), javascript({ overrides: getOverrides(options, "javascript") }), comments(), command()
|
|
1742
|
+
configs.push(ignores(userIgnores, !enableTypescript), javascript({ overrides: getOverrides(options, "javascript") }), comments(), command());
|
|
1743
|
+
if (enablePerfectionist) configs.push(perfectionist({ overrides: getOverrides(options, "perfectionist") }));
|
|
1738
1744
|
if (enableNode) configs.push(node());
|
|
1739
1745
|
if (enablePromise) configs.push(promise({ overrides: getOverrides(options, "promise") }));
|
|
1740
1746
|
if (enableJsdoc) configs.push(jsdoc());
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ncontiero/eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "8.1
|
|
4
|
+
"version": "8.2.1",
|
|
5
5
|
"description": "Nicolas's ESLint config.",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Nicolas Contiero",
|
|
@@ -37,15 +37,15 @@
|
|
|
37
37
|
}
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@e18e/eslint-plugin": "^0.
|
|
40
|
+
"@e18e/eslint-plugin": "^0.5.0",
|
|
41
41
|
"@eslint-community/eslint-plugin-eslint-comments": "^4.7.1",
|
|
42
|
-
"@eslint-react/eslint-plugin": "^5.7.
|
|
42
|
+
"@eslint-react/eslint-plugin": "^5.7.7",
|
|
43
43
|
"@eslint/markdown": "^8.0.1",
|
|
44
44
|
"@html-eslint/eslint-plugin": "^0.60.0",
|
|
45
45
|
"@html-eslint/parser": "^0.60.0",
|
|
46
46
|
"@next/eslint-plugin-next": "^16.2.6",
|
|
47
|
-
"@typescript-eslint/eslint-plugin": "^8.59.
|
|
48
|
-
"@typescript-eslint/parser": "^8.59.
|
|
47
|
+
"@typescript-eslint/eslint-plugin": "^8.59.3",
|
|
48
|
+
"@typescript-eslint/parser": "^8.59.3",
|
|
49
49
|
"eslint-config-flat-gitignore": "^2.3.0",
|
|
50
50
|
"eslint-merge-processors": "^2.0.0",
|
|
51
51
|
"eslint-plugin-antfu": "^3.2.3",
|
|
@@ -74,14 +74,14 @@
|
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
76
|
"@changesets/cli": "^2.31.0",
|
|
77
|
-
"@commitlint/cli": "^21.0.
|
|
78
|
-
"@commitlint/config-conventional": "^21.0.
|
|
79
|
-
"@eslint/config-inspector": "^
|
|
77
|
+
"@commitlint/cli": "^21.0.1",
|
|
78
|
+
"@commitlint/config-conventional": "^21.0.1",
|
|
79
|
+
"@eslint/config-inspector": "^3.0.2",
|
|
80
80
|
"@ncontiero/changelog-github": "^2.1.3",
|
|
81
81
|
"@ncontiero/prettier-config": "^1.0.0",
|
|
82
82
|
"@tanstack/eslint-plugin-query": "^5.100.10",
|
|
83
83
|
"@types/eslint-plugin-jsx-a11y": "^6.10.1",
|
|
84
|
-
"@types/node": "^25.
|
|
84
|
+
"@types/node": "^25.7.0",
|
|
85
85
|
"eslint": "^10.3.0",
|
|
86
86
|
"eslint-typegen": "^2.3.1",
|
|
87
87
|
"husky": "^9.1.7",
|