eslint-config-decent 2.4.3 → 2.5.0-beta2
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 +66 -34
- package/dist/index.d.cts +8 -2
- package/dist/index.d.mts +8 -2
- package/dist/index.d.ts +8 -2
- package/dist/index.mjs +59 -29
- package/package.json +2 -1
- package/src/index.ts +19 -0
- package/src/nextjs.ts +27 -0
- package/src/types/eslint-plugin-next.d.ts +10 -0
package/dist/index.cjs
CHANGED
|
@@ -12,8 +12,9 @@ const jest = require('eslint-plugin-jest');
|
|
|
12
12
|
const jestDom = require('eslint-plugin-jest-dom');
|
|
13
13
|
const jsdoc = require('eslint-plugin-jsdoc');
|
|
14
14
|
const mocha = require('eslint-plugin-mocha');
|
|
15
|
-
const promise = require('eslint-plugin-promise');
|
|
16
15
|
const compat = require('@eslint/compat');
|
|
16
|
+
const nextJs = require('@next/eslint-plugin-next');
|
|
17
|
+
const promise = require('eslint-plugin-promise');
|
|
17
18
|
const a11y = require('eslint-plugin-jsx-a11y');
|
|
18
19
|
const react = require('eslint-plugin-react');
|
|
19
20
|
const reactHooks = require('eslint-plugin-react-hooks');
|
|
@@ -32,6 +33,7 @@ const jest__default = /*#__PURE__*/_interopDefaultCompat(jest);
|
|
|
32
33
|
const jestDom__default = /*#__PURE__*/_interopDefaultCompat(jestDom);
|
|
33
34
|
const jsdoc__default = /*#__PURE__*/_interopDefaultCompat(jsdoc);
|
|
34
35
|
const mocha__default = /*#__PURE__*/_interopDefaultCompat(mocha);
|
|
36
|
+
const nextJs__default = /*#__PURE__*/_interopDefaultCompat(nextJs);
|
|
35
37
|
const promise__default = /*#__PURE__*/_interopDefaultCompat(promise);
|
|
36
38
|
const a11y__default = /*#__PURE__*/_interopDefaultCompat(a11y);
|
|
37
39
|
const react__default = /*#__PURE__*/_interopDefaultCompat(react);
|
|
@@ -40,7 +42,7 @@ const security__default = /*#__PURE__*/_interopDefaultCompat(security);
|
|
|
40
42
|
const testingLibrary__default = /*#__PURE__*/_interopDefaultCompat(testingLibrary);
|
|
41
43
|
const unicorn__default = /*#__PURE__*/_interopDefaultCompat(unicorn);
|
|
42
44
|
|
|
43
|
-
const base$
|
|
45
|
+
const base$c = {
|
|
44
46
|
rules: {
|
|
45
47
|
"array-callback-return": ["error", { allowImplicit: true }],
|
|
46
48
|
"block-scoped-var": "error",
|
|
@@ -290,8 +292,8 @@ const cjs = {
|
|
|
290
292
|
strict: ["error", "global"]
|
|
291
293
|
}
|
|
292
294
|
};
|
|
293
|
-
const configs$
|
|
294
|
-
base: base$
|
|
295
|
+
const configs$c = {
|
|
296
|
+
base: base$c,
|
|
295
297
|
cjsAndEsm,
|
|
296
298
|
cjs
|
|
297
299
|
};
|
|
@@ -390,7 +392,7 @@ const requireIndexRule = utils.ESLintUtils.RuleCreator(() => "https://github.com
|
|
|
390
392
|
}
|
|
391
393
|
});
|
|
392
394
|
|
|
393
|
-
const base$
|
|
395
|
+
const base$b = {
|
|
394
396
|
plugins: {
|
|
395
397
|
"decent-extension": {
|
|
396
398
|
meta: {
|
|
@@ -408,11 +410,11 @@ const base$a = {
|
|
|
408
410
|
"decent-extension/require-index": "error"
|
|
409
411
|
}
|
|
410
412
|
};
|
|
411
|
-
const configs$
|
|
412
|
-
base: base$
|
|
413
|
+
const configs$b = {
|
|
414
|
+
base: base$b
|
|
413
415
|
};
|
|
414
416
|
|
|
415
|
-
const base$
|
|
417
|
+
const base$a = {
|
|
416
418
|
plugins: {
|
|
417
419
|
import: importPlugin__default
|
|
418
420
|
},
|
|
@@ -427,11 +429,11 @@ const base$9 = {
|
|
|
427
429
|
]
|
|
428
430
|
}
|
|
429
431
|
};
|
|
430
|
-
const configs$
|
|
431
|
-
base: base$
|
|
432
|
+
const configs$a = {
|
|
433
|
+
base: base$a
|
|
432
434
|
};
|
|
433
435
|
|
|
434
|
-
const base$
|
|
436
|
+
const base$9 = {
|
|
435
437
|
plugins: {
|
|
436
438
|
jest: jest__default,
|
|
437
439
|
"jest-dom": jestDom__default
|
|
@@ -474,11 +476,11 @@ const base$8 = {
|
|
|
474
476
|
"@typescript-eslint/unbound-method": "off"
|
|
475
477
|
}
|
|
476
478
|
};
|
|
477
|
-
const configs$
|
|
478
|
-
base: base$
|
|
479
|
+
const configs$9 = {
|
|
480
|
+
base: base$9
|
|
479
481
|
};
|
|
480
482
|
|
|
481
|
-
const base$
|
|
483
|
+
const base$8 = {
|
|
482
484
|
settings: {
|
|
483
485
|
jsdoc: {
|
|
484
486
|
preferredTypes: {
|
|
@@ -503,11 +505,11 @@ const base$7 = {
|
|
|
503
505
|
"unicorn/prefer-set-has": "error"
|
|
504
506
|
}
|
|
505
507
|
};
|
|
506
|
-
const configs$
|
|
507
|
-
base: base$
|
|
508
|
+
const configs$8 = {
|
|
509
|
+
base: base$8
|
|
508
510
|
};
|
|
509
511
|
|
|
510
|
-
const base$
|
|
512
|
+
const base$7 = {
|
|
511
513
|
plugins: {
|
|
512
514
|
mocha: mocha__default
|
|
513
515
|
},
|
|
@@ -526,6 +528,22 @@ const base$6 = {
|
|
|
526
528
|
"mocha/no-mocha-arrows": "off"
|
|
527
529
|
}
|
|
528
530
|
};
|
|
531
|
+
const configs$7 = {
|
|
532
|
+
base: base$7
|
|
533
|
+
};
|
|
534
|
+
|
|
535
|
+
const recommendedRules = {};
|
|
536
|
+
for (const ruleName of Object.keys({ ...nextJs__default.configs.recommended.rules })) {
|
|
537
|
+
recommendedRules[ruleName] = "error";
|
|
538
|
+
}
|
|
539
|
+
const base$6 = {
|
|
540
|
+
plugins: {
|
|
541
|
+
"@next/next": compat.fixupPluginRules(nextJs__default)
|
|
542
|
+
},
|
|
543
|
+
rules: {
|
|
544
|
+
...recommendedRules
|
|
545
|
+
}
|
|
546
|
+
};
|
|
529
547
|
const configs$6 = {
|
|
530
548
|
base: base$6
|
|
531
549
|
};
|
|
@@ -753,6 +771,7 @@ function tsEslintConfig(options) {
|
|
|
753
771
|
const enableJest = options?.enableJest ?? true;
|
|
754
772
|
const enableMocha = options?.enableMocha ?? true;
|
|
755
773
|
const enableReact = options?.enableReact ?? true;
|
|
774
|
+
const enableNextJs = options?.enableNextJs ?? true;
|
|
756
775
|
const enableTestingLibrary = options?.enableTestingLibrary ?? true;
|
|
757
776
|
const languageOptions = {
|
|
758
777
|
globals: {
|
|
@@ -783,25 +802,25 @@ function tsEslintConfig(options) {
|
|
|
783
802
|
{
|
|
784
803
|
languageOptions,
|
|
785
804
|
settings: {
|
|
786
|
-
...configs$
|
|
805
|
+
...configs$8.base.settings
|
|
787
806
|
}
|
|
788
807
|
},
|
|
789
808
|
{
|
|
790
809
|
name: "eslint-config-decent/base",
|
|
791
810
|
files: ["**/*.ts", "**/*.js", "**/*.cjs", "**/*.mjs", "**/*.tsx"],
|
|
792
811
|
plugins: {
|
|
812
|
+
...configs$b.base.plugins,
|
|
793
813
|
...configs$a.base.plugins,
|
|
794
|
-
...configs$
|
|
795
|
-
...configs$7.base.plugins,
|
|
814
|
+
...configs$8.base.plugins,
|
|
796
815
|
...configs$5.base.plugins,
|
|
797
816
|
...configs$3.base.plugins,
|
|
798
817
|
...configs.base.plugins
|
|
799
818
|
},
|
|
800
819
|
rules: {
|
|
801
|
-
...configs$
|
|
802
|
-
...enableRequireExtensionRule ? configs$
|
|
803
|
-
...configs$
|
|
804
|
-
...configs$
|
|
820
|
+
...configs$c.base.rules,
|
|
821
|
+
...enableRequireExtensionRule ? configs$b.base.rules : {},
|
|
822
|
+
...configs$a.base.rules,
|
|
823
|
+
...configs$8.base.rules,
|
|
805
824
|
...configs$5.base.rules,
|
|
806
825
|
...configs$3.base.rules,
|
|
807
826
|
...configs.base.rules
|
|
@@ -826,13 +845,25 @@ function tsEslintConfig(options) {
|
|
|
826
845
|
}
|
|
827
846
|
}
|
|
828
847
|
] : [],
|
|
848
|
+
...enableNextJs ? [
|
|
849
|
+
{
|
|
850
|
+
name: "eslint-config-decent/nextjs",
|
|
851
|
+
files: ["**/*.tsx"],
|
|
852
|
+
settings: {
|
|
853
|
+
next: {
|
|
854
|
+
rootDir: options?.nextJsRootDir
|
|
855
|
+
}
|
|
856
|
+
},
|
|
857
|
+
...configs$6.base
|
|
858
|
+
}
|
|
859
|
+
] : [],
|
|
829
860
|
{
|
|
830
861
|
name: "eslint-config-decent/cjs-and-esm",
|
|
831
862
|
files: ["**/*.js", "**/*.cjs", "**/*.mjs"],
|
|
832
863
|
languageOptions: {
|
|
833
864
|
sourceType: "script"
|
|
834
865
|
},
|
|
835
|
-
...configs$
|
|
866
|
+
...configs$c.cjsAndEsm
|
|
836
867
|
},
|
|
837
868
|
{
|
|
838
869
|
name: "eslint-config-decent/cjs",
|
|
@@ -840,20 +871,20 @@ function tsEslintConfig(options) {
|
|
|
840
871
|
languageOptions: {
|
|
841
872
|
sourceType: "script"
|
|
842
873
|
},
|
|
843
|
-
...configs$
|
|
874
|
+
...configs$c.cjs
|
|
844
875
|
},
|
|
845
876
|
...enableMocha ? [
|
|
846
877
|
{
|
|
847
878
|
name: "eslint-config-decent/mocha-tests",
|
|
848
879
|
files: ["**/*.tests.ts", "tests/tests.ts"],
|
|
849
|
-
...configs$
|
|
880
|
+
...configs$7.base
|
|
850
881
|
}
|
|
851
882
|
] : [],
|
|
852
883
|
...enableJest ? [
|
|
853
884
|
{
|
|
854
885
|
name: "eslint-config-decent/jest-tests",
|
|
855
886
|
files: ["**/__tests__/**/*.ts?(x)", "**/*.{spec,test}.ts?(x)"],
|
|
856
|
-
...configs$
|
|
887
|
+
...configs$9.base
|
|
857
888
|
}
|
|
858
889
|
] : [],
|
|
859
890
|
...enableTestingLibrary ? [
|
|
@@ -884,12 +915,13 @@ function config(options) {
|
|
|
884
915
|
|
|
885
916
|
exports.config = config;
|
|
886
917
|
exports.defaultConfig = defaultConfig;
|
|
887
|
-
exports.eslintConfigs = configs$
|
|
888
|
-
exports.extensionConfigs = configs$
|
|
889
|
-
exports.importConfigs = configs$
|
|
890
|
-
exports.jestConfigs = configs$
|
|
891
|
-
exports.jsdocConfigs = configs$
|
|
892
|
-
exports.mochaConfigs = configs$
|
|
918
|
+
exports.eslintConfigs = configs$c;
|
|
919
|
+
exports.extensionConfigs = configs$b;
|
|
920
|
+
exports.importConfigs = configs$a;
|
|
921
|
+
exports.jestConfigs = configs$9;
|
|
922
|
+
exports.jsdocConfigs = configs$8;
|
|
923
|
+
exports.mochaConfigs = configs$7;
|
|
924
|
+
exports.nextJsConfigs = configs$6;
|
|
893
925
|
exports.promiseConfigs = configs$5;
|
|
894
926
|
exports.reactConfigs = configs$4;
|
|
895
927
|
exports.securityConfigs = configs$3;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import { TSESLint } from '@typescript-eslint/utils';
|
|
2
2
|
import { ConfigWithExtends } from 'typescript-eslint';
|
|
3
3
|
|
|
4
|
-
declare const configs$
|
|
4
|
+
declare const configs$c: {
|
|
5
5
|
base: TSESLint.FlatConfig.Config;
|
|
6
6
|
cjsAndEsm: TSESLint.FlatConfig.Config;
|
|
7
7
|
cjs: TSESLint.FlatConfig.Config;
|
|
8
8
|
};
|
|
9
9
|
|
|
10
|
+
declare const configs$b: {
|
|
11
|
+
base: TSESLint.FlatConfig.Config;
|
|
12
|
+
};
|
|
13
|
+
|
|
10
14
|
declare const configs$a: {
|
|
11
15
|
base: TSESLint.FlatConfig.Config;
|
|
12
16
|
};
|
|
@@ -58,6 +62,8 @@ interface DefaultConfigOptions {
|
|
|
58
62
|
enableJest?: boolean;
|
|
59
63
|
enableMocha?: boolean;
|
|
60
64
|
enableReact?: boolean;
|
|
65
|
+
enableNextJs?: boolean;
|
|
66
|
+
nextJsRootDir?: string;
|
|
61
67
|
enableTestingLibrary?: boolean;
|
|
62
68
|
}
|
|
63
69
|
/**
|
|
@@ -77,4 +83,4 @@ declare function tsEslintConfig(options?: DefaultConfigOptions): ConfigWithExten
|
|
|
77
83
|
*/
|
|
78
84
|
declare function config(options?: DefaultConfigOptions): TSESLint.FlatConfig.ConfigArray;
|
|
79
85
|
|
|
80
|
-
export { type DefaultConfigOptions, config, defaultConfig, configs$
|
|
86
|
+
export { type DefaultConfigOptions, config, defaultConfig, configs$c as eslintConfigs, configs$b as extensionConfigs, configs$a as importConfigs, configs$9 as jestConfigs, configs$8 as jsdocConfigs, configs$7 as mochaConfigs, configs$6 as nextJsConfigs, configs$5 as promiseConfigs, configs$4 as reactConfigs, configs$3 as securityConfigs, configs$2 as testingLibraryConfigs, tsEslintConfig, configs$1 as typescriptEslintConfigs, configs as unicornConfigs };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import { TSESLint } from '@typescript-eslint/utils';
|
|
2
2
|
import { ConfigWithExtends } from 'typescript-eslint';
|
|
3
3
|
|
|
4
|
-
declare const configs$
|
|
4
|
+
declare const configs$c: {
|
|
5
5
|
base: TSESLint.FlatConfig.Config;
|
|
6
6
|
cjsAndEsm: TSESLint.FlatConfig.Config;
|
|
7
7
|
cjs: TSESLint.FlatConfig.Config;
|
|
8
8
|
};
|
|
9
9
|
|
|
10
|
+
declare const configs$b: {
|
|
11
|
+
base: TSESLint.FlatConfig.Config;
|
|
12
|
+
};
|
|
13
|
+
|
|
10
14
|
declare const configs$a: {
|
|
11
15
|
base: TSESLint.FlatConfig.Config;
|
|
12
16
|
};
|
|
@@ -58,6 +62,8 @@ interface DefaultConfigOptions {
|
|
|
58
62
|
enableJest?: boolean;
|
|
59
63
|
enableMocha?: boolean;
|
|
60
64
|
enableReact?: boolean;
|
|
65
|
+
enableNextJs?: boolean;
|
|
66
|
+
nextJsRootDir?: string;
|
|
61
67
|
enableTestingLibrary?: boolean;
|
|
62
68
|
}
|
|
63
69
|
/**
|
|
@@ -77,4 +83,4 @@ declare function tsEslintConfig(options?: DefaultConfigOptions): ConfigWithExten
|
|
|
77
83
|
*/
|
|
78
84
|
declare function config(options?: DefaultConfigOptions): TSESLint.FlatConfig.ConfigArray;
|
|
79
85
|
|
|
80
|
-
export { type DefaultConfigOptions, config, defaultConfig, configs$
|
|
86
|
+
export { type DefaultConfigOptions, config, defaultConfig, configs$c as eslintConfigs, configs$b as extensionConfigs, configs$a as importConfigs, configs$9 as jestConfigs, configs$8 as jsdocConfigs, configs$7 as mochaConfigs, configs$6 as nextJsConfigs, configs$5 as promiseConfigs, configs$4 as reactConfigs, configs$3 as securityConfigs, configs$2 as testingLibraryConfigs, tsEslintConfig, configs$1 as typescriptEslintConfigs, configs as unicornConfigs };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import { TSESLint } from '@typescript-eslint/utils';
|
|
2
2
|
import { ConfigWithExtends } from 'typescript-eslint';
|
|
3
3
|
|
|
4
|
-
declare const configs$
|
|
4
|
+
declare const configs$c: {
|
|
5
5
|
base: TSESLint.FlatConfig.Config;
|
|
6
6
|
cjsAndEsm: TSESLint.FlatConfig.Config;
|
|
7
7
|
cjs: TSESLint.FlatConfig.Config;
|
|
8
8
|
};
|
|
9
9
|
|
|
10
|
+
declare const configs$b: {
|
|
11
|
+
base: TSESLint.FlatConfig.Config;
|
|
12
|
+
};
|
|
13
|
+
|
|
10
14
|
declare const configs$a: {
|
|
11
15
|
base: TSESLint.FlatConfig.Config;
|
|
12
16
|
};
|
|
@@ -58,6 +62,8 @@ interface DefaultConfigOptions {
|
|
|
58
62
|
enableJest?: boolean;
|
|
59
63
|
enableMocha?: boolean;
|
|
60
64
|
enableReact?: boolean;
|
|
65
|
+
enableNextJs?: boolean;
|
|
66
|
+
nextJsRootDir?: string;
|
|
61
67
|
enableTestingLibrary?: boolean;
|
|
62
68
|
}
|
|
63
69
|
/**
|
|
@@ -77,4 +83,4 @@ declare function tsEslintConfig(options?: DefaultConfigOptions): ConfigWithExten
|
|
|
77
83
|
*/
|
|
78
84
|
declare function config(options?: DefaultConfigOptions): TSESLint.FlatConfig.ConfigArray;
|
|
79
85
|
|
|
80
|
-
export { type DefaultConfigOptions, config, defaultConfig, configs$
|
|
86
|
+
export { type DefaultConfigOptions, config, defaultConfig, configs$c as eslintConfigs, configs$b as extensionConfigs, configs$a as importConfigs, configs$9 as jestConfigs, configs$8 as jsdocConfigs, configs$7 as mochaConfigs, configs$6 as nextJsConfigs, configs$5 as promiseConfigs, configs$4 as reactConfigs, configs$3 as securityConfigs, configs$2 as testingLibraryConfigs, tsEslintConfig, configs$1 as typescriptEslintConfigs, configs as unicornConfigs };
|
package/dist/index.mjs
CHANGED
|
@@ -10,8 +10,9 @@ import jest from 'eslint-plugin-jest';
|
|
|
10
10
|
import jestDom from 'eslint-plugin-jest-dom';
|
|
11
11
|
import jsdoc from 'eslint-plugin-jsdoc';
|
|
12
12
|
import mocha from 'eslint-plugin-mocha';
|
|
13
|
-
import promise from 'eslint-plugin-promise';
|
|
14
13
|
import { fixupPluginRules } from '@eslint/compat';
|
|
14
|
+
import nextJs from '@next/eslint-plugin-next';
|
|
15
|
+
import promise from 'eslint-plugin-promise';
|
|
15
16
|
import a11y from 'eslint-plugin-jsx-a11y';
|
|
16
17
|
import react from 'eslint-plugin-react';
|
|
17
18
|
import reactHooks from 'eslint-plugin-react-hooks';
|
|
@@ -19,7 +20,7 @@ import security from 'eslint-plugin-security';
|
|
|
19
20
|
import testingLibrary from 'eslint-plugin-testing-library';
|
|
20
21
|
import unicorn from 'eslint-plugin-unicorn';
|
|
21
22
|
|
|
22
|
-
const base$
|
|
23
|
+
const base$c = {
|
|
23
24
|
rules: {
|
|
24
25
|
"array-callback-return": ["error", { allowImplicit: true }],
|
|
25
26
|
"block-scoped-var": "error",
|
|
@@ -269,8 +270,8 @@ const cjs = {
|
|
|
269
270
|
strict: ["error", "global"]
|
|
270
271
|
}
|
|
271
272
|
};
|
|
272
|
-
const configs$
|
|
273
|
-
base: base$
|
|
273
|
+
const configs$c = {
|
|
274
|
+
base: base$c,
|
|
274
275
|
cjsAndEsm,
|
|
275
276
|
cjs
|
|
276
277
|
};
|
|
@@ -369,7 +370,7 @@ const requireIndexRule = ESLintUtils.RuleCreator(() => "https://github.com/jgeur
|
|
|
369
370
|
}
|
|
370
371
|
});
|
|
371
372
|
|
|
372
|
-
const base$
|
|
373
|
+
const base$b = {
|
|
373
374
|
plugins: {
|
|
374
375
|
"decent-extension": {
|
|
375
376
|
meta: {
|
|
@@ -387,11 +388,11 @@ const base$a = {
|
|
|
387
388
|
"decent-extension/require-index": "error"
|
|
388
389
|
}
|
|
389
390
|
};
|
|
390
|
-
const configs$
|
|
391
|
-
base: base$
|
|
391
|
+
const configs$b = {
|
|
392
|
+
base: base$b
|
|
392
393
|
};
|
|
393
394
|
|
|
394
|
-
const base$
|
|
395
|
+
const base$a = {
|
|
395
396
|
plugins: {
|
|
396
397
|
import: importPlugin
|
|
397
398
|
},
|
|
@@ -406,11 +407,11 @@ const base$9 = {
|
|
|
406
407
|
]
|
|
407
408
|
}
|
|
408
409
|
};
|
|
409
|
-
const configs$
|
|
410
|
-
base: base$
|
|
410
|
+
const configs$a = {
|
|
411
|
+
base: base$a
|
|
411
412
|
};
|
|
412
413
|
|
|
413
|
-
const base$
|
|
414
|
+
const base$9 = {
|
|
414
415
|
plugins: {
|
|
415
416
|
jest,
|
|
416
417
|
"jest-dom": jestDom
|
|
@@ -453,11 +454,11 @@ const base$8 = {
|
|
|
453
454
|
"@typescript-eslint/unbound-method": "off"
|
|
454
455
|
}
|
|
455
456
|
};
|
|
456
|
-
const configs$
|
|
457
|
-
base: base$
|
|
457
|
+
const configs$9 = {
|
|
458
|
+
base: base$9
|
|
458
459
|
};
|
|
459
460
|
|
|
460
|
-
const base$
|
|
461
|
+
const base$8 = {
|
|
461
462
|
settings: {
|
|
462
463
|
jsdoc: {
|
|
463
464
|
preferredTypes: {
|
|
@@ -482,11 +483,11 @@ const base$7 = {
|
|
|
482
483
|
"unicorn/prefer-set-has": "error"
|
|
483
484
|
}
|
|
484
485
|
};
|
|
485
|
-
const configs$
|
|
486
|
-
base: base$
|
|
486
|
+
const configs$8 = {
|
|
487
|
+
base: base$8
|
|
487
488
|
};
|
|
488
489
|
|
|
489
|
-
const base$
|
|
490
|
+
const base$7 = {
|
|
490
491
|
plugins: {
|
|
491
492
|
mocha
|
|
492
493
|
},
|
|
@@ -505,6 +506,22 @@ const base$6 = {
|
|
|
505
506
|
"mocha/no-mocha-arrows": "off"
|
|
506
507
|
}
|
|
507
508
|
};
|
|
509
|
+
const configs$7 = {
|
|
510
|
+
base: base$7
|
|
511
|
+
};
|
|
512
|
+
|
|
513
|
+
const recommendedRules = {};
|
|
514
|
+
for (const ruleName of Object.keys({ ...nextJs.configs.recommended.rules })) {
|
|
515
|
+
recommendedRules[ruleName] = "error";
|
|
516
|
+
}
|
|
517
|
+
const base$6 = {
|
|
518
|
+
plugins: {
|
|
519
|
+
"@next/next": fixupPluginRules(nextJs)
|
|
520
|
+
},
|
|
521
|
+
rules: {
|
|
522
|
+
...recommendedRules
|
|
523
|
+
}
|
|
524
|
+
};
|
|
508
525
|
const configs$6 = {
|
|
509
526
|
base: base$6
|
|
510
527
|
};
|
|
@@ -732,6 +749,7 @@ function tsEslintConfig(options) {
|
|
|
732
749
|
const enableJest = options?.enableJest ?? true;
|
|
733
750
|
const enableMocha = options?.enableMocha ?? true;
|
|
734
751
|
const enableReact = options?.enableReact ?? true;
|
|
752
|
+
const enableNextJs = options?.enableNextJs ?? true;
|
|
735
753
|
const enableTestingLibrary = options?.enableTestingLibrary ?? true;
|
|
736
754
|
const languageOptions = {
|
|
737
755
|
globals: {
|
|
@@ -762,25 +780,25 @@ function tsEslintConfig(options) {
|
|
|
762
780
|
{
|
|
763
781
|
languageOptions,
|
|
764
782
|
settings: {
|
|
765
|
-
...configs$
|
|
783
|
+
...configs$8.base.settings
|
|
766
784
|
}
|
|
767
785
|
},
|
|
768
786
|
{
|
|
769
787
|
name: "eslint-config-decent/base",
|
|
770
788
|
files: ["**/*.ts", "**/*.js", "**/*.cjs", "**/*.mjs", "**/*.tsx"],
|
|
771
789
|
plugins: {
|
|
790
|
+
...configs$b.base.plugins,
|
|
772
791
|
...configs$a.base.plugins,
|
|
773
|
-
...configs$
|
|
774
|
-
...configs$7.base.plugins,
|
|
792
|
+
...configs$8.base.plugins,
|
|
775
793
|
...configs$5.base.plugins,
|
|
776
794
|
...configs$3.base.plugins,
|
|
777
795
|
...configs.base.plugins
|
|
778
796
|
},
|
|
779
797
|
rules: {
|
|
780
|
-
...configs$
|
|
781
|
-
...enableRequireExtensionRule ? configs$
|
|
782
|
-
...configs$
|
|
783
|
-
...configs$
|
|
798
|
+
...configs$c.base.rules,
|
|
799
|
+
...enableRequireExtensionRule ? configs$b.base.rules : {},
|
|
800
|
+
...configs$a.base.rules,
|
|
801
|
+
...configs$8.base.rules,
|
|
784
802
|
...configs$5.base.rules,
|
|
785
803
|
...configs$3.base.rules,
|
|
786
804
|
...configs.base.rules
|
|
@@ -805,13 +823,25 @@ function tsEslintConfig(options) {
|
|
|
805
823
|
}
|
|
806
824
|
}
|
|
807
825
|
] : [],
|
|
826
|
+
...enableNextJs ? [
|
|
827
|
+
{
|
|
828
|
+
name: "eslint-config-decent/nextjs",
|
|
829
|
+
files: ["**/*.tsx"],
|
|
830
|
+
settings: {
|
|
831
|
+
next: {
|
|
832
|
+
rootDir: options?.nextJsRootDir
|
|
833
|
+
}
|
|
834
|
+
},
|
|
835
|
+
...configs$6.base
|
|
836
|
+
}
|
|
837
|
+
] : [],
|
|
808
838
|
{
|
|
809
839
|
name: "eslint-config-decent/cjs-and-esm",
|
|
810
840
|
files: ["**/*.js", "**/*.cjs", "**/*.mjs"],
|
|
811
841
|
languageOptions: {
|
|
812
842
|
sourceType: "script"
|
|
813
843
|
},
|
|
814
|
-
...configs$
|
|
844
|
+
...configs$c.cjsAndEsm
|
|
815
845
|
},
|
|
816
846
|
{
|
|
817
847
|
name: "eslint-config-decent/cjs",
|
|
@@ -819,20 +849,20 @@ function tsEslintConfig(options) {
|
|
|
819
849
|
languageOptions: {
|
|
820
850
|
sourceType: "script"
|
|
821
851
|
},
|
|
822
|
-
...configs$
|
|
852
|
+
...configs$c.cjs
|
|
823
853
|
},
|
|
824
854
|
...enableMocha ? [
|
|
825
855
|
{
|
|
826
856
|
name: "eslint-config-decent/mocha-tests",
|
|
827
857
|
files: ["**/*.tests.ts", "tests/tests.ts"],
|
|
828
|
-
...configs$
|
|
858
|
+
...configs$7.base
|
|
829
859
|
}
|
|
830
860
|
] : [],
|
|
831
861
|
...enableJest ? [
|
|
832
862
|
{
|
|
833
863
|
name: "eslint-config-decent/jest-tests",
|
|
834
864
|
files: ["**/__tests__/**/*.ts?(x)", "**/*.{spec,test}.ts?(x)"],
|
|
835
|
-
...configs$
|
|
865
|
+
...configs$9.base
|
|
836
866
|
}
|
|
837
867
|
] : [],
|
|
838
868
|
...enableTestingLibrary ? [
|
|
@@ -861,4 +891,4 @@ function config(options) {
|
|
|
861
891
|
return tsEslint.config(...tsEslintConfig(options));
|
|
862
892
|
}
|
|
863
893
|
|
|
864
|
-
export { config, defaultConfig, configs$
|
|
894
|
+
export { config, defaultConfig, configs$c as eslintConfigs, configs$b as extensionConfigs, configs$a as importConfigs, configs$9 as jestConfigs, configs$8 as jsdocConfigs, configs$7 as mochaConfigs, configs$6 as nextJsConfigs, configs$5 as promiseConfigs, configs$4 as reactConfigs, configs$3 as securityConfigs, configs$2 as testingLibraryConfigs, tsEslintConfig, configs$1 as typescriptEslintConfigs, configs as unicornConfigs };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-config-decent",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.0-beta2",
|
|
4
4
|
"description": "A decent ESLint configuration",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -74,6 +74,7 @@
|
|
|
74
74
|
"dependencies": {
|
|
75
75
|
"@eslint/compat": "1.2.6",
|
|
76
76
|
"@eslint/js": "9.20.0",
|
|
77
|
+
"@next/eslint-plugin-next": "^15.1.7",
|
|
77
78
|
"@typescript-eslint/utils": "8.23.0",
|
|
78
79
|
"eslint-config-prettier": "10.0.1",
|
|
79
80
|
"eslint-plugin-import-x": "4.6.1",
|
package/src/index.ts
CHANGED
|
@@ -10,6 +10,7 @@ import { configs as importConfigs } from './import.js';
|
|
|
10
10
|
import { configs as jestConfigs } from './jest.js';
|
|
11
11
|
import { configs as jsdocConfigs } from './jsdoc.js';
|
|
12
12
|
import { configs as mochaConfigs } from './mocha.js';
|
|
13
|
+
import { configs as nextJsConfigs } from './nextjs.js';
|
|
13
14
|
import { configs as promiseConfigs } from './promise.js';
|
|
14
15
|
import { configs as reactConfigs } from './react.js';
|
|
15
16
|
import { configs as securityConfigs } from './security.js';
|
|
@@ -26,6 +27,7 @@ export {
|
|
|
26
27
|
mochaConfigs,
|
|
27
28
|
promiseConfigs,
|
|
28
29
|
reactConfigs,
|
|
30
|
+
nextJsConfigs,
|
|
29
31
|
securityConfigs,
|
|
30
32
|
testingLibraryConfigs,
|
|
31
33
|
typescriptEslintConfigs,
|
|
@@ -39,6 +41,8 @@ export interface DefaultConfigOptions {
|
|
|
39
41
|
enableJest?: boolean;
|
|
40
42
|
enableMocha?: boolean;
|
|
41
43
|
enableReact?: boolean;
|
|
44
|
+
enableNextJs?: boolean;
|
|
45
|
+
nextJsRootDir?: string;
|
|
42
46
|
enableTestingLibrary?: boolean;
|
|
43
47
|
}
|
|
44
48
|
|
|
@@ -57,6 +61,7 @@ export function tsEslintConfig(options?: DefaultConfigOptions): ConfigWithExtend
|
|
|
57
61
|
const enableJest = options?.enableJest ?? true;
|
|
58
62
|
const enableMocha = options?.enableMocha ?? true;
|
|
59
63
|
const enableReact = options?.enableReact ?? true;
|
|
64
|
+
const enableNextJs = options?.enableNextJs ?? true;
|
|
60
65
|
const enableTestingLibrary = options?.enableTestingLibrary ?? true;
|
|
61
66
|
const languageOptions: ConfigWithExtends['languageOptions'] = {
|
|
62
67
|
globals: {
|
|
@@ -133,6 +138,20 @@ export function tsEslintConfig(options?: DefaultConfigOptions): ConfigWithExtend
|
|
|
133
138
|
},
|
|
134
139
|
] as TSESLint.FlatConfig.Config[])
|
|
135
140
|
: []),
|
|
141
|
+
...(enableNextJs
|
|
142
|
+
? [
|
|
143
|
+
{
|
|
144
|
+
name: 'eslint-config-decent/nextjs',
|
|
145
|
+
files: ['**/*.tsx'],
|
|
146
|
+
settings: {
|
|
147
|
+
next: {
|
|
148
|
+
rootDir: options?.nextJsRootDir,
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
...nextJsConfigs.base,
|
|
152
|
+
},
|
|
153
|
+
]
|
|
154
|
+
: []),
|
|
136
155
|
{
|
|
137
156
|
name: 'eslint-config-decent/cjs-and-esm',
|
|
138
157
|
files: ['**/*.js', '**/*.cjs', '**/*.mjs'],
|
package/src/nextjs.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { FixupPluginDefinition } from '@eslint/compat';
|
|
2
|
+
import { fixupPluginRules } from '@eslint/compat';
|
|
3
|
+
import nextJs from '@next/eslint-plugin-next';
|
|
4
|
+
import type { TSESLint } from '@typescript-eslint/utils';
|
|
5
|
+
|
|
6
|
+
const recommendedRules: Record<string, TSESLint.FlatConfig.RuleEntry> = {};
|
|
7
|
+
|
|
8
|
+
for (const ruleName of Object.keys({ ...nextJs.configs.recommended.rules })) {
|
|
9
|
+
recommendedRules[ruleName] = 'error';
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const base: TSESLint.FlatConfig.Config = {
|
|
13
|
+
plugins: {
|
|
14
|
+
'@next/next': fixupPluginRules(nextJs as FixupPluginDefinition),
|
|
15
|
+
},
|
|
16
|
+
rules: {
|
|
17
|
+
...recommendedRules,
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const configs = {
|
|
22
|
+
base,
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export default {
|
|
26
|
+
configs,
|
|
27
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
declare module '@next/eslint-plugin-next' {
|
|
2
|
+
import type { TSESLint } from '@typescript-eslint/utils';
|
|
3
|
+
const value: TSESLint.FlatConfig.Plugin & {
|
|
4
|
+
configs: {
|
|
5
|
+
recommended: TSESLint.FlatConfig.Config;
|
|
6
|
+
'core-web-vitals': TSESLint.FlatConfig.Config;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
export default value;
|
|
10
|
+
}
|