@eslinted/core 5.0.1 → 5.0.2-rc.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/factory/index.d.ts +9 -2
- package/dist/factory/index.d.ts.map +1 -1
- package/dist/factory/index.js +16 -2
- package/dist/factory/index.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/factory/index.ts +22 -2
- package/src/index.ts +16 -21
package/dist/factory/index.d.ts
CHANGED
@@ -1,6 +1,13 @@
|
|
1
1
|
export type { Scope, Input, Output } from "../index.js";
|
2
|
-
import
|
2
|
+
import type { Input } from "../index.js";
|
3
3
|
import { Files } from "./files.js";
|
4
4
|
import { Rulesets } from "./rulesets/index.js";
|
5
|
-
|
5
|
+
import Options from "./options/index.js";
|
6
|
+
export { Options };
|
7
|
+
export declare class Factory {
|
8
|
+
readonly files: Files;
|
9
|
+
readonly rulesets: Rulesets;
|
10
|
+
constructor(files: Input["files"], rules: Input["rules"]);
|
11
|
+
produce(scope: string): readonly [string[], import("./rulesets/ruleset").Ruleset];
|
12
|
+
}
|
6
13
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/factory/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC;AAE/C,OAAO,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/factory/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC;AAE/C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,OAAO,MAAM,WAAW,CAAC;AAEhC,OAAO,EAAE,OAAO,EAAE,CAAC;AACnB,qBAAa,OAAO;IAClB,SAAgB,KAAK,EAAE,KAAK,CAAC;IAC7B,SAAgB,QAAQ,EAAE,QAAQ,CAAC;gBAGjC,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,EACrB,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC;IAMhB,OAAO,CAAC,KAAK,EAAE,MAAM;CAM7B"}
|
package/dist/factory/index.js
CHANGED
@@ -1,5 +1,19 @@
|
|
1
|
-
import Options from "./options/index.js";
|
2
1
|
import { Files } from "./files.js";
|
3
2
|
import { Rulesets } from "./rulesets/index.js";
|
4
|
-
|
3
|
+
import Options from "./options/index.js";
|
4
|
+
export { Options };
|
5
|
+
export class Factory {
|
6
|
+
files;
|
7
|
+
rulesets;
|
8
|
+
constructor(files, rules) {
|
9
|
+
this.files = new Files(files);
|
10
|
+
this.rulesets = new Rulesets(rules);
|
11
|
+
}
|
12
|
+
produce(scope) {
|
13
|
+
return [
|
14
|
+
this.files.files(scope),
|
15
|
+
this.rulesets.ruleset(scope),
|
16
|
+
];
|
17
|
+
}
|
18
|
+
}
|
5
19
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/factory/index.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/factory/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,OAAO,MAAM,WAAW,CAAC;AAEhC,OAAO,EAAE,OAAO,EAAE,CAAC;AACnB,MAAM,OAAO,OAAO;IACF,KAAK,CAAQ;IACb,QAAQ,CAAW;IAEnC,YACE,KAAqB,EACrB,KAAqB;QAErB,IAAI,CAAC,KAAK,GAAG,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC;QAC9B,IAAI,CAAC,QAAQ,GAAG,IAAI,QAAQ,CAAC,KAAK,CAAC,CAAC;IACtC,CAAC;IAEM,OAAO,CAAC,KAAa;QAC1B,OAAO;YACL,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC;YACvB,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC;SACpB,CAAC;IACb,CAAC;CACF"}
|
package/dist/index.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEtC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEvC,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEtC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEvC,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;AAQ9B,MAAM,CAAC,OAAO,WAAW,KAAK,EAAE,KAAK,GAAG,MAAM,CA+D7C"}
|
package/dist/index.js
CHANGED
@@ -1,24 +1,24 @@
|
|
1
1
|
import { scopes } from "./scopes.js";
|
2
|
-
import {
|
2
|
+
import { Factory, Options, } from "./factory/index.js";
|
3
3
|
export default function (input) {
|
4
4
|
try {
|
5
|
-
const
|
5
|
+
const { parsers, plugins, files, rules, } = input, factory = new Factory(files, rules), options = {
|
6
6
|
js: new Options
|
7
|
-
.js({ "@stylistic": plugins["@stylistic"] }, [],
|
7
|
+
.js({ "@stylistic": plugins["@stylistic"] }, [], ...factory.produce("js")).configs,
|
8
8
|
ts: new Options
|
9
|
-
.ts({ "@stylistic": plugins["@stylistic"], "@typescript-eslint": plugins["@typescript-eslint"] }, [parsers.ts],
|
9
|
+
.ts({ "@stylistic": plugins["@stylistic"], "@typescript-eslint": plugins["@typescript-eslint"] }, [parsers.ts], ...factory.produce("ts")).configs,
|
10
10
|
svelte: new Options
|
11
|
-
.svelte({ "@stylistic": plugins["@stylistic"], "@typescript-eslint": plugins["@typescript-eslint"], svelte: plugins.svelte }, [parsers.svelte, parsers.ts],
|
11
|
+
.svelte({ "@stylistic": plugins["@stylistic"], "@typescript-eslint": plugins["@typescript-eslint"], svelte: plugins.svelte }, [parsers.svelte, parsers.ts], ...factory.produce("svelte")).configs,
|
12
12
|
mocha: new Options
|
13
|
-
.mocha({ "@stylistic": plugins["@stylistic"], "@typescript-eslint": plugins["@typescript-eslint"], mocha: plugins.mocha }, [parsers.ts],
|
13
|
+
.mocha({ "@stylistic": plugins["@stylistic"], "@typescript-eslint": plugins["@typescript-eslint"], mocha: plugins.mocha }, [parsers.ts], ...factory.produce("mocha")).configs,
|
14
14
|
html: new Options
|
15
|
-
.html({ "@html-eslint": plugins["@html-eslint"] }, [parsers.html],
|
15
|
+
.html({ "@html-eslint": plugins["@html-eslint"] }, [parsers.html], ...factory.produce("html")).configs,
|
16
16
|
json: new Options
|
17
|
-
.json({ jsonc: plugins.jsonc }, [parsers.jsonc],
|
17
|
+
.json({ jsonc: plugins.jsonc }, [parsers.jsonc], ...factory.produce("json")).configs,
|
18
18
|
jsonc: new Options
|
19
|
-
.jsonc({ jsonc: plugins.jsonc }, [parsers.jsonc],
|
19
|
+
.jsonc({ jsonc: plugins.jsonc }, [parsers.jsonc], ...factory.produce("jsonc")).configs,
|
20
20
|
yml: new Options
|
21
|
-
.yml({ yml: plugins.yml }, [parsers.yml],
|
21
|
+
.yml({ yml: plugins.yml }, [parsers.yml], ...factory.produce("yml")).configs,
|
22
22
|
};
|
23
23
|
return scopes.flatMap(scope => options[scope]);
|
24
24
|
}
|
package/dist/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EACL,
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EACL,OAAO,EACP,OAAO,GACR,MAAM,WAAW,CAAC;AAEnB,MAAM,CAAC,OAAO,WAAW,KAAY;IACnC,IAAI,CAAC;QACH,MAAM,EACJ,OAAO,EACP,OAAO,EACP,KAAK,EACL,KAAK,GACN,GAAG,KAAK,EACT,OAAO,GAAG,IAAI,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,EACnC,OAAO,GAAiF;YACtF,EAAE,EAAE,IAAI,OAAO;iBACZ,EAAE,CACD,EAAE,YAAY,EAAE,OAAO,CAAC,YAAY,CAAC,EAAE,EACvC,EAAE,EACF,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CACzB,CAAC,OAAO;YACX,EAAE,EAAE,IAAI,OAAO;iBACZ,EAAE,CACD,EAAE,YAAY,EAAE,OAAO,CAAC,YAAY,CAAC,EAAE,oBAAoB,EAAE,OAAO,CAAC,oBAAoB,CAAC,EAAE,EAC5F,CAAC,OAAO,CAAC,EAAE,CAAC,EACZ,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CACzB,CAAC,OAAO;YACX,MAAM,EAAE,IAAI,OAAO;iBAChB,MAAM,CACL,EAAE,YAAY,EAAE,OAAO,CAAC,YAAY,CAAC,EAAE,oBAAoB,EAAE,OAAO,CAAC,oBAAoB,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,EACpH,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,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C;IACjD,CAAC;IACD,OAAO,CAAC,EAAE,CAAC;QAAC,MAAM,IAAI,KAAK,CAAC,aAAa,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC;IAAC,CAAC;AAC7D,CAAC"}
|
package/package.json
CHANGED
package/src/factory/index.ts
CHANGED
@@ -1,7 +1,27 @@
|
|
1
1
|
export type { Scope, Input, Output } from "..";
|
2
2
|
|
3
|
-
import
|
3
|
+
import type { Input } from "..";
|
4
4
|
import { Files } from "./files";
|
5
5
|
import { Rulesets } from "./rulesets";
|
6
|
+
import Options from "./options";
|
7
|
+
|
8
|
+
export { Options };
|
9
|
+
export class Factory {
|
10
|
+
public readonly files: Files;
|
11
|
+
public readonly rulesets: Rulesets;
|
12
|
+
|
13
|
+
constructor(
|
14
|
+
files: Input["files"],
|
15
|
+
rules: Input["rules"],
|
16
|
+
) {
|
17
|
+
this.files = new Files(files);
|
18
|
+
this.rulesets = new Rulesets(rules);
|
19
|
+
}
|
6
20
|
|
7
|
-
|
21
|
+
public produce(scope: string) {
|
22
|
+
return [
|
23
|
+
this.files.files(scope),
|
24
|
+
this.rulesets.ruleset(scope),
|
25
|
+
] as const;
|
26
|
+
}
|
27
|
+
}
|
package/src/index.ts
CHANGED
@@ -7,72 +7,67 @@ export type { Input, Output };
|
|
7
7
|
|
8
8
|
import { scopes } from "./scopes";
|
9
9
|
import {
|
10
|
-
|
11
|
-
Rulesets,
|
10
|
+
Factory,
|
12
11
|
Options,
|
13
12
|
} from "./factory";
|
14
13
|
|
15
14
|
export default function (input: Input): Output {
|
16
15
|
try {
|
17
|
-
const
|
18
|
-
|
19
|
-
|
16
|
+
const {
|
17
|
+
parsers,
|
18
|
+
plugins,
|
19
|
+
files,
|
20
|
+
rules,
|
21
|
+
} = input,
|
22
|
+
factory = new Factory(files, rules),
|
20
23
|
options: { [S in typeof scopes[number]]: InstanceType<typeof Options[S]>["configs"] } = {
|
21
24
|
js: new Options
|
22
25
|
.js(
|
23
26
|
{ "@stylistic": plugins["@stylistic"] },
|
24
27
|
[],
|
25
|
-
|
26
|
-
rulesets.ruleset("js"),
|
28
|
+
...factory.produce("js"),
|
27
29
|
).configs,
|
28
30
|
ts: new Options
|
29
31
|
.ts(
|
30
32
|
{ "@stylistic": plugins["@stylistic"], "@typescript-eslint": plugins["@typescript-eslint"] },
|
31
33
|
[parsers.ts],
|
32
|
-
|
33
|
-
rulesets.ruleset("ts"),
|
34
|
+
...factory.produce("ts"),
|
34
35
|
).configs,
|
35
36
|
svelte: new Options
|
36
37
|
.svelte(
|
37
38
|
{ "@stylistic": plugins["@stylistic"], "@typescript-eslint": plugins["@typescript-eslint"], svelte: plugins.svelte },
|
38
39
|
[parsers.svelte, parsers.ts],
|
39
|
-
|
40
|
-
rulesets.ruleset("svelte"),
|
40
|
+
...factory.produce("svelte"),
|
41
41
|
).configs,
|
42
42
|
mocha: new Options
|
43
43
|
.mocha(
|
44
44
|
{ "@stylistic": plugins["@stylistic"], "@typescript-eslint": plugins["@typescript-eslint"], mocha: plugins.mocha },
|
45
45
|
[parsers.ts],
|
46
|
-
|
47
|
-
rulesets.ruleset("mocha"),
|
46
|
+
...factory.produce("mocha"),
|
48
47
|
).configs,
|
49
48
|
html: new Options
|
50
49
|
.html(
|
51
50
|
{ "@html-eslint": plugins["@html-eslint"] },
|
52
51
|
[parsers.html],
|
53
|
-
|
54
|
-
rulesets.ruleset("html"),
|
52
|
+
...factory.produce("html"),
|
55
53
|
).configs,
|
56
54
|
json: new Options
|
57
55
|
.json(
|
58
56
|
{ jsonc: plugins.jsonc },
|
59
57
|
[parsers.jsonc],
|
60
|
-
|
61
|
-
rulesets.ruleset("json"),
|
58
|
+
...factory.produce("json"),
|
62
59
|
).configs,
|
63
60
|
jsonc: new Options
|
64
61
|
.jsonc(
|
65
62
|
{ jsonc: plugins.jsonc },
|
66
63
|
[parsers.jsonc],
|
67
|
-
|
68
|
-
rulesets.ruleset("jsonc"),
|
64
|
+
...factory.produce("jsonc"),
|
69
65
|
).configs,
|
70
66
|
yml: new Options
|
71
67
|
.yml(
|
72
68
|
{ yml: plugins.yml },
|
73
69
|
[parsers.yml],
|
74
|
-
|
75
|
-
rulesets.ruleset("yml"),
|
70
|
+
...factory.produce("yml"),
|
76
71
|
).configs,
|
77
72
|
};
|
78
73
|
|