@rebeccastevens/eslint-config 3.2.4 → 3.3.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/dist/index.cjs +56 -56
- package/dist/index.mjs +56 -56
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -60,28 +60,28 @@ async function loadPackages(packageIds) {
|
|
|
60
60
|
return Promise.all(packageIds.map((id) => interopDefault(import(id))));
|
|
61
61
|
}
|
|
62
62
|
const installPackagesToLoad = new Set();
|
|
63
|
-
let
|
|
64
|
-
let
|
|
65
|
-
let
|
|
63
|
+
let mut_installPackagesAction = null;
|
|
64
|
+
let mut_installPackagesActionResolver = null;
|
|
65
|
+
let mut_installPackagesTimeout = null;
|
|
66
66
|
/* eslint-disable functional/no-loop-statements */
|
|
67
67
|
async function installPackages(packages) {
|
|
68
68
|
for (const p of packages) {
|
|
69
69
|
installPackagesToLoad.add(p);
|
|
70
70
|
}
|
|
71
|
-
if (
|
|
72
|
-
clearTimeout(
|
|
71
|
+
if (mut_installPackagesTimeout !== null) {
|
|
72
|
+
clearTimeout(mut_installPackagesTimeout);
|
|
73
73
|
}
|
|
74
|
-
|
|
74
|
+
mut_installPackagesTimeout = setTimeout(() => {
|
|
75
75
|
const allPackages = [...installPackagesToLoad.values()];
|
|
76
|
-
|
|
76
|
+
mut_installPackagesTimeout = null;
|
|
77
77
|
installPackagesToLoad.clear();
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
78
|
+
mut_installPackagesAction = null;
|
|
79
|
+
mut_installPackagesActionResolver(allPackages);
|
|
80
|
+
mut_installPackagesActionResolver = null;
|
|
81
81
|
}, 100);
|
|
82
|
-
if (
|
|
83
|
-
|
|
84
|
-
|
|
82
|
+
if (mut_installPackagesAction === null) {
|
|
83
|
+
mut_installPackagesAction = new Promise((resolve) => {
|
|
84
|
+
mut_installPackagesActionResolver = resolve;
|
|
85
85
|
}).then(async (allPackages) => {
|
|
86
86
|
const allPackagesString = allPackages.join(", ");
|
|
87
87
|
if (Boolean(process.env["CI"]) || !process.stdout.isTTY) {
|
|
@@ -98,7 +98,7 @@ async function installPackages(packages) {
|
|
|
98
98
|
}
|
|
99
99
|
});
|
|
100
100
|
}
|
|
101
|
-
return
|
|
101
|
+
return mut_installPackagesAction;
|
|
102
102
|
}
|
|
103
103
|
/* eslint-enable functional/no-loop-statements */
|
|
104
104
|
|
|
@@ -488,7 +488,7 @@ async function formatters(opts, stylistic) {
|
|
|
488
488
|
"vue/template-curly-spacing": "off",
|
|
489
489
|
"yaml/block-sequence-hyphen-indicator-newline": "off",
|
|
490
490
|
};
|
|
491
|
-
const
|
|
491
|
+
const mut_configs = [
|
|
492
492
|
{
|
|
493
493
|
name: "rs:formatters:setup",
|
|
494
494
|
plugins: {
|
|
@@ -497,7 +497,7 @@ async function formatters(opts, stylistic) {
|
|
|
497
497
|
},
|
|
498
498
|
];
|
|
499
499
|
if (options.js !== undefined && options.js) {
|
|
500
|
-
|
|
500
|
+
mut_configs.push({
|
|
501
501
|
name: "rs:formatter:javascript",
|
|
502
502
|
files: [GLOB_JS, GLOB_JSX],
|
|
503
503
|
rules: {
|
|
@@ -513,7 +513,7 @@ async function formatters(opts, stylistic) {
|
|
|
513
513
|
});
|
|
514
514
|
}
|
|
515
515
|
if (options.ts !== undefined && options.ts) {
|
|
516
|
-
|
|
516
|
+
mut_configs.push({
|
|
517
517
|
name: "rs:formatter:typescript",
|
|
518
518
|
files: [GLOB_TS, GLOB_TSX],
|
|
519
519
|
ignores: options.dts === true ? [] : [GLOB_DTS],
|
|
@@ -530,7 +530,7 @@ async function formatters(opts, stylistic) {
|
|
|
530
530
|
});
|
|
531
531
|
}
|
|
532
532
|
if (options.yaml !== undefined && options.yaml) {
|
|
533
|
-
|
|
533
|
+
mut_configs.push({
|
|
534
534
|
name: "rs:formatter:yaml",
|
|
535
535
|
files: [GLOB_YAML],
|
|
536
536
|
languageOptions: {
|
|
@@ -549,7 +549,7 @@ async function formatters(opts, stylistic) {
|
|
|
549
549
|
});
|
|
550
550
|
}
|
|
551
551
|
if (options.json !== undefined && options.json) {
|
|
552
|
-
|
|
552
|
+
mut_configs.push({
|
|
553
553
|
name: "rs:formatter:json",
|
|
554
554
|
files: [GLOB_JSON],
|
|
555
555
|
ignores: ["**/package.json"],
|
|
@@ -659,7 +659,7 @@ async function formatters(opts, stylistic) {
|
|
|
659
659
|
});
|
|
660
660
|
}
|
|
661
661
|
if (options.css !== undefined && options.css) {
|
|
662
|
-
|
|
662
|
+
mut_configs.push({
|
|
663
663
|
name: "rs:formatter:css",
|
|
664
664
|
files: [GLOB_CSS, GLOB_POSTCSS],
|
|
665
665
|
languageOptions: {
|
|
@@ -710,7 +710,7 @@ async function formatters(opts, stylistic) {
|
|
|
710
710
|
});
|
|
711
711
|
}
|
|
712
712
|
if (options.html !== undefined && options.html) {
|
|
713
|
-
|
|
713
|
+
mut_configs.push({
|
|
714
714
|
name: "rs:formatter:html",
|
|
715
715
|
files: ["**/*.html"],
|
|
716
716
|
languageOptions: {
|
|
@@ -734,7 +734,7 @@ async function formatters(opts, stylistic) {
|
|
|
734
734
|
: options.slidev === true
|
|
735
735
|
? ["**/slides.md"]
|
|
736
736
|
: (options.slidev.files ?? []);
|
|
737
|
-
|
|
737
|
+
mut_configs.push({
|
|
738
738
|
name: "rs:formatter:markdown",
|
|
739
739
|
files: [GLOB_MARKDOWN],
|
|
740
740
|
ignores: GLOB_SLIDEV,
|
|
@@ -754,7 +754,7 @@ async function formatters(opts, stylistic) {
|
|
|
754
754
|
},
|
|
755
755
|
});
|
|
756
756
|
if (options.slidev !== undefined && options.slidev !== false) {
|
|
757
|
-
|
|
757
|
+
mut_configs.push({
|
|
758
758
|
name: "rs:formatter:slidev",
|
|
759
759
|
files: GLOB_SLIDEV,
|
|
760
760
|
languageOptions: {
|
|
@@ -776,7 +776,7 @@ async function formatters(opts, stylistic) {
|
|
|
776
776
|
}
|
|
777
777
|
}
|
|
778
778
|
if (options.graphql !== undefined && options.graphql) {
|
|
779
|
-
|
|
779
|
+
mut_configs.push({
|
|
780
780
|
files: [GLOB_GRAPHQL],
|
|
781
781
|
languageOptions: {
|
|
782
782
|
parser: parserPlain,
|
|
@@ -794,7 +794,7 @@ async function formatters(opts, stylistic) {
|
|
|
794
794
|
},
|
|
795
795
|
});
|
|
796
796
|
}
|
|
797
|
-
return
|
|
797
|
+
return mut_configs;
|
|
798
798
|
}
|
|
799
799
|
|
|
800
800
|
async function functional(options) {
|
|
@@ -846,7 +846,7 @@ async function functional(options) {
|
|
|
846
846
|
"functional/immutable-data": [
|
|
847
847
|
"error",
|
|
848
848
|
{
|
|
849
|
-
ignoreAccessorPattern: ["**.
|
|
849
|
+
ignoreAccessorPattern: ["**.mut_*.**"],
|
|
850
850
|
ignoreClasses: "fieldsOnly",
|
|
851
851
|
ignoreImmediateMutation: true,
|
|
852
852
|
ignoreNonConstDeclarations: true,
|
|
@@ -1363,7 +1363,7 @@ function javascript(options) {
|
|
|
1363
1363
|
"no-console": ["error", { allow: ["warn", "error"] }],
|
|
1364
1364
|
"no-const-assign": "error",
|
|
1365
1365
|
"no-constant-binary-expression": "error",
|
|
1366
|
-
"no-constant-condition": "error",
|
|
1366
|
+
// "no-constant-condition": "error",
|
|
1367
1367
|
"no-constructor-return": "error",
|
|
1368
1368
|
"no-control-regex": "error",
|
|
1369
1369
|
"no-debugger": "error",
|
|
@@ -1618,7 +1618,7 @@ function javascript(options) {
|
|
|
1618
1618
|
? { props: false }
|
|
1619
1619
|
: {
|
|
1620
1620
|
props: true,
|
|
1621
|
-
ignorePropertyModificationsForRegex: ["^[mM]
|
|
1621
|
+
ignorePropertyModificationsForRegex: ["^[mM]ut_"],
|
|
1622
1622
|
},
|
|
1623
1623
|
],
|
|
1624
1624
|
}),
|
|
@@ -3109,7 +3109,7 @@ async function typescript(options) {
|
|
|
3109
3109
|
selector: "variableLike",
|
|
3110
3110
|
filter: { regex: "_[^_]+", match: true },
|
|
3111
3111
|
format: ["camelCase", "PascalCase"],
|
|
3112
|
-
prefix: ["
|
|
3112
|
+
prefix: ["mut_", "Mut_"],
|
|
3113
3113
|
leadingUnderscore: "forbid",
|
|
3114
3114
|
trailingUnderscore: "forbid",
|
|
3115
3115
|
},
|
|
@@ -3122,7 +3122,7 @@ async function typescript(options) {
|
|
|
3122
3122
|
{
|
|
3123
3123
|
selector: "variable",
|
|
3124
3124
|
format: ["camelCase", "PascalCase", "UPPER_CASE"],
|
|
3125
|
-
prefix: ["
|
|
3125
|
+
prefix: ["mut_", "Mut_"],
|
|
3126
3126
|
leadingUnderscore: "forbid",
|
|
3127
3127
|
trailingUnderscore: "forbid",
|
|
3128
3128
|
},
|
|
@@ -3139,7 +3139,7 @@ async function typescript(options) {
|
|
|
3139
3139
|
filter: { regex: "_[^_]+", match: true },
|
|
3140
3140
|
format: ["camelCase", "PascalCase"],
|
|
3141
3141
|
modifiers: ["const"],
|
|
3142
|
-
prefix: ["
|
|
3142
|
+
prefix: ["mut_", "Mut_"],
|
|
3143
3143
|
leadingUnderscore: "forbid",
|
|
3144
3144
|
trailingUnderscore: "forbid",
|
|
3145
3145
|
},
|
|
@@ -3165,7 +3165,7 @@ async function typescript(options) {
|
|
|
3165
3165
|
{
|
|
3166
3166
|
selector: ["autoAccessor", "parameterProperty", "property"],
|
|
3167
3167
|
format: ["camelCase", "PascalCase"],
|
|
3168
|
-
prefix: ["
|
|
3168
|
+
prefix: ["mut_", "Mut_"],
|
|
3169
3169
|
leadingUnderscore: "forbid",
|
|
3170
3170
|
trailingUnderscore: "forbid",
|
|
3171
3171
|
},
|
|
@@ -3174,7 +3174,7 @@ async function typescript(options) {
|
|
|
3174
3174
|
filter: { regex: "_[^_]+", match: true },
|
|
3175
3175
|
format: ["camelCase", "PascalCase"],
|
|
3176
3176
|
modifiers: ["readonly"],
|
|
3177
|
-
prefix: ["
|
|
3177
|
+
prefix: ["mut_", "Mut_"],
|
|
3178
3178
|
leadingUnderscore: "forbid",
|
|
3179
3179
|
trailingUnderscore: "forbid",
|
|
3180
3180
|
},
|
|
@@ -3693,12 +3693,12 @@ async function rsEslint(options, ...userConfigs) {
|
|
|
3693
3693
|
};
|
|
3694
3694
|
const functionalConfigOptions = {
|
|
3695
3695
|
functionalEnforcement,
|
|
3696
|
-
ignoreNamePattern: ["^
|
|
3696
|
+
ignoreNamePattern: ["^[mM]ut_"],
|
|
3697
3697
|
...resolveSubOptions(options, "functional"),
|
|
3698
3698
|
};
|
|
3699
|
-
const
|
|
3699
|
+
const mut_configs = [];
|
|
3700
3700
|
// Base configs
|
|
3701
|
-
|
|
3701
|
+
mut_configs.push(ignores({
|
|
3702
3702
|
projectRoot,
|
|
3703
3703
|
ignores: ignoresOptions ?? [],
|
|
3704
3704
|
ignoreFiles: ignoresFilesOptions,
|
|
@@ -3716,13 +3716,13 @@ async function rsEslint(options, ...userConfigs) {
|
|
|
3716
3716
|
componentExts.push("vue");
|
|
3717
3717
|
}
|
|
3718
3718
|
if (sonarOptions) {
|
|
3719
|
-
|
|
3719
|
+
mut_configs.push(sonar(functionalConfigOptions));
|
|
3720
3720
|
}
|
|
3721
3721
|
if (jsxOptions) {
|
|
3722
|
-
|
|
3722
|
+
mut_configs.push(jsx());
|
|
3723
3723
|
}
|
|
3724
3724
|
if (typeScriptOptions !== false) {
|
|
3725
|
-
|
|
3725
|
+
mut_configs.push(typescript({
|
|
3726
3726
|
projectRoot,
|
|
3727
3727
|
mode,
|
|
3728
3728
|
files: [GLOB_SRC, ...componentExts.map((ext) => `**/*.${ext}`)],
|
|
@@ -3734,14 +3734,14 @@ async function rsEslint(options, ...userConfigs) {
|
|
|
3734
3734
|
}));
|
|
3735
3735
|
}
|
|
3736
3736
|
if (stylisticOptions !== false) {
|
|
3737
|
-
|
|
3737
|
+
mut_configs.push(stylistic({
|
|
3738
3738
|
stylistic: stylisticOptions,
|
|
3739
3739
|
typescript: hasTypeScript,
|
|
3740
3740
|
overrides: getOverrides(options, "stylistic"),
|
|
3741
3741
|
}));
|
|
3742
3742
|
}
|
|
3743
3743
|
if (functionalEnforcement !== "none" || mode === "library") {
|
|
3744
|
-
|
|
3744
|
+
mut_configs.push(functional({
|
|
3745
3745
|
...typescriptConfigOptions,
|
|
3746
3746
|
...functionalConfigOptions,
|
|
3747
3747
|
overrides: getOverrides(options, "functional"),
|
|
@@ -3750,13 +3750,13 @@ async function rsEslint(options, ...userConfigs) {
|
|
|
3750
3750
|
}));
|
|
3751
3751
|
}
|
|
3752
3752
|
if (testOptions !== false) {
|
|
3753
|
-
|
|
3753
|
+
mut_configs.push(test({
|
|
3754
3754
|
files: GLOB_TESTS,
|
|
3755
3755
|
overrides: getOverrides(options, "test"),
|
|
3756
3756
|
}));
|
|
3757
3757
|
}
|
|
3758
3758
|
if (vueOptions !== false) {
|
|
3759
|
-
|
|
3759
|
+
mut_configs.push(vue({
|
|
3760
3760
|
...typescriptConfigOptions,
|
|
3761
3761
|
typescript: hasTypeScript,
|
|
3762
3762
|
files: [GLOB_VUE],
|
|
@@ -3769,7 +3769,7 @@ async function rsEslint(options, ...userConfigs) {
|
|
|
3769
3769
|
}));
|
|
3770
3770
|
}
|
|
3771
3771
|
if (reactOptions !== false) {
|
|
3772
|
-
|
|
3772
|
+
mut_configs.push(react({
|
|
3773
3773
|
...typescriptConfigOptions,
|
|
3774
3774
|
typescript: hasTypeScript,
|
|
3775
3775
|
files: [GLOB_SRC],
|
|
@@ -3779,13 +3779,13 @@ async function rsEslint(options, ...userConfigs) {
|
|
|
3779
3779
|
}));
|
|
3780
3780
|
}
|
|
3781
3781
|
if (tailwindOptions !== false) {
|
|
3782
|
-
|
|
3782
|
+
mut_configs.push(tailwind({
|
|
3783
3783
|
stylistic: stylisticOptions,
|
|
3784
3784
|
overrides: getOverrides(options, "tailwind"),
|
|
3785
3785
|
}));
|
|
3786
3786
|
}
|
|
3787
3787
|
if (unoCSSOptions !== false) {
|
|
3788
|
-
|
|
3788
|
+
mut_configs.push(unocss({
|
|
3789
3789
|
attributify: true,
|
|
3790
3790
|
strict: true,
|
|
3791
3791
|
...resolveSubOptions(options, "unocss"),
|
|
@@ -3793,28 +3793,28 @@ async function rsEslint(options, ...userConfigs) {
|
|
|
3793
3793
|
}));
|
|
3794
3794
|
}
|
|
3795
3795
|
if (jsoncOptions !== false) {
|
|
3796
|
-
|
|
3796
|
+
mut_configs.push(jsonc({
|
|
3797
3797
|
files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
|
|
3798
3798
|
overrides: getOverrides(options, "jsonc"),
|
|
3799
3799
|
stylistic: stylisticOptions,
|
|
3800
3800
|
}), sortTsconfig());
|
|
3801
3801
|
}
|
|
3802
3802
|
if (yamlOptions !== false) {
|
|
3803
|
-
|
|
3803
|
+
mut_configs.push(yaml({
|
|
3804
3804
|
files: [GLOB_YAML],
|
|
3805
3805
|
overrides: getOverrides(options, "yaml"),
|
|
3806
3806
|
stylistic: stylisticOptions,
|
|
3807
3807
|
}));
|
|
3808
3808
|
}
|
|
3809
3809
|
if (tomlOptions !== false) {
|
|
3810
|
-
|
|
3810
|
+
mut_configs.push(toml({
|
|
3811
3811
|
files: [GLOB_TOML],
|
|
3812
3812
|
overrides: getOverrides(options, "toml"),
|
|
3813
3813
|
stylistic: stylisticOptions,
|
|
3814
3814
|
}));
|
|
3815
3815
|
}
|
|
3816
3816
|
if (markdownOptions !== false) {
|
|
3817
|
-
|
|
3817
|
+
mut_configs.push(markdown({
|
|
3818
3818
|
enableTypeRequiredRules: !(markdownOptions === true || markdownOptions.enableTypeRequiredRules === false),
|
|
3819
3819
|
files: [GLOB_MARKDOWN],
|
|
3820
3820
|
componentExts,
|
|
@@ -3822,17 +3822,17 @@ async function rsEslint(options, ...userConfigs) {
|
|
|
3822
3822
|
}));
|
|
3823
3823
|
}
|
|
3824
3824
|
if (formattersOptions !== false) {
|
|
3825
|
-
|
|
3825
|
+
mut_configs.push(formatters(formattersOptions, stylisticOptions === false ? {} : stylisticOptions));
|
|
3826
3826
|
}
|
|
3827
3827
|
if (isInEditor) {
|
|
3828
|
-
|
|
3828
|
+
mut_configs.push(inEditor());
|
|
3829
3829
|
}
|
|
3830
|
-
|
|
3831
|
-
let
|
|
3830
|
+
mut_configs.push(overrides());
|
|
3831
|
+
let mut_composer = new FlatConfigComposer().append(...mut_configs, ...userConfigs);
|
|
3832
3832
|
if (autoRenamePlugins) {
|
|
3833
|
-
|
|
3833
|
+
mut_composer = mut_composer.renamePlugins(defaultPluginRenaming);
|
|
3834
3834
|
}
|
|
3835
|
-
return
|
|
3835
|
+
return mut_composer.toConfigs();
|
|
3836
3836
|
}
|
|
3837
3837
|
function resolveSubOptions(options, key) {
|
|
3838
3838
|
return (typeof options[key] === "boolean" || typeof options[key] === "string" ? {} : (options[key] ?? {}));
|
package/dist/index.mjs
CHANGED
|
@@ -38,28 +38,28 @@ async function loadPackages(packageIds) {
|
|
|
38
38
|
return Promise.all(packageIds.map((id) => interopDefault(import(id))));
|
|
39
39
|
}
|
|
40
40
|
const installPackagesToLoad = new Set();
|
|
41
|
-
let
|
|
42
|
-
let
|
|
43
|
-
let
|
|
41
|
+
let mut_installPackagesAction = null;
|
|
42
|
+
let mut_installPackagesActionResolver = null;
|
|
43
|
+
let mut_installPackagesTimeout = null;
|
|
44
44
|
/* eslint-disable functional/no-loop-statements */
|
|
45
45
|
async function installPackages(packages) {
|
|
46
46
|
for (const p of packages) {
|
|
47
47
|
installPackagesToLoad.add(p);
|
|
48
48
|
}
|
|
49
|
-
if (
|
|
50
|
-
clearTimeout(
|
|
49
|
+
if (mut_installPackagesTimeout !== null) {
|
|
50
|
+
clearTimeout(mut_installPackagesTimeout);
|
|
51
51
|
}
|
|
52
|
-
|
|
52
|
+
mut_installPackagesTimeout = setTimeout(() => {
|
|
53
53
|
const allPackages = [...installPackagesToLoad.values()];
|
|
54
|
-
|
|
54
|
+
mut_installPackagesTimeout = null;
|
|
55
55
|
installPackagesToLoad.clear();
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
mut_installPackagesAction = null;
|
|
57
|
+
mut_installPackagesActionResolver(allPackages);
|
|
58
|
+
mut_installPackagesActionResolver = null;
|
|
59
59
|
}, 100);
|
|
60
|
-
if (
|
|
61
|
-
|
|
62
|
-
|
|
60
|
+
if (mut_installPackagesAction === null) {
|
|
61
|
+
mut_installPackagesAction = new Promise((resolve) => {
|
|
62
|
+
mut_installPackagesActionResolver = resolve;
|
|
63
63
|
}).then(async (allPackages) => {
|
|
64
64
|
const allPackagesString = allPackages.join(", ");
|
|
65
65
|
if (Boolean(process.env["CI"]) || !process.stdout.isTTY) {
|
|
@@ -76,7 +76,7 @@ async function installPackages(packages) {
|
|
|
76
76
|
}
|
|
77
77
|
});
|
|
78
78
|
}
|
|
79
|
-
return
|
|
79
|
+
return mut_installPackagesAction;
|
|
80
80
|
}
|
|
81
81
|
/* eslint-enable functional/no-loop-statements */
|
|
82
82
|
|
|
@@ -466,7 +466,7 @@ async function formatters(opts, stylistic) {
|
|
|
466
466
|
"vue/template-curly-spacing": "off",
|
|
467
467
|
"yaml/block-sequence-hyphen-indicator-newline": "off",
|
|
468
468
|
};
|
|
469
|
-
const
|
|
469
|
+
const mut_configs = [
|
|
470
470
|
{
|
|
471
471
|
name: "rs:formatters:setup",
|
|
472
472
|
plugins: {
|
|
@@ -475,7 +475,7 @@ async function formatters(opts, stylistic) {
|
|
|
475
475
|
},
|
|
476
476
|
];
|
|
477
477
|
if (options.js !== undefined && options.js) {
|
|
478
|
-
|
|
478
|
+
mut_configs.push({
|
|
479
479
|
name: "rs:formatter:javascript",
|
|
480
480
|
files: [GLOB_JS, GLOB_JSX],
|
|
481
481
|
rules: {
|
|
@@ -491,7 +491,7 @@ async function formatters(opts, stylistic) {
|
|
|
491
491
|
});
|
|
492
492
|
}
|
|
493
493
|
if (options.ts !== undefined && options.ts) {
|
|
494
|
-
|
|
494
|
+
mut_configs.push({
|
|
495
495
|
name: "rs:formatter:typescript",
|
|
496
496
|
files: [GLOB_TS, GLOB_TSX],
|
|
497
497
|
ignores: options.dts === true ? [] : [GLOB_DTS],
|
|
@@ -508,7 +508,7 @@ async function formatters(opts, stylistic) {
|
|
|
508
508
|
});
|
|
509
509
|
}
|
|
510
510
|
if (options.yaml !== undefined && options.yaml) {
|
|
511
|
-
|
|
511
|
+
mut_configs.push({
|
|
512
512
|
name: "rs:formatter:yaml",
|
|
513
513
|
files: [GLOB_YAML],
|
|
514
514
|
languageOptions: {
|
|
@@ -527,7 +527,7 @@ async function formatters(opts, stylistic) {
|
|
|
527
527
|
});
|
|
528
528
|
}
|
|
529
529
|
if (options.json !== undefined && options.json) {
|
|
530
|
-
|
|
530
|
+
mut_configs.push({
|
|
531
531
|
name: "rs:formatter:json",
|
|
532
532
|
files: [GLOB_JSON],
|
|
533
533
|
ignores: ["**/package.json"],
|
|
@@ -637,7 +637,7 @@ async function formatters(opts, stylistic) {
|
|
|
637
637
|
});
|
|
638
638
|
}
|
|
639
639
|
if (options.css !== undefined && options.css) {
|
|
640
|
-
|
|
640
|
+
mut_configs.push({
|
|
641
641
|
name: "rs:formatter:css",
|
|
642
642
|
files: [GLOB_CSS, GLOB_POSTCSS],
|
|
643
643
|
languageOptions: {
|
|
@@ -688,7 +688,7 @@ async function formatters(opts, stylistic) {
|
|
|
688
688
|
});
|
|
689
689
|
}
|
|
690
690
|
if (options.html !== undefined && options.html) {
|
|
691
|
-
|
|
691
|
+
mut_configs.push({
|
|
692
692
|
name: "rs:formatter:html",
|
|
693
693
|
files: ["**/*.html"],
|
|
694
694
|
languageOptions: {
|
|
@@ -712,7 +712,7 @@ async function formatters(opts, stylistic) {
|
|
|
712
712
|
: options.slidev === true
|
|
713
713
|
? ["**/slides.md"]
|
|
714
714
|
: (options.slidev.files ?? []);
|
|
715
|
-
|
|
715
|
+
mut_configs.push({
|
|
716
716
|
name: "rs:formatter:markdown",
|
|
717
717
|
files: [GLOB_MARKDOWN],
|
|
718
718
|
ignores: GLOB_SLIDEV,
|
|
@@ -732,7 +732,7 @@ async function formatters(opts, stylistic) {
|
|
|
732
732
|
},
|
|
733
733
|
});
|
|
734
734
|
if (options.slidev !== undefined && options.slidev !== false) {
|
|
735
|
-
|
|
735
|
+
mut_configs.push({
|
|
736
736
|
name: "rs:formatter:slidev",
|
|
737
737
|
files: GLOB_SLIDEV,
|
|
738
738
|
languageOptions: {
|
|
@@ -754,7 +754,7 @@ async function formatters(opts, stylistic) {
|
|
|
754
754
|
}
|
|
755
755
|
}
|
|
756
756
|
if (options.graphql !== undefined && options.graphql) {
|
|
757
|
-
|
|
757
|
+
mut_configs.push({
|
|
758
758
|
files: [GLOB_GRAPHQL],
|
|
759
759
|
languageOptions: {
|
|
760
760
|
parser: parserPlain,
|
|
@@ -772,7 +772,7 @@ async function formatters(opts, stylistic) {
|
|
|
772
772
|
},
|
|
773
773
|
});
|
|
774
774
|
}
|
|
775
|
-
return
|
|
775
|
+
return mut_configs;
|
|
776
776
|
}
|
|
777
777
|
|
|
778
778
|
async function functional(options) {
|
|
@@ -824,7 +824,7 @@ async function functional(options) {
|
|
|
824
824
|
"functional/immutable-data": [
|
|
825
825
|
"error",
|
|
826
826
|
{
|
|
827
|
-
ignoreAccessorPattern: ["**.
|
|
827
|
+
ignoreAccessorPattern: ["**.mut_*.**"],
|
|
828
828
|
ignoreClasses: "fieldsOnly",
|
|
829
829
|
ignoreImmediateMutation: true,
|
|
830
830
|
ignoreNonConstDeclarations: true,
|
|
@@ -1341,7 +1341,7 @@ function javascript(options) {
|
|
|
1341
1341
|
"no-console": ["error", { allow: ["warn", "error"] }],
|
|
1342
1342
|
"no-const-assign": "error",
|
|
1343
1343
|
"no-constant-binary-expression": "error",
|
|
1344
|
-
"no-constant-condition": "error",
|
|
1344
|
+
// "no-constant-condition": "error",
|
|
1345
1345
|
"no-constructor-return": "error",
|
|
1346
1346
|
"no-control-regex": "error",
|
|
1347
1347
|
"no-debugger": "error",
|
|
@@ -1596,7 +1596,7 @@ function javascript(options) {
|
|
|
1596
1596
|
? { props: false }
|
|
1597
1597
|
: {
|
|
1598
1598
|
props: true,
|
|
1599
|
-
ignorePropertyModificationsForRegex: ["^[mM]
|
|
1599
|
+
ignorePropertyModificationsForRegex: ["^[mM]ut_"],
|
|
1600
1600
|
},
|
|
1601
1601
|
],
|
|
1602
1602
|
}),
|
|
@@ -3087,7 +3087,7 @@ async function typescript(options) {
|
|
|
3087
3087
|
selector: "variableLike",
|
|
3088
3088
|
filter: { regex: "_[^_]+", match: true },
|
|
3089
3089
|
format: ["camelCase", "PascalCase"],
|
|
3090
|
-
prefix: ["
|
|
3090
|
+
prefix: ["mut_", "Mut_"],
|
|
3091
3091
|
leadingUnderscore: "forbid",
|
|
3092
3092
|
trailingUnderscore: "forbid",
|
|
3093
3093
|
},
|
|
@@ -3100,7 +3100,7 @@ async function typescript(options) {
|
|
|
3100
3100
|
{
|
|
3101
3101
|
selector: "variable",
|
|
3102
3102
|
format: ["camelCase", "PascalCase", "UPPER_CASE"],
|
|
3103
|
-
prefix: ["
|
|
3103
|
+
prefix: ["mut_", "Mut_"],
|
|
3104
3104
|
leadingUnderscore: "forbid",
|
|
3105
3105
|
trailingUnderscore: "forbid",
|
|
3106
3106
|
},
|
|
@@ -3117,7 +3117,7 @@ async function typescript(options) {
|
|
|
3117
3117
|
filter: { regex: "_[^_]+", match: true },
|
|
3118
3118
|
format: ["camelCase", "PascalCase"],
|
|
3119
3119
|
modifiers: ["const"],
|
|
3120
|
-
prefix: ["
|
|
3120
|
+
prefix: ["mut_", "Mut_"],
|
|
3121
3121
|
leadingUnderscore: "forbid",
|
|
3122
3122
|
trailingUnderscore: "forbid",
|
|
3123
3123
|
},
|
|
@@ -3143,7 +3143,7 @@ async function typescript(options) {
|
|
|
3143
3143
|
{
|
|
3144
3144
|
selector: ["autoAccessor", "parameterProperty", "property"],
|
|
3145
3145
|
format: ["camelCase", "PascalCase"],
|
|
3146
|
-
prefix: ["
|
|
3146
|
+
prefix: ["mut_", "Mut_"],
|
|
3147
3147
|
leadingUnderscore: "forbid",
|
|
3148
3148
|
trailingUnderscore: "forbid",
|
|
3149
3149
|
},
|
|
@@ -3152,7 +3152,7 @@ async function typescript(options) {
|
|
|
3152
3152
|
filter: { regex: "_[^_]+", match: true },
|
|
3153
3153
|
format: ["camelCase", "PascalCase"],
|
|
3154
3154
|
modifiers: ["readonly"],
|
|
3155
|
-
prefix: ["
|
|
3155
|
+
prefix: ["mut_", "Mut_"],
|
|
3156
3156
|
leadingUnderscore: "forbid",
|
|
3157
3157
|
trailingUnderscore: "forbid",
|
|
3158
3158
|
},
|
|
@@ -3671,12 +3671,12 @@ async function rsEslint(options, ...userConfigs) {
|
|
|
3671
3671
|
};
|
|
3672
3672
|
const functionalConfigOptions = {
|
|
3673
3673
|
functionalEnforcement,
|
|
3674
|
-
ignoreNamePattern: ["^
|
|
3674
|
+
ignoreNamePattern: ["^[mM]ut_"],
|
|
3675
3675
|
...resolveSubOptions(options, "functional"),
|
|
3676
3676
|
};
|
|
3677
|
-
const
|
|
3677
|
+
const mut_configs = [];
|
|
3678
3678
|
// Base configs
|
|
3679
|
-
|
|
3679
|
+
mut_configs.push(ignores({
|
|
3680
3680
|
projectRoot,
|
|
3681
3681
|
ignores: ignoresOptions ?? [],
|
|
3682
3682
|
ignoreFiles: ignoresFilesOptions,
|
|
@@ -3694,13 +3694,13 @@ async function rsEslint(options, ...userConfigs) {
|
|
|
3694
3694
|
componentExts.push("vue");
|
|
3695
3695
|
}
|
|
3696
3696
|
if (sonarOptions) {
|
|
3697
|
-
|
|
3697
|
+
mut_configs.push(sonar(functionalConfigOptions));
|
|
3698
3698
|
}
|
|
3699
3699
|
if (jsxOptions) {
|
|
3700
|
-
|
|
3700
|
+
mut_configs.push(jsx());
|
|
3701
3701
|
}
|
|
3702
3702
|
if (typeScriptOptions !== false) {
|
|
3703
|
-
|
|
3703
|
+
mut_configs.push(typescript({
|
|
3704
3704
|
projectRoot,
|
|
3705
3705
|
mode,
|
|
3706
3706
|
files: [GLOB_SRC, ...componentExts.map((ext) => `**/*.${ext}`)],
|
|
@@ -3712,14 +3712,14 @@ async function rsEslint(options, ...userConfigs) {
|
|
|
3712
3712
|
}));
|
|
3713
3713
|
}
|
|
3714
3714
|
if (stylisticOptions !== false) {
|
|
3715
|
-
|
|
3715
|
+
mut_configs.push(stylistic({
|
|
3716
3716
|
stylistic: stylisticOptions,
|
|
3717
3717
|
typescript: hasTypeScript,
|
|
3718
3718
|
overrides: getOverrides(options, "stylistic"),
|
|
3719
3719
|
}));
|
|
3720
3720
|
}
|
|
3721
3721
|
if (functionalEnforcement !== "none" || mode === "library") {
|
|
3722
|
-
|
|
3722
|
+
mut_configs.push(functional({
|
|
3723
3723
|
...typescriptConfigOptions,
|
|
3724
3724
|
...functionalConfigOptions,
|
|
3725
3725
|
overrides: getOverrides(options, "functional"),
|
|
@@ -3728,13 +3728,13 @@ async function rsEslint(options, ...userConfigs) {
|
|
|
3728
3728
|
}));
|
|
3729
3729
|
}
|
|
3730
3730
|
if (testOptions !== false) {
|
|
3731
|
-
|
|
3731
|
+
mut_configs.push(test({
|
|
3732
3732
|
files: GLOB_TESTS,
|
|
3733
3733
|
overrides: getOverrides(options, "test"),
|
|
3734
3734
|
}));
|
|
3735
3735
|
}
|
|
3736
3736
|
if (vueOptions !== false) {
|
|
3737
|
-
|
|
3737
|
+
mut_configs.push(vue({
|
|
3738
3738
|
...typescriptConfigOptions,
|
|
3739
3739
|
typescript: hasTypeScript,
|
|
3740
3740
|
files: [GLOB_VUE],
|
|
@@ -3747,7 +3747,7 @@ async function rsEslint(options, ...userConfigs) {
|
|
|
3747
3747
|
}));
|
|
3748
3748
|
}
|
|
3749
3749
|
if (reactOptions !== false) {
|
|
3750
|
-
|
|
3750
|
+
mut_configs.push(react({
|
|
3751
3751
|
...typescriptConfigOptions,
|
|
3752
3752
|
typescript: hasTypeScript,
|
|
3753
3753
|
files: [GLOB_SRC],
|
|
@@ -3757,13 +3757,13 @@ async function rsEslint(options, ...userConfigs) {
|
|
|
3757
3757
|
}));
|
|
3758
3758
|
}
|
|
3759
3759
|
if (tailwindOptions !== false) {
|
|
3760
|
-
|
|
3760
|
+
mut_configs.push(tailwind({
|
|
3761
3761
|
stylistic: stylisticOptions,
|
|
3762
3762
|
overrides: getOverrides(options, "tailwind"),
|
|
3763
3763
|
}));
|
|
3764
3764
|
}
|
|
3765
3765
|
if (unoCSSOptions !== false) {
|
|
3766
|
-
|
|
3766
|
+
mut_configs.push(unocss({
|
|
3767
3767
|
attributify: true,
|
|
3768
3768
|
strict: true,
|
|
3769
3769
|
...resolveSubOptions(options, "unocss"),
|
|
@@ -3771,28 +3771,28 @@ async function rsEslint(options, ...userConfigs) {
|
|
|
3771
3771
|
}));
|
|
3772
3772
|
}
|
|
3773
3773
|
if (jsoncOptions !== false) {
|
|
3774
|
-
|
|
3774
|
+
mut_configs.push(jsonc({
|
|
3775
3775
|
files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
|
|
3776
3776
|
overrides: getOverrides(options, "jsonc"),
|
|
3777
3777
|
stylistic: stylisticOptions,
|
|
3778
3778
|
}), sortTsconfig());
|
|
3779
3779
|
}
|
|
3780
3780
|
if (yamlOptions !== false) {
|
|
3781
|
-
|
|
3781
|
+
mut_configs.push(yaml({
|
|
3782
3782
|
files: [GLOB_YAML],
|
|
3783
3783
|
overrides: getOverrides(options, "yaml"),
|
|
3784
3784
|
stylistic: stylisticOptions,
|
|
3785
3785
|
}));
|
|
3786
3786
|
}
|
|
3787
3787
|
if (tomlOptions !== false) {
|
|
3788
|
-
|
|
3788
|
+
mut_configs.push(toml({
|
|
3789
3789
|
files: [GLOB_TOML],
|
|
3790
3790
|
overrides: getOverrides(options, "toml"),
|
|
3791
3791
|
stylistic: stylisticOptions,
|
|
3792
3792
|
}));
|
|
3793
3793
|
}
|
|
3794
3794
|
if (markdownOptions !== false) {
|
|
3795
|
-
|
|
3795
|
+
mut_configs.push(markdown({
|
|
3796
3796
|
enableTypeRequiredRules: !(markdownOptions === true || markdownOptions.enableTypeRequiredRules === false),
|
|
3797
3797
|
files: [GLOB_MARKDOWN],
|
|
3798
3798
|
componentExts,
|
|
@@ -3800,17 +3800,17 @@ async function rsEslint(options, ...userConfigs) {
|
|
|
3800
3800
|
}));
|
|
3801
3801
|
}
|
|
3802
3802
|
if (formattersOptions !== false) {
|
|
3803
|
-
|
|
3803
|
+
mut_configs.push(formatters(formattersOptions, stylisticOptions === false ? {} : stylisticOptions));
|
|
3804
3804
|
}
|
|
3805
3805
|
if (isInEditor) {
|
|
3806
|
-
|
|
3806
|
+
mut_configs.push(inEditor());
|
|
3807
3807
|
}
|
|
3808
|
-
|
|
3809
|
-
let
|
|
3808
|
+
mut_configs.push(overrides());
|
|
3809
|
+
let mut_composer = new FlatConfigComposer().append(...mut_configs, ...userConfigs);
|
|
3810
3810
|
if (autoRenamePlugins) {
|
|
3811
|
-
|
|
3811
|
+
mut_composer = mut_composer.renamePlugins(defaultPluginRenaming);
|
|
3812
3812
|
}
|
|
3813
|
-
return
|
|
3813
|
+
return mut_composer.toConfigs();
|
|
3814
3814
|
}
|
|
3815
3815
|
function resolveSubOptions(options, key) {
|
|
3816
3816
|
return (typeof options[key] === "boolean" || typeof options[key] === "string" ? {} : (options[key] ?? {}));
|