@eslinted/core 18.11.0 → 18.11.2
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/index.d.ts.map +1 -1
- package/dist/factory/index.js +90 -19
- package/dist/factory/index.js.map +1 -1
- package/package.json +1 -1
- package/src/factory/index.ts +133 -37
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/factory/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,KAAK,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/factory/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,KAAK,EACV,KAAK,EACL,IAAI,IAAI,IAAI,EACb,MAAM,WAAW,CAAC;AAEnB,qBAAa,OAAO;IAMT,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC;IALtC,MAAM;;;;;;;;;;;;;;;;MAAC;IACP,MAAM;;;;MAAC;gBAGZ,IAAI,EAAE,OAAO,IAAI,EACV,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,EAC3C,QAAQ,EAAE,KAAK,CAAC,UAAU,CAAC,EAC3B,EACE,GAAG,EAAE,eAAoB,EACzB,GAAG,eAAe,EACnB,GAAE,KAAK,CAAC,YAAY,CAAM;IAsG7B,IAAW,OAAO;;;;;;;;;;;;;OAWjB;IAEM,KAAK,CAAC,KAAK,EAAE,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBA2D+C,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBAAvB,MAAM,CAAC,MAAM,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;;;;;;;;;;;;;;;;;;;sBAAvB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBAAvB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBAAvB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBAAvB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBAAvB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;CA6ChG"}
|
package/dist/factory/index.js
CHANGED
@@ -6,48 +6,101 @@ export class Factory {
|
|
6
6
|
scopes;
|
7
7
|
constructor(tree, parsers, defaults, { "*": globalExtension = {}, ...scopeExtensions } = {}) {
|
8
8
|
this.parsers = parsers;
|
9
|
-
const { noInlineConfig = defaults
|
9
|
+
const { noInlineConfig = defaults
|
10
|
+
.settings
|
11
|
+
.noInlineConfig, reportUnusedDisableDirectives = defaults
|
12
|
+
.settings
|
13
|
+
.reportUnusedDisableDirectives, sourceType = defaults
|
14
|
+
.settings
|
15
|
+
.sourceType, ecmaVersion = defaults
|
16
|
+
.settings
|
17
|
+
.ecmaVersion, ignores = [], override = false, } = globalExtension;
|
10
18
|
this.global = {
|
11
19
|
settings: {
|
12
20
|
name: "linted/*/settings/",
|
13
|
-
linterOptions: {
|
14
|
-
|
21
|
+
linterOptions: {
|
22
|
+
noInlineConfig,
|
23
|
+
reportUnusedDisableDirectives,
|
24
|
+
},
|
25
|
+
languageOptions: {
|
26
|
+
sourceType,
|
27
|
+
ecmaVersion,
|
28
|
+
},
|
15
29
|
},
|
16
30
|
ignores: {
|
17
31
|
name: "linted/*/ignores/",
|
18
32
|
ignores: [
|
19
|
-
...override
|
33
|
+
...override
|
34
|
+
? []
|
35
|
+
: defaults
|
36
|
+
.ignores["*"],
|
20
37
|
...ignores,
|
21
38
|
],
|
22
39
|
},
|
23
40
|
};
|
24
41
|
this.scopes = {
|
25
|
-
files: defaults
|
26
|
-
|
27
|
-
|
42
|
+
files: defaults
|
43
|
+
.files,
|
44
|
+
ignores: defaults
|
45
|
+
.ignores,
|
46
|
+
rules: defaults
|
47
|
+
.rules,
|
28
48
|
};
|
29
49
|
for (const scope in scopeExtensions) {
|
30
50
|
const { [scope]: { files: userFiles = [], ignores: userIgnores = [], rules: userRules = null, } = {}, } = scopeExtensions;
|
31
|
-
this
|
32
|
-
|
51
|
+
this
|
52
|
+
.scopes
|
53
|
+
.files[scope]
|
54
|
+
.push(...userFiles);
|
55
|
+
this
|
56
|
+
.scopes
|
57
|
+
.ignores[scope]
|
58
|
+
.push(...userIgnores);
|
33
59
|
if (userRules !== null)
|
34
|
-
this
|
60
|
+
this
|
61
|
+
.scopes
|
62
|
+
.rules[scope]
|
63
|
+
.push({
|
64
|
+
id: scope + "/override",
|
65
|
+
rules: userRules,
|
66
|
+
});
|
35
67
|
}
|
36
68
|
for (const [scope, parents] of tree)
|
37
69
|
for (const parent of parents) {
|
38
|
-
this
|
39
|
-
|
70
|
+
this
|
71
|
+
.scopes
|
72
|
+
.files[parent]
|
73
|
+
.push(...this
|
74
|
+
.scopes
|
75
|
+
.files[scope]);
|
76
|
+
this
|
77
|
+
.scopes
|
78
|
+
.ignores[parent]
|
79
|
+
.push(...this
|
80
|
+
.scopes
|
81
|
+
.ignores[scope]);
|
40
82
|
}
|
41
83
|
}
|
42
84
|
get globals() {
|
43
|
-
const { settings, ignores, } = this
|
85
|
+
const { settings, ignores, } = this
|
86
|
+
.global;
|
44
87
|
return [
|
45
88
|
settings,
|
46
89
|
ignores,
|
47
90
|
];
|
48
91
|
}
|
49
92
|
scope(scope) {
|
50
|
-
const { files: { [scope]: files }, ignores: { [scope]: ignores }, rules: { [scope]: rules }, } = this.scopes, ruleset = rules
|
93
|
+
const { files: { [scope]: files, }, ignores: { [scope]: ignores, }, rules: { [scope]: rules, }, } = this.scopes, ruleset = rules
|
94
|
+
.map(({ id, rules, }) => {
|
95
|
+
return {
|
96
|
+
id: [
|
97
|
+
scope,
|
98
|
+
id,
|
99
|
+
]
|
100
|
+
.join("/"),
|
101
|
+
rules,
|
102
|
+
};
|
103
|
+
}), { languageOptions: { parser = null, globals: global = null, ...languageOptionsStatic }, parserOptions: { parser: subparser = null, ...parserOptionsStatic }, processor, language, } = new ScopeManifests[scope]();
|
51
104
|
return files.length === 0
|
52
105
|
? []
|
53
106
|
: ruleset.length === 0
|
@@ -59,21 +112,39 @@ export class Factory {
|
|
59
112
|
ignores,
|
60
113
|
languageOptions: {
|
61
114
|
...languageOptionsStatic,
|
62
|
-
...global === null
|
63
|
-
|
64
|
-
|
115
|
+
...global === null
|
116
|
+
|| !(global in globals)
|
117
|
+
? {}
|
118
|
+
: {
|
119
|
+
globals: globals[global],
|
120
|
+
},
|
121
|
+
...parser === null
|
122
|
+
? {}
|
123
|
+
: {
|
124
|
+
parser: this
|
125
|
+
.parsers[parser],
|
126
|
+
},
|
127
|
+
...Object
|
128
|
+
.keys(parserOptionsStatic)
|
129
|
+
.length < 1
|
130
|
+
&& subparser === null
|
65
131
|
? {}
|
66
132
|
: {
|
67
133
|
parserOptions: {
|
68
134
|
...parserOptionsStatic,
|
69
|
-
...subparser === null
|
135
|
+
...subparser === null
|
136
|
+
? {}
|
137
|
+
: {
|
138
|
+
parser: this
|
139
|
+
.parsers[subparser],
|
140
|
+
},
|
70
141
|
},
|
71
142
|
},
|
72
143
|
},
|
73
144
|
...processor,
|
74
145
|
...language,
|
75
146
|
},
|
76
|
-
...ruleset.map(({ id, rules }) => {
|
147
|
+
...ruleset.map(({ id, rules, }) => {
|
77
148
|
return {
|
78
149
|
name: `linted/${id}/`,
|
79
150
|
files,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/factory/index.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/factory/index.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAO7C,MAAM,OAAO,OAAO;IAMT;IALF,MAAM,CAAC;IACP,MAAM,CAAC;IAEd,YACE,IAAiB,EACV,OAAoC,EAC3C,QAA2B,EAC3B,EACE,GAAG,EAAE,eAAe,GAAG,EAAE,EACzB,GAAG,eAAe,KACK,EAAE;QALpB,YAAO,GAAP,OAAO,CAA6B;QAO3C,MAAM,EACJ,cAAc,GAAG,QAAQ;aACtB,QAAQ;aACR,cAAc,EACjB,6BAA6B,GAAG,QAAQ;aACrC,QAAQ;aACR,6BAA6B,EAChC,UAAU,GAAG,QAAQ;aAClB,QAAQ;aACR,UAAU,EACb,WAAW,GAAG,QAAQ;aACnB,QAAQ;aACR,WAAW,EACd,OAAO,GAAG,EAAE,EACZ,QAAQ,GAAG,KAAK,GACjB,GAAG,eAAe,CAAC;QAEpB,IAAI,CAAC,MAAM,GAAG;YACZ,QAAQ,EAAE;gBACR,IAAI,EAAE,oBAA6B;gBACnC,aAAa,EAAE;oBACb,cAAc;oBACd,6BAA6B;iBAC9B;gBACD,eAAe,EAAE;oBACf,UAAU;oBACV,WAAW;iBACZ;aACF;YACD,OAAO,EAAE;gBACP,IAAI,EAAE,mBAA4B;gBAClC,OAAO,EAAE;oBACP,GAAG,QAAQ;wBACT,CAAC,CAAC,EAAE;wBACJ,CAAC,CAAC,QAAQ;6BACP,OAAO,CAAC,GAAG,CAAC;oBACjB,GAAG,OAAO;iBACX;aACF;SACF,CAAC;QACF,IAAI,CAAC,MAAM,GAAG;YACZ,KAAK,EAAE,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,IAAI;gCAChB,CAAC,CAAC,EAAE;gCACJ,CAAC,CAAC;oCACE,MAAM,EAAE,IAAI;yCACT,OAAO,CAAC,MAAM,CAAC;iCACnB;4BACL,GAAG,MAAM;iCACN,IAAI,CAAC,mBAAmB,CAAC;iCACzB,MAAM,GAAG,CAAC;mCACR,SAAS,KAAK,IAAI;gCACrB,CAAC,CAAC,EAAE;gCACJ,CAAC,CAAC;oCACE,aAAa,EAAE;wCACb,GAAG,mBAAmB;wCACtB,GAAG,SAAS,KAAK,IAAI;4CACnB,CAAC,CAAC,EAAE;4CACJ,CAAC,CAAC;gDACE,MAAM,EAAE,IAAI;qDACT,OAAO,CAAC,SAAS,CAAC;6CACtB;qCACN;iCACF;yBACN;wBACD,GAAG,SAAS;wBACZ,GAAG,QAAQ;qBACZ;oBACD,GAAG,OAAO,CAAC,GAAG,CACZ,CACE,EACE,EAAE,EACF,KAAK,GACN,EACD,EAAE;wBACF,OAAO;4BACL,IAAI,EAAE,UAAU,EAAE,GAAY;4BAC9B,KAAK;4BACL,OAAO;4BACP,KAAK;yBACN,CAAC;oBACJ,CAAC,CACF;iBACF,CAAC;IACV,CAAC;CACF"}
|
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": "18.11.
|
6
|
+
"version": "18.11.2",
|
7
7
|
"repository": "github:jimmy-zhening-luo/linted-core",
|
8
8
|
"private": false,
|
9
9
|
"engineStrict": true,
|
package/src/factory/index.ts
CHANGED
@@ -1,7 +1,10 @@
|
|
1
1
|
import globals from "globals";
|
2
2
|
import { ScopeManifests } from "./manifests";
|
3
3
|
import type { Input } from "../interface";
|
4
|
-
import type {
|
4
|
+
import type {
|
5
|
+
Scope,
|
6
|
+
tree as Tree,
|
7
|
+
} from "../scopes";
|
5
8
|
|
6
9
|
export class Factory {
|
7
10
|
public global;
|
@@ -17,10 +20,18 @@ export class Factory {
|
|
17
20
|
}: Input["extensions"] = {},
|
18
21
|
) {
|
19
22
|
const {
|
20
|
-
noInlineConfig = defaults
|
21
|
-
|
22
|
-
|
23
|
-
|
23
|
+
noInlineConfig = defaults
|
24
|
+
.settings
|
25
|
+
.noInlineConfig,
|
26
|
+
reportUnusedDisableDirectives = defaults
|
27
|
+
.settings
|
28
|
+
.reportUnusedDisableDirectives,
|
29
|
+
sourceType = defaults
|
30
|
+
.settings
|
31
|
+
.sourceType,
|
32
|
+
ecmaVersion = defaults
|
33
|
+
.settings
|
34
|
+
.ecmaVersion,
|
24
35
|
ignores = [],
|
25
36
|
override = false,
|
26
37
|
} = globalExtension;
|
@@ -28,21 +39,33 @@ export class Factory {
|
|
28
39
|
this.global = {
|
29
40
|
settings: {
|
30
41
|
name: "linted/*/settings/" as const,
|
31
|
-
linterOptions: {
|
32
|
-
|
42
|
+
linterOptions: {
|
43
|
+
noInlineConfig,
|
44
|
+
reportUnusedDisableDirectives,
|
45
|
+
},
|
46
|
+
languageOptions: {
|
47
|
+
sourceType,
|
48
|
+
ecmaVersion,
|
49
|
+
},
|
33
50
|
},
|
34
51
|
ignores: {
|
35
52
|
name: "linted/*/ignores/" as const,
|
36
53
|
ignores: [
|
37
|
-
...override
|
54
|
+
...override
|
55
|
+
? []
|
56
|
+
: defaults
|
57
|
+
.ignores["*"],
|
38
58
|
...ignores,
|
39
59
|
],
|
40
60
|
},
|
41
61
|
};
|
42
62
|
this.scopes = {
|
43
|
-
files: defaults
|
44
|
-
|
45
|
-
|
63
|
+
files: defaults
|
64
|
+
.files,
|
65
|
+
ignores: defaults
|
66
|
+
.ignores,
|
67
|
+
rules: defaults
|
68
|
+
.rules,
|
46
69
|
};
|
47
70
|
|
48
71
|
for (const scope in scopeExtensions) {
|
@@ -54,21 +77,45 @@ export class Factory {
|
|
54
77
|
} = {},
|
55
78
|
} = scopeExtensions;
|
56
79
|
|
57
|
-
this
|
58
|
-
|
80
|
+
this
|
81
|
+
.scopes
|
82
|
+
.files[scope as keyof typeof scopeExtensions]
|
83
|
+
.push(...userFiles);
|
84
|
+
this
|
85
|
+
.scopes
|
86
|
+
.ignores[scope as keyof typeof scopeExtensions]
|
87
|
+
.push(...userIgnores);
|
59
88
|
|
60
89
|
if (userRules !== null)
|
61
|
-
this
|
90
|
+
this
|
91
|
+
.scopes
|
92
|
+
.rules[scope as keyof typeof scopeExtensions]
|
93
|
+
.push(
|
94
|
+
{
|
95
|
+
id: scope + "/override",
|
96
|
+
rules: userRules,
|
97
|
+
},
|
98
|
+
);
|
62
99
|
}
|
63
100
|
|
64
101
|
for (const [scope, parents] of tree)
|
65
102
|
for (const parent of parents) {
|
66
|
-
this
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
103
|
+
this
|
104
|
+
.scopes
|
105
|
+
.files[parent]
|
106
|
+
.push(
|
107
|
+
...this
|
108
|
+
.scopes
|
109
|
+
.files[scope],
|
110
|
+
);
|
111
|
+
this
|
112
|
+
.scopes
|
113
|
+
.ignores[parent]
|
114
|
+
.push(
|
115
|
+
...this
|
116
|
+
.scopes
|
117
|
+
.ignores[scope],
|
118
|
+
);
|
72
119
|
}
|
73
120
|
}
|
74
121
|
|
@@ -76,7 +123,8 @@ export class Factory {
|
|
76
123
|
const {
|
77
124
|
settings,
|
78
125
|
ignores,
|
79
|
-
} = this
|
126
|
+
} = this
|
127
|
+
.global;
|
80
128
|
|
81
129
|
return [
|
82
130
|
settings,
|
@@ -86,11 +134,34 @@ export class Factory {
|
|
86
134
|
|
87
135
|
public scope(scope: Scope) {
|
88
136
|
const {
|
89
|
-
files: {
|
90
|
-
|
91
|
-
|
137
|
+
files: {
|
138
|
+
[scope]: files,
|
139
|
+
},
|
140
|
+
ignores: {
|
141
|
+
[scope]: ignores,
|
142
|
+
},
|
143
|
+
rules: {
|
144
|
+
[scope]: rules,
|
145
|
+
},
|
92
146
|
} = this.scopes,
|
93
|
-
ruleset = rules
|
147
|
+
ruleset = rules
|
148
|
+
.map(
|
149
|
+
(
|
150
|
+
{
|
151
|
+
id,
|
152
|
+
rules,
|
153
|
+
},
|
154
|
+
) => {
|
155
|
+
return {
|
156
|
+
id: [
|
157
|
+
scope,
|
158
|
+
id,
|
159
|
+
]
|
160
|
+
.join("/"),
|
161
|
+
rules,
|
162
|
+
};
|
163
|
+
},
|
164
|
+
),
|
94
165
|
{
|
95
166
|
languageOptions: {
|
96
167
|
parser = null,
|
@@ -116,28 +187,53 @@ export class Factory {
|
|
116
187
|
ignores,
|
117
188
|
languageOptions: {
|
118
189
|
...languageOptionsStatic,
|
119
|
-
...global === null
|
120
|
-
|
121
|
-
|
190
|
+
...global === null
|
191
|
+
|| !(global in globals)
|
192
|
+
? {}
|
193
|
+
: {
|
194
|
+
globals: globals[global as keyof typeof globals] as Record<string, boolean>,
|
195
|
+
},
|
196
|
+
...parser === null
|
197
|
+
? {}
|
198
|
+
: {
|
199
|
+
parser: this
|
200
|
+
.parsers[parser],
|
201
|
+
},
|
202
|
+
...Object
|
203
|
+
.keys(parserOptionsStatic)
|
204
|
+
.length < 1
|
205
|
+
&& subparser === null
|
122
206
|
? {}
|
123
207
|
: {
|
124
208
|
parserOptions: {
|
125
209
|
...parserOptionsStatic,
|
126
|
-
...subparser === null
|
210
|
+
...subparser === null
|
211
|
+
? {}
|
212
|
+
: {
|
213
|
+
parser: this
|
214
|
+
.parsers[subparser],
|
215
|
+
},
|
127
216
|
},
|
128
217
|
},
|
129
218
|
},
|
130
219
|
...processor,
|
131
220
|
...language,
|
132
221
|
},
|
133
|
-
...ruleset.map(
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
222
|
+
...ruleset.map(
|
223
|
+
(
|
224
|
+
{
|
225
|
+
id,
|
226
|
+
rules,
|
227
|
+
},
|
228
|
+
) => {
|
229
|
+
return {
|
230
|
+
name: `linted/${id}/` as const,
|
231
|
+
files,
|
232
|
+
ignores,
|
233
|
+
rules,
|
234
|
+
};
|
235
|
+
},
|
236
|
+
),
|
141
237
|
];
|
142
238
|
}
|
143
239
|
}
|