@eslinted/core 29.4.6 → 29.4.8
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/factory.d.ts.map +1 -1
- package/dist/factory.js +50 -61
- package/dist/factory.js.map +1 -1
- package/package.json +1 -1
- package/src/factory.ts +96 -91
package/dist/factory.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../src/factory.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,IAAI,MAAM,GAAG,CAAC;AAG1B,MAAM,CAAC,OAAO,UAAU,OAAO,CAC7B,KAAK,SAAS,MAAM,EACpB,QAAQ,SAAS,KAAK,EACtB,cAAc,SAAS,MAAM,EAC7B,cAAc,SAAS,KAAK,EAC5B,MAAM,SAAS,cAAc,GAAG,QAAQ,EAExC,MAAM,EAAE,UAAU,CAAC,OAAO,IAAI,CAAC,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,EAC3F,QAAQ,EAAE,UAAU,CAAC,OAAO,IAAI,CAAC,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,EAC7F,IAAI,EAAE,UAAU,CAAC,OAAO,IAAI,CAAC,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,EACzF,EACE,OAAO,EACP,OAAO,GACR,EAAE,UAAU,CAAC,OAAO,IAAI,CAAC,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,EACtF,QAAQ,EAAE,UAAU,CAAC,OAAO,IAAI,CAAC,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC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AE,QAAQ,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,6CAgJvF"}
|
package/dist/factory.js
CHANGED
|
@@ -1,84 +1,73 @@
|
|
|
1
1
|
import { defineConfig, globalIgnores, } from "@eslint/config-helpers";
|
|
2
2
|
export default function factory(scopes, optional, tree, { plugins, parsers, }, settings, { defaults, extensions = {}, }) {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
const Scopes = new Set(scopes), OptionalScopes = new Set(optional), RequiredScopes = Scopes.difference(OptionalScopes), ExtendedScopes = new Set(Object.keys(extensions))
|
|
4
|
+
.intersection(Scopes), ExtendedOptionalScopes = ExtendedScopes
|
|
5
|
+
.intersection(OptionalScopes), ConfiguredScopes = RequiredScopes
|
|
6
|
+
.union(ExtendedOptionalScopes);
|
|
7
|
+
for (const scope of ExtendedOptionalScopes) {
|
|
8
|
+
plugins[scope] = extensions[scope].plugin;
|
|
9
|
+
parsers[scope] = extensions[scope].parser;
|
|
10
|
+
}
|
|
11
|
+
for (const scope of ExtendedScopes) {
|
|
10
12
|
const { [scope]: { files, ignores, rules, } = {}, } = extensions;
|
|
11
13
|
if (files !== undefined)
|
|
12
|
-
void defaults
|
|
13
|
-
.files[scope]
|
|
14
|
-
.push(...files);
|
|
14
|
+
void defaults.files[scope].push(...files);
|
|
15
15
|
if (ignores !== undefined)
|
|
16
16
|
if (defaults.ignores[scope] === undefined)
|
|
17
17
|
defaults.ignores[scope] = ignores;
|
|
18
18
|
else
|
|
19
|
-
void defaults
|
|
20
|
-
.ignores[scope]
|
|
21
|
-
.push(...ignores);
|
|
19
|
+
void defaults.ignores[scope].push(...ignores);
|
|
22
20
|
if (rules !== undefined)
|
|
23
21
|
defaults.rules[scope][defaults.rules[scope].length] = { rules };
|
|
24
22
|
}
|
|
25
23
|
for (const [scope, parents] of tree)
|
|
26
|
-
if (
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
.files[parent]
|
|
31
|
-
.push(...defaults.files[scope]);
|
|
24
|
+
if (ConfiguredScopes.has(scope)
|
|
25
|
+
&& defaults.files[scope].length !== 0)
|
|
26
|
+
for (const parent of parents)
|
|
27
|
+
void defaults.files[parent].push(...defaults.files[scope]);
|
|
32
28
|
if (extensions["*"] !== undefined)
|
|
33
29
|
if (extensions["*"].override === true
|
|
34
30
|
|| defaults.ignores["*"] === undefined)
|
|
35
31
|
defaults.ignores["*"] = extensions["*"].ignores ?? [];
|
|
36
|
-
else if (extensions["*"].ignores !== undefined
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
return defineConfig({
|
|
45
|
-
plugins,
|
|
46
|
-
}, defaults.ignores["*"] === undefined
|
|
47
|
-
? []
|
|
48
|
-
: globalIgnores(defaults.ignores["*"]), active
|
|
49
|
-
.filter(scope => settings[scope] !== undefined)
|
|
32
|
+
else if (extensions["*"].ignores !== undefined
|
|
33
|
+
&& extensions["*"].ignores.length !== 0)
|
|
34
|
+
void defaults.ignores["*"].push(...extensions["*"].ignores);
|
|
35
|
+
const enabledScopes = scopes
|
|
36
|
+
.filter(scope => ConfiguredScopes.has(scope))
|
|
37
|
+
.filter(scope => defaults.files[scope].length !== 0)
|
|
38
|
+
.filter(scope => defaults.rules[scope].length !== 0);
|
|
39
|
+
return defineConfig({ plugins }, globalIgnores(defaults.ignores["*"] ?? []), enabledScopes
|
|
50
40
|
.map(scope => {
|
|
51
|
-
const
|
|
52
|
-
if (
|
|
53
|
-
languageOptions
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
languageOptions
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
41
|
+
const definition = {};
|
|
42
|
+
if (settings[scope] !== undefined) {
|
|
43
|
+
const { languageOptions, parserOptions, processor, language, } = settings[scope];
|
|
44
|
+
if (languageOptions?.parser !== undefined)
|
|
45
|
+
languageOptions.parser = parsers[languageOptions.parser];
|
|
46
|
+
if (parserOptions?.parser !== undefined)
|
|
47
|
+
parserOptions.parser = parsers[parserOptions.parser];
|
|
48
|
+
if (parserOptions === undefined) {
|
|
49
|
+
if (languageOptions !== undefined)
|
|
50
|
+
definition.languageOptions = languageOptions;
|
|
51
|
+
}
|
|
52
|
+
else if (languageOptions === undefined)
|
|
53
|
+
definition.languageOptions = {
|
|
54
|
+
parserOptions,
|
|
55
|
+
};
|
|
56
|
+
else
|
|
57
|
+
definition.languageOptions = Object.assign(languageOptions, { parserOptions });
|
|
58
|
+
if (processor !== undefined)
|
|
59
|
+
definition.processor = processor;
|
|
60
|
+
if (language !== undefined)
|
|
61
|
+
definition.language = language;
|
|
62
|
+
}
|
|
73
63
|
return {
|
|
74
64
|
files: defaults.files[scope],
|
|
75
65
|
ignores: defaults.ignores[scope] ?? [],
|
|
76
|
-
"extends": [
|
|
66
|
+
"extends": [
|
|
67
|
+
Object.keys(definition).length === 0 ? [] : definition,
|
|
68
|
+
defaults.rules[scope],
|
|
69
|
+
],
|
|
77
70
|
};
|
|
78
|
-
})
|
|
79
|
-
files: defaults.files[scope],
|
|
80
|
-
ignores: defaults.ignores[scope] ?? [],
|
|
81
|
-
"extends": [defaults.rules[scope]],
|
|
82
|
-
})));
|
|
71
|
+
}));
|
|
83
72
|
}
|
|
84
73
|
//# sourceMappingURL=factory.js.map
|
package/dist/factory.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory.js","sourceRoot":"","sources":["../src/factory.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,aAAa,GACd,MAAM,wBAAwB,CAAC;AAIhC,MAA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AAe,GAAG,eAAe,CAAC;YACjD,CAAC;iBAGC,IAAI,eAAe,KAAK,SAAS;gBAE/B,UAAU,CAAC,eAAe,GAAG;oBAC3B,aAAa;iBACd,CAAC;;gBAGF,UAAU,CAAC,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC,eAAe,EAAE,EAAE,aAAa,EAAE,CAAC,CAAC;YAEnF,IAAI,SAAS,KAAK,SAAS;gBACxB,UAAwD,CAAC,SAAS,GAAG,SAAS,CAAC;YAElF,IAAI,QAAQ,KAAK,SAAS;gBACvB,UAAuD,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACjF,CAAC;QAED,OAAO;YACL,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC;YAC5B,OAAO,EAAE,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE;YACtC,SAAS,EAAE;gBACT,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU;gBACtD,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAyE;aAC9F;SACF,CAAC;IACJ,CAAC,CACF,CACJ,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"$schema": "https://json.schemastore.org/package",
|
|
4
4
|
"$help": "https://docs.npmjs.com/cli/configuring-npm/package-json",
|
|
5
5
|
"name": "@eslinted/core",
|
|
6
|
-
"version": "29.4.
|
|
6
|
+
"version": "29.4.8",
|
|
7
7
|
"repository": "github:jimmy-zhening-luo/linted-core",
|
|
8
8
|
"description": "Internal core for npm package `linted`, responsible for producing an array of fully-formed ESLint configurations according to `linted` spec.",
|
|
9
9
|
"keywords": [],
|
package/src/factory.ts
CHANGED
|
@@ -25,23 +25,25 @@ export default function factory<
|
|
|
25
25
|
extensions = {},
|
|
26
26
|
}: Parameters<typeof Core<Scope, Optional, RequiredPlugin, RequiredParser, Parser>>[5],
|
|
27
27
|
) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
28
|
+
const Scopes = new Set(scopes),
|
|
29
|
+
OptionalScopes = new Set(optional),
|
|
30
|
+
RequiredScopes = Scopes.difference(OptionalScopes),
|
|
31
|
+
ExtendedScopes = new Set(
|
|
32
|
+
Object.keys(extensions) as Scope[],
|
|
33
|
+
)
|
|
34
|
+
.intersection(Scopes),
|
|
35
|
+
ExtendedOptionalScopes = ExtendedScopes
|
|
36
|
+
.intersection(OptionalScopes),
|
|
37
|
+
ConfiguredScopes = RequiredScopes
|
|
38
|
+
.union(ExtendedOptionalScopes);
|
|
39
|
+
|
|
40
|
+
for (const scope of ExtendedOptionalScopes) {
|
|
41
|
+
/* eslint-disable no-param-reassign */
|
|
42
|
+
plugins[scope] = extensions[scope]!.plugin as typeof plugins[Optional];
|
|
43
|
+
parsers[scope] = extensions[scope]!.parser as typeof parsers[Optional];
|
|
44
|
+
}
|
|
43
45
|
|
|
44
|
-
for (const scope of
|
|
46
|
+
for (const scope of ExtendedScopes) {
|
|
45
47
|
const {
|
|
46
48
|
[scope]: {
|
|
47
49
|
files,
|
|
@@ -51,18 +53,18 @@ export default function factory<
|
|
|
51
53
|
} = extensions;
|
|
52
54
|
|
|
53
55
|
if (files !== undefined)
|
|
54
|
-
void defaults
|
|
55
|
-
|
|
56
|
-
|
|
56
|
+
void defaults.files[scope].push(
|
|
57
|
+
...files,
|
|
58
|
+
);
|
|
57
59
|
|
|
58
60
|
if (ignores !== undefined)
|
|
59
61
|
if (defaults.ignores[scope] === undefined)
|
|
60
62
|
/* eslint-disable no-param-reassign */
|
|
61
63
|
defaults.ignores[scope] = ignores;
|
|
62
64
|
else
|
|
63
|
-
void defaults
|
|
64
|
-
|
|
65
|
-
|
|
65
|
+
void defaults.ignores[scope].push(
|
|
66
|
+
...ignores,
|
|
67
|
+
);
|
|
66
68
|
|
|
67
69
|
if (rules !== undefined)
|
|
68
70
|
/* eslint-disable no-param-reassign */
|
|
@@ -72,12 +74,14 @@ export default function factory<
|
|
|
72
74
|
}
|
|
73
75
|
|
|
74
76
|
for (const [scope, parents] of tree)
|
|
75
|
-
if (
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
77
|
+
if (
|
|
78
|
+
ConfiguredScopes.has(scope)
|
|
79
|
+
&& defaults.files[scope].length !== 0
|
|
80
|
+
)
|
|
81
|
+
for (const parent of parents)
|
|
82
|
+
void defaults.files[parent].push(
|
|
83
|
+
...defaults.files[scope],
|
|
84
|
+
);
|
|
81
85
|
|
|
82
86
|
if (extensions["*"] !== undefined)
|
|
83
87
|
if (
|
|
@@ -86,80 +90,81 @@ export default function factory<
|
|
|
86
90
|
)
|
|
87
91
|
defaults.ignores["*"] = extensions["*"].ignores ?? [];
|
|
88
92
|
else
|
|
89
|
-
if (
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
93
|
+
if (
|
|
94
|
+
extensions["*"].ignores !== undefined
|
|
95
|
+
&& extensions["*"].ignores.length !== 0
|
|
96
|
+
)
|
|
97
|
+
void defaults.ignores["*"].push(
|
|
98
|
+
...extensions["*"].ignores,
|
|
99
|
+
);
|
|
100
|
+
|
|
101
|
+
const enabledScopes = scopes
|
|
102
|
+
.filter(scope => ConfiguredScopes.has(scope))
|
|
103
|
+
.filter(scope => defaults.files[scope].length !== 0)
|
|
104
|
+
.filter(scope => defaults.rules[scope].length !== 0);
|
|
100
105
|
|
|
101
106
|
return defineConfig(
|
|
102
|
-
{
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
defaults.ignores["*"] === undefined
|
|
106
|
-
? []
|
|
107
|
-
: globalIgnores(defaults.ignores["*"]),
|
|
108
|
-
active
|
|
109
|
-
.filter(
|
|
110
|
-
scope => settings[scope] !== undefined,
|
|
111
|
-
)
|
|
107
|
+
{ plugins },
|
|
108
|
+
globalIgnores(defaults.ignores["*"] ?? []),
|
|
109
|
+
enabledScopes
|
|
112
110
|
.map(
|
|
113
111
|
scope => {
|
|
114
|
-
const {
|
|
115
|
-
languageOptions
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
language,
|
|
119
|
-
} = settings[scope]!;
|
|
120
|
-
|
|
121
|
-
if (languageOptions?.parser !== undefined)
|
|
122
|
-
languageOptions.parser = parsers[languageOptions.parser] as Parser;
|
|
123
|
-
|
|
124
|
-
if (parserOptions?.parser !== undefined)
|
|
125
|
-
parserOptions.parser = parsers[parserOptions.parser] as Parser;
|
|
126
|
-
|
|
127
|
-
const definition = languageOptions === undefined
|
|
128
|
-
? parserOptions === undefined
|
|
129
|
-
? {}
|
|
130
|
-
: {
|
|
131
|
-
languageOptions: {
|
|
132
|
-
parserOptions,
|
|
133
|
-
},
|
|
134
|
-
}
|
|
135
|
-
: {
|
|
136
|
-
languageOptions: parserOptions === undefined
|
|
137
|
-
? languageOptions
|
|
138
|
-
: Object.assign(
|
|
139
|
-
languageOptions,
|
|
140
|
-
{ parserOptions },
|
|
141
|
-
),
|
|
112
|
+
const definition: {
|
|
113
|
+
languageOptions?: {
|
|
114
|
+
parserOptions?: {
|
|
115
|
+
parser?: Parser;
|
|
142
116
|
};
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
117
|
+
parser?: Parser;
|
|
118
|
+
};
|
|
119
|
+
processor?: string;
|
|
120
|
+
language?: string;
|
|
121
|
+
} = {};
|
|
122
|
+
|
|
123
|
+
if (settings[scope] !== undefined) {
|
|
124
|
+
const {
|
|
125
|
+
languageOptions,
|
|
126
|
+
parserOptions,
|
|
127
|
+
processor,
|
|
128
|
+
language,
|
|
129
|
+
} = settings[scope];
|
|
130
|
+
|
|
131
|
+
if (languageOptions?.parser !== undefined)
|
|
132
|
+
languageOptions.parser = parsers[languageOptions.parser] as Parser;
|
|
133
|
+
|
|
134
|
+
if (parserOptions?.parser !== undefined)
|
|
135
|
+
parserOptions.parser = parsers[parserOptions.parser] as Parser;
|
|
136
|
+
|
|
137
|
+
if (parserOptions === undefined) {
|
|
138
|
+
if (languageOptions !== undefined)
|
|
139
|
+
definition.languageOptions = languageOptions;
|
|
140
|
+
}
|
|
141
|
+
else
|
|
142
|
+
// parser YES
|
|
143
|
+
if (languageOptions === undefined)
|
|
144
|
+
// language NO parser YES
|
|
145
|
+
definition.languageOptions = {
|
|
146
|
+
parserOptions,
|
|
147
|
+
};
|
|
148
|
+
else
|
|
149
|
+
// language YES parser YES
|
|
150
|
+
definition.languageOptions = Object.assign(languageOptions, { parserOptions });
|
|
151
|
+
|
|
152
|
+
if (processor !== undefined)
|
|
153
|
+
(definition as typeof definition & { processor: string }).processor = processor;
|
|
154
|
+
|
|
155
|
+
if (language !== undefined)
|
|
156
|
+
(definition as typeof definition & { language: string }).language = language;
|
|
157
|
+
}
|
|
149
158
|
|
|
150
159
|
return {
|
|
151
160
|
files: defaults.files[scope],
|
|
152
161
|
ignores: defaults.ignores[scope] ?? [],
|
|
153
|
-
"extends": [
|
|
162
|
+
"extends": [
|
|
163
|
+
Object.keys(definition).length === 0 ? [] : definition,
|
|
164
|
+
defaults.rules[scope] as MutableRuleConfigs<NonNullable<typeof defaults.rules[typeof scope]>>,
|
|
165
|
+
],
|
|
154
166
|
};
|
|
155
167
|
},
|
|
156
168
|
),
|
|
157
|
-
active.map(
|
|
158
|
-
scope => ({
|
|
159
|
-
files: defaults.files[scope],
|
|
160
|
-
ignores: defaults.ignores[scope] ?? [],
|
|
161
|
-
"extends": [defaults.rules[scope] as MutableRuleConfigs<NonNullable<typeof defaults.rules[typeof scope]>>],
|
|
162
|
-
}),
|
|
163
|
-
),
|
|
164
169
|
);
|
|
165
170
|
}
|