@eslinted/core 18.11.1 → 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 +76 -19
- package/dist/factory/index.js.map +1 -1
- package/package.json +1 -1
- package/src/factory/index.ts +125 -43
@@ -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,7 +6,15 @@ 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/",
|
@@ -22,43 +30,74 @@ export class Factory {
|
|
22
30
|
ignores: {
|
23
31
|
name: "linted/*/ignores/",
|
24
32
|
ignores: [
|
25
|
-
...override
|
33
|
+
...override
|
34
|
+
? []
|
35
|
+
: defaults
|
36
|
+
.ignores["*"],
|
26
37
|
...ignores,
|
27
38
|
],
|
28
39
|
},
|
29
40
|
};
|
30
41
|
this.scopes = {
|
31
|
-
files: defaults
|
32
|
-
|
33
|
-
|
42
|
+
files: defaults
|
43
|
+
.files,
|
44
|
+
ignores: defaults
|
45
|
+
.ignores,
|
46
|
+
rules: defaults
|
47
|
+
.rules,
|
34
48
|
};
|
35
49
|
for (const scope in scopeExtensions) {
|
36
50
|
const { [scope]: { files: userFiles = [], ignores: userIgnores = [], rules: userRules = null, } = {}, } = scopeExtensions;
|
37
|
-
this
|
38
|
-
|
51
|
+
this
|
52
|
+
.scopes
|
53
|
+
.files[scope]
|
54
|
+
.push(...userFiles);
|
55
|
+
this
|
56
|
+
.scopes
|
57
|
+
.ignores[scope]
|
58
|
+
.push(...userIgnores);
|
39
59
|
if (userRules !== null)
|
40
|
-
this
|
41
|
-
|
60
|
+
this
|
61
|
+
.scopes
|
62
|
+
.rules[scope]
|
63
|
+
.push({
|
64
|
+
id: scope + "/override",
|
42
65
|
rules: userRules,
|
43
66
|
});
|
44
67
|
}
|
45
68
|
for (const [scope, parents] of tree)
|
46
69
|
for (const parent of parents) {
|
47
|
-
this
|
48
|
-
|
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]);
|
49
82
|
}
|
50
83
|
}
|
51
84
|
get globals() {
|
52
|
-
const { settings, ignores, } = this
|
85
|
+
const { settings, ignores, } = this
|
86
|
+
.global;
|
53
87
|
return [
|
54
88
|
settings,
|
55
89
|
ignores,
|
56
90
|
];
|
57
91
|
}
|
58
92
|
scope(scope) {
|
59
|
-
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, }) => {
|
60
95
|
return {
|
61
|
-
id:
|
96
|
+
id: [
|
97
|
+
scope,
|
98
|
+
id,
|
99
|
+
]
|
100
|
+
.join("/"),
|
62
101
|
rules,
|
63
102
|
};
|
64
103
|
}), { languageOptions: { parser = null, globals: global = null, ...languageOptionsStatic }, parserOptions: { parser: subparser = null, ...parserOptionsStatic }, processor, language, } = new ScopeManifests[scope]();
|
@@ -73,21 +112,39 @@ export class Factory {
|
|
73
112
|
ignores,
|
74
113
|
languageOptions: {
|
75
114
|
...languageOptionsStatic,
|
76
|
-
...global === null
|
77
|
-
|
78
|
-
|
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
|
79
131
|
? {}
|
80
132
|
: {
|
81
133
|
parserOptions: {
|
82
134
|
...parserOptionsStatic,
|
83
|
-
...subparser === null
|
135
|
+
...subparser === null
|
136
|
+
? {}
|
137
|
+
: {
|
138
|
+
parser: this
|
139
|
+
.parsers[subparser],
|
140
|
+
},
|
84
141
|
},
|
85
142
|
},
|
86
143
|
},
|
87
144
|
...processor,
|
88
145
|
...language,
|
89
146
|
},
|
90
|
-
...ruleset.map(({ id, rules }) => {
|
147
|
+
...ruleset.map(({ id, rules, }) => {
|
91
148
|
return {
|
92
149
|
name: `linted/${id}/`,
|
93
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/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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;
|
@@ -40,15 +51,21 @@ export class Factory {
|
|
40
51
|
ignores: {
|
41
52
|
name: "linted/*/ignores/" as const,
|
42
53
|
ignores: [
|
43
|
-
...override
|
54
|
+
...override
|
55
|
+
? []
|
56
|
+
: defaults
|
57
|
+
.ignores["*"],
|
44
58
|
...ignores,
|
45
59
|
],
|
46
60
|
},
|
47
61
|
};
|
48
62
|
this.scopes = {
|
49
|
-
files: defaults
|
50
|
-
|
51
|
-
|
63
|
+
files: defaults
|
64
|
+
.files,
|
65
|
+
ignores: defaults
|
66
|
+
.ignores,
|
67
|
+
rules: defaults
|
68
|
+
.rules,
|
52
69
|
};
|
53
70
|
|
54
71
|
for (const scope in scopeExtensions) {
|
@@ -60,24 +77,45 @@ export class Factory {
|
|
60
77
|
} = {},
|
61
78
|
} = scopeExtensions;
|
62
79
|
|
63
|
-
this
|
64
|
-
|
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);
|
65
88
|
|
66
89
|
if (userRules !== null)
|
67
|
-
this
|
68
|
-
|
69
|
-
rules
|
70
|
-
|
90
|
+
this
|
91
|
+
.scopes
|
92
|
+
.rules[scope as keyof typeof scopeExtensions]
|
93
|
+
.push(
|
94
|
+
{
|
95
|
+
id: scope + "/override",
|
96
|
+
rules: userRules,
|
97
|
+
},
|
98
|
+
);
|
71
99
|
}
|
72
100
|
|
73
101
|
for (const [scope, parents] of tree)
|
74
102
|
for (const parent of parents) {
|
75
|
-
this
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
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
|
+
);
|
81
119
|
}
|
82
120
|
}
|
83
121
|
|
@@ -85,7 +123,8 @@ export class Factory {
|
|
85
123
|
const {
|
86
124
|
settings,
|
87
125
|
ignores,
|
88
|
-
} = this
|
126
|
+
} = this
|
127
|
+
.global;
|
89
128
|
|
90
129
|
return [
|
91
130
|
settings,
|
@@ -95,16 +134,34 @@ export class Factory {
|
|
95
134
|
|
96
135
|
public scope(scope: Scope) {
|
97
136
|
const {
|
98
|
-
files: {
|
99
|
-
|
100
|
-
|
137
|
+
files: {
|
138
|
+
[scope]: files,
|
139
|
+
},
|
140
|
+
ignores: {
|
141
|
+
[scope]: ignores,
|
142
|
+
},
|
143
|
+
rules: {
|
144
|
+
[scope]: rules,
|
145
|
+
},
|
101
146
|
} = this.scopes,
|
102
|
-
ruleset = rules
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
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
|
+
),
|
108
165
|
{
|
109
166
|
languageOptions: {
|
110
167
|
parser = null,
|
@@ -130,28 +187,53 @@ export class Factory {
|
|
130
187
|
ignores,
|
131
188
|
languageOptions: {
|
132
189
|
...languageOptionsStatic,
|
133
|
-
...global === null
|
134
|
-
|
135
|
-
|
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
|
136
206
|
? {}
|
137
207
|
: {
|
138
208
|
parserOptions: {
|
139
209
|
...parserOptionsStatic,
|
140
|
-
...subparser === null
|
210
|
+
...subparser === null
|
211
|
+
? {}
|
212
|
+
: {
|
213
|
+
parser: this
|
214
|
+
.parsers[subparser],
|
215
|
+
},
|
141
216
|
},
|
142
217
|
},
|
143
218
|
},
|
144
219
|
...processor,
|
145
220
|
...language,
|
146
221
|
},
|
147
|
-
...ruleset.map(
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
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
|
+
),
|
155
237
|
];
|
156
238
|
}
|
157
239
|
}
|