@eslinted/core 3.0.3-rc.1 → 3.0.3-rc.3
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/boundary/input/files/base/base.d.ts +1 -1
- package/dist/boundary/input/files/base/base.d.ts.map +1 -1
- package/dist/boundary/input/files/base/list/list.d.ts +1 -1
- package/dist/boundary/input/files/base/list/list.d.ts.map +1 -1
- package/dist/boundary/input/files/files.d.ts +1 -1
- package/dist/boundary/input/files/files.d.ts.map +1 -1
- package/dist/boundary/input/files/includes/includes.d.ts +1 -1
- package/dist/boundary/input/files/includes/includes.d.ts.map +1 -1
- package/dist/boundary/input/input.d.ts +1 -1
- package/dist/boundary/input/input.d.ts.map +1 -1
- package/dist/boundary/input/parsers/parsers.d.ts +1 -1
- package/dist/boundary/input/parsers/parsers.d.ts.map +1 -1
- package/dist/boundary/input/plugins/plugins.d.ts +1 -1
- package/dist/boundary/input/plugins/plugins.d.ts.map +1 -1
- package/dist/boundary/input/rules/overrides/overrides.d.ts +1 -1
- package/dist/boundary/input/rules/overrides/overrides.d.ts.map +1 -1
- package/dist/boundary/input/rules/preset/entry/entry.d.ts +1 -1
- package/dist/boundary/input/rules/preset/entry/entry.d.ts.map +1 -1
- package/dist/boundary/input/rules/preset/entry/object/object.d.ts +1 -1
- package/dist/boundary/input/rules/preset/entry/object/object.d.ts.map +1 -1
- package/dist/boundary/input/rules/preset/entry/object/state/level.d.ts +1 -1
- package/dist/boundary/input/rules/preset/entry/object/state/level.d.ts.map +1 -1
- package/dist/boundary/input/rules/preset/preset.d.ts +1 -1
- package/dist/boundary/input/rules/preset/preset.d.ts.map +1 -1
- package/dist/boundary/input/rules/rules.d.ts +1 -1
- package/dist/boundary/input/rules/rules.d.ts.map +1 -1
- package/dist/dependency/dependency.d.ts +1 -1
- package/dist/dependency/dependency.d.ts.map +1 -1
- package/dist/factory/files/Files.d.ts.map +1 -1
- package/dist/factory/files/Files.js +1 -4
- package/dist/factory/files/Files.js.map +1 -1
- package/dist/factory/options/option/Option.d.ts.map +1 -1
- package/dist/factory/options/option/Option.js +2 -10
- package/dist/factory/options/option/Option.js.map +1 -1
- package/dist/factory/options/option/html/index.d.ts.map +1 -1
- package/dist/factory/options/option/html/index.js +2 -7
- package/dist/factory/options/option/html/index.js.map +1 -1
- package/dist/factory/options/option/js/index.d.ts.map +1 -1
- package/dist/factory/options/option/js/index.js +4 -9
- package/dist/factory/options/option/js/index.js.map +1 -1
- package/dist/factory/options/option/json/index.d.ts.map +1 -1
- package/dist/factory/options/option/json/index.js +2 -7
- package/dist/factory/options/option/json/index.js.map +1 -1
- package/dist/factory/options/option/jsonc/index.d.ts.map +1 -1
- package/dist/factory/options/option/jsonc/index.js +2 -7
- package/dist/factory/options/option/jsonc/index.js.map +1 -1
- package/dist/factory/options/option/md/index.d.ts.map +1 -1
- package/dist/factory/options/option/md/index.js +2 -7
- package/dist/factory/options/option/md/index.js.map +1 -1
- package/dist/factory/options/option/mocha/index.d.ts +1 -1
- package/dist/factory/options/option/mocha/index.d.ts.map +1 -1
- package/dist/factory/options/option/mocha/index.js +8 -17
- package/dist/factory/options/option/mocha/index.js.map +1 -1
- package/dist/factory/options/option/svelte/index.d.ts +5 -5
- package/dist/factory/options/option/svelte/index.d.ts.map +1 -1
- package/dist/factory/options/option/svelte/index.js +11 -16
- package/dist/factory/options/option/svelte/index.js.map +1 -1
- package/dist/factory/options/option/ts/index.d.ts +3 -3
- package/dist/factory/options/option/ts/index.d.ts.map +1 -1
- package/dist/factory/options/option/ts/index.js +7 -16
- package/dist/factory/options/option/ts/index.js.map +1 -1
- package/dist/factory/options/option/yml/index.d.ts.map +1 -1
- package/dist/factory/options/option/yml/index.js +2 -7
- package/dist/factory/options/option/yml/index.js.map +1 -1
- package/dist/factory/ruleset/Ruleset.d.ts +1 -1
- package/dist/factory/ruleset/Ruleset.d.ts.map +1 -1
- package/dist/factory/ruleset/Ruleset.js +5 -15
- package/dist/factory/ruleset/Ruleset.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -37
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/boundary/input/files/base/base.ts +1 -4
- package/src/boundary/input/files/base/list/list.ts +1 -4
- package/src/boundary/input/files/files.ts +1 -4
- package/src/boundary/input/files/includes/includes.ts +1 -4
- package/src/boundary/input/input.ts +1 -4
- package/src/boundary/input/parsers/parsers.ts +1 -5
- package/src/boundary/input/plugins/plugins.ts +1 -5
- package/src/boundary/input/rules/overrides/overrides.ts +1 -4
- package/src/boundary/input/rules/preset/entry/entry.ts +1 -4
- package/src/boundary/input/rules/preset/entry/object/object.ts +1 -4
- package/src/boundary/input/rules/preset/entry/object/state/level.ts +1 -4
- package/src/boundary/input/rules/preset/preset.ts +1 -4
- package/src/boundary/input/rules/rules.ts +1 -4
- package/src/dependency/dependency.ts +1 -5
- package/src/factory/files/Files.ts +2 -10
- package/src/factory/options/option/Option.ts +15 -45
- package/src/factory/options/option/html/index.ts +2 -10
- package/src/factory/options/option/js/index.ts +4 -12
- package/src/factory/options/option/json/index.ts +2 -10
- package/src/factory/options/option/jsonc/index.ts +2 -10
- package/src/factory/options/option/md/index.ts +2 -10
- package/src/factory/options/option/mocha/index.ts +10 -22
- package/src/factory/options/option/svelte/index.ts +12 -22
- package/src/factory/options/option/ts/index.ts +8 -21
- package/src/factory/options/option/yml/index.ts +2 -10
- package/src/factory/ruleset/Ruleset.ts +8 -40
- package/src/index.ts +16 -47
- package/src/OmitFilesRuleset.d.ts +0 -1
@@ -5,7 +5,7 @@ export default class Mocha extends Option<
|
|
5
5
|
"mocha",
|
6
6
|
"mocha" | keyof Ts["option"]["plugins"],
|
7
7
|
true,
|
8
|
-
|
8
|
+
Ts["option"]["languageOptions"]["parserOptions"],
|
9
9
|
1,
|
10
10
|
"mocha"
|
11
11
|
> {
|
@@ -14,27 +14,15 @@ export default class Mocha extends Option<
|
|
14
14
|
public readonly types = ["mocha"] as const;
|
15
15
|
|
16
16
|
public get languageOptions() {
|
17
|
-
|
18
|
-
|
19
|
-
globals = this.globals("mocha");
|
17
|
+
const [parser] = this.parser,
|
18
|
+
globals = this.globals("mocha");
|
20
19
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
project: "tsconfig.json",
|
29
|
-
},
|
30
|
-
globals,
|
31
|
-
} as const;
|
32
|
-
}
|
33
|
-
catch (e) {
|
34
|
-
throw new Error(
|
35
|
-
`linted.factory.options.mocha: languageOptions`,
|
36
|
-
{ cause: e },
|
37
|
-
);
|
38
|
-
}
|
20
|
+
return {
|
21
|
+
ecmaVersion: "latest",
|
22
|
+
sourceType: "module",
|
23
|
+
parser,
|
24
|
+
parserOptions: { project: "tsconfig.json", ecmaVersion: "latest", sourceType: "module" },
|
25
|
+
globals,
|
26
|
+
} as const;
|
39
27
|
}
|
40
28
|
}
|
@@ -5,9 +5,7 @@ export default class Svelte extends Option<
|
|
5
5
|
"svelte",
|
6
6
|
"svelte" | keyof Ts["option"]["plugins"],
|
7
7
|
true,
|
8
|
-
& Ts["option"]["languageOptions"]["parserOptions"]
|
9
|
-
& { parser: unknown }
|
10
|
-
& { extraFileExtensions: readonly [".svelte"] },
|
8
|
+
{ parser: unknown } & { extraFileExtensions: readonly [".svelte"] } & Ts["option"]["languageOptions"]["parserOptions"],
|
11
9
|
2,
|
12
10
|
never,
|
13
11
|
{ processor: "svelte/svelte" }
|
@@ -16,27 +14,19 @@ export default class Svelte extends Option<
|
|
16
14
|
public readonly processor = { processor: "svelte/svelte" } as const;
|
17
15
|
|
18
16
|
public get languageOptions() {
|
19
|
-
|
20
|
-
const [parser, tsParser] = this.parser;
|
17
|
+
const [parser, tsParser] = this.parser;
|
21
18
|
|
22
|
-
|
19
|
+
return {
|
20
|
+
ecmaVersion: "latest",
|
21
|
+
sourceType: "module",
|
22
|
+
parser,
|
23
|
+
parserOptions: {
|
24
|
+
parser: tsParser,
|
25
|
+
extraFileExtensions: [".svelte"] as const,
|
26
|
+
project: "tsconfig.json",
|
23
27
|
ecmaVersion: "latest",
|
24
28
|
sourceType: "module",
|
25
|
-
|
26
|
-
|
27
|
-
ecmaVersion: "latest",
|
28
|
-
sourceType: "module",
|
29
|
-
project: "tsconfig.json",
|
30
|
-
extraFileExtensions: [".svelte"] as const,
|
31
|
-
parser: tsParser,
|
32
|
-
},
|
33
|
-
} as const;
|
34
|
-
}
|
35
|
-
catch (e) {
|
36
|
-
throw new Error(
|
37
|
-
`linted.factory.options.svelte: languageOptions`,
|
38
|
-
{ cause: e },
|
39
|
-
);
|
40
|
-
}
|
29
|
+
},
|
30
|
+
} as const;
|
41
31
|
}
|
42
32
|
}
|
@@ -5,33 +5,20 @@ export default class Ts extends Option<
|
|
5
5
|
"ts",
|
6
6
|
"@typescript-eslint" | keyof Js["option"]["plugins"],
|
7
7
|
true,
|
8
|
-
& Js["option"]["languageOptions"]
|
9
|
-
& { project: "tsconfig.json" },
|
8
|
+
{ project: "tsconfig.json" } & Js["option"]["languageOptions"],
|
10
9
|
1
|
11
10
|
> {
|
12
11
|
public readonly scope = "ts";
|
13
12
|
public readonly processor = {} as const;
|
14
13
|
|
15
14
|
public get languageOptions() {
|
16
|
-
|
17
|
-
const [parser] = this.parser;
|
15
|
+
const [parser] = this.parser;
|
18
16
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
sourceType: "module",
|
26
|
-
project: "tsconfig.json",
|
27
|
-
},
|
28
|
-
} as const;
|
29
|
-
}
|
30
|
-
catch (e) {
|
31
|
-
throw new Error(
|
32
|
-
`linted.factory.options.ts: languageOptions`,
|
33
|
-
{ cause: e },
|
34
|
-
);
|
35
|
-
}
|
17
|
+
return {
|
18
|
+
ecmaVersion: "latest",
|
19
|
+
sourceType: "module",
|
20
|
+
parser,
|
21
|
+
parserOptions: { project: "tsconfig.json", ecmaVersion: "latest", sourceType: "module" },
|
22
|
+
} as const;
|
36
23
|
}
|
37
24
|
}
|
@@ -11,16 +11,8 @@ export default class Yml extends Option<
|
|
11
11
|
public readonly processor = {} as const;
|
12
12
|
|
13
13
|
public get languageOptions() {
|
14
|
-
|
15
|
-
const [parser] = this.parser;
|
14
|
+
const [parser] = this.parser;
|
16
15
|
|
17
|
-
|
18
|
-
}
|
19
|
-
catch (e) {
|
20
|
-
throw new Error(
|
21
|
-
`linted.factory.options.yml: languageOptions`,
|
22
|
-
{ cause: e },
|
23
|
-
);
|
24
|
-
}
|
16
|
+
return { parser } as const;
|
25
17
|
}
|
26
18
|
}
|
@@ -6,33 +6,17 @@ export default class Ruleset<S extends Scope> {
|
|
6
6
|
public readonly ruleset: readonly Rule[];
|
7
7
|
public overrides: Null<Rule> = null;
|
8
8
|
|
9
|
-
constructor(
|
10
|
-
private readonly scope: literalful<S>,
|
11
|
-
...rules: readonly Rule[]
|
12
|
-
) {
|
9
|
+
constructor(private readonly scope: literalful<S>, ...rules: readonly Rule[]) {
|
13
10
|
try {
|
14
11
|
this.ruleset = [...rules];
|
15
12
|
}
|
16
|
-
catch (e) {
|
17
|
-
throw new Error(
|
18
|
-
`linted.factory.Ruleset`,
|
19
|
-
{ cause: e },
|
20
|
-
);
|
21
|
-
}
|
13
|
+
catch (e) { throw new Error(`linted.factory.Ruleset`, { cause: e }); }
|
22
14
|
}
|
23
15
|
|
24
16
|
public get id() {
|
25
|
-
|
26
|
-
const { scope } = this;
|
17
|
+
const { scope } = this;
|
27
18
|
|
28
|
-
|
29
|
-
}
|
30
|
-
catch (e) {
|
31
|
-
throw new Error(
|
32
|
-
`linted.factory.Ruleset: id`,
|
33
|
-
{ cause: e },
|
34
|
-
);
|
35
|
-
}
|
19
|
+
return scope;
|
36
20
|
}
|
37
21
|
|
38
22
|
public get records() {
|
@@ -44,29 +28,13 @@ export default class Ruleset<S extends Scope> {
|
|
44
28
|
...overrides === null ? [] : [[overrides.id, overrides.rules] as const] as const,
|
45
29
|
];
|
46
30
|
}
|
47
|
-
catch (e) {
|
48
|
-
throw new Error(
|
49
|
-
`linted.factory.Ruleset: records`,
|
50
|
-
{ cause: e },
|
51
|
-
);
|
52
|
-
}
|
31
|
+
catch (e) { throw new Error(`linted.factory.Ruleset: records`, { cause: e }); }
|
53
32
|
}
|
54
33
|
|
55
34
|
public override(overrides: undefined | Rule["rules"]) {
|
56
|
-
|
57
|
-
|
58
|
-
this.overrides = new Rule(
|
59
|
-
"override",
|
60
|
-
overrides,
|
61
|
-
);
|
35
|
+
if (typeof overrides !== "undefined")
|
36
|
+
this.overrides = new Rule("override", overrides);
|
62
37
|
|
63
|
-
|
64
|
-
}
|
65
|
-
catch (e) {
|
66
|
-
throw new Error(
|
67
|
-
`linted.factory.Ruleset: override`,
|
68
|
-
{ cause: e },
|
69
|
-
);
|
70
|
-
}
|
38
|
+
return this;
|
71
39
|
}
|
72
40
|
}
|
package/src/index.ts
CHANGED
@@ -89,99 +89,68 @@ export default function (
|
|
89
89
|
.js(
|
90
90
|
f.files("js"),
|
91
91
|
rulesets.js,
|
92
|
-
{
|
93
|
-
"@stylistic": plugins["@stylistic"],
|
94
|
-
},
|
92
|
+
{ "@stylistic": plugins["@stylistic"] },
|
95
93
|
scopedParsers.js,
|
96
|
-
)
|
97
|
-
.configs,
|
94
|
+
).configs,
|
98
95
|
ts: new Options
|
99
96
|
.ts(
|
100
97
|
f.files("ts"),
|
101
98
|
rulesets.ts,
|
102
|
-
{
|
103
|
-
"@stylistic": plugins["@stylistic"],
|
104
|
-
"@typescript-eslint": plugins["@typescript-eslint"],
|
105
|
-
},
|
99
|
+
{ "@stylistic": plugins["@stylistic"], "@typescript-eslint": plugins["@typescript-eslint"] },
|
106
100
|
scopedParsers.ts,
|
107
|
-
)
|
108
|
-
.configs,
|
101
|
+
).configs,
|
109
102
|
svelte: new Options
|
110
103
|
.svelte(
|
111
104
|
f.files("svelte"),
|
112
105
|
rulesets.svelte,
|
113
|
-
{
|
114
|
-
"@stylistic": plugins["@stylistic"],
|
115
|
-
"@typescript-eslint": plugins["@typescript-eslint"],
|
116
|
-
svelte: plugins.svelte,
|
117
|
-
},
|
106
|
+
{ "@stylistic": plugins["@stylistic"], "@typescript-eslint": plugins["@typescript-eslint"], svelte: plugins.svelte },
|
118
107
|
scopedParsers.svelte,
|
119
|
-
)
|
120
|
-
.configs,
|
108
|
+
).configs,
|
121
109
|
mocha: new Options
|
122
110
|
.mocha(
|
123
111
|
f.files("mocha"),
|
124
112
|
rulesets.mocha,
|
125
|
-
{
|
126
|
-
"@stylistic": plugins["@stylistic"],
|
127
|
-
"@typescript-eslint": plugins["@typescript-eslint"],
|
128
|
-
mocha: plugins.mocha,
|
129
|
-
},
|
113
|
+
{ "@stylistic": plugins["@stylistic"], "@typescript-eslint": plugins["@typescript-eslint"], mocha: plugins.mocha },
|
130
114
|
scopedParsers.mocha,
|
131
|
-
)
|
132
|
-
.configs,
|
115
|
+
).configs,
|
133
116
|
html: new Options
|
134
117
|
.html(
|
135
118
|
f.files("html"),
|
136
119
|
rulesets.html,
|
137
120
|
{ "@html-eslint": plugins["@html-eslint"] },
|
138
121
|
scopedParsers.html,
|
139
|
-
)
|
140
|
-
.configs,
|
122
|
+
).configs,
|
141
123
|
json: new Options
|
142
124
|
.json(
|
143
125
|
f.files("json"),
|
144
126
|
rulesets.json,
|
145
127
|
{ jsonc: plugins.jsonc },
|
146
128
|
scopedParsers.json,
|
147
|
-
)
|
148
|
-
.configs,
|
129
|
+
).configs,
|
149
130
|
jsonc: new Options
|
150
131
|
.jsonc(
|
151
132
|
f.files("jsonc"),
|
152
133
|
rulesets.jsonc,
|
153
134
|
{ jsonc: plugins.jsonc },
|
154
135
|
scopedParsers.jsonc,
|
155
|
-
)
|
156
|
-
.configs,
|
136
|
+
).configs,
|
157
137
|
yml: new Options
|
158
138
|
.yml(
|
159
139
|
f.files("yml"),
|
160
140
|
rulesets.yml,
|
161
141
|
{ yml: plugins.yml },
|
162
142
|
scopedParsers.yml,
|
163
|
-
)
|
164
|
-
.configs,
|
143
|
+
).configs,
|
165
144
|
md: new Options
|
166
145
|
.md(
|
167
146
|
f.files("md"),
|
168
147
|
rulesets.md,
|
169
|
-
{
|
170
|
-
markdownlint: plugins.markdownlint,
|
171
|
-
},
|
148
|
+
{ markdownlint: plugins.markdownlint },
|
172
149
|
scopedParsers.md,
|
173
|
-
)
|
174
|
-
.configs,
|
150
|
+
).configs,
|
175
151
|
};
|
176
152
|
|
177
|
-
return scopes
|
178
|
-
.map(scope => options[scope])
|
179
|
-
.flat();
|
180
|
-
}
|
181
|
-
catch (e) {
|
182
|
-
throw new Error(
|
183
|
-
`linted.main`,
|
184
|
-
{ cause: e },
|
185
|
-
);
|
153
|
+
return scopes.flatMap(scope => options[scope]);
|
186
154
|
}
|
155
|
+
catch (e) { throw new Error(`linted-core`, { cause: e }); }
|
187
156
|
}
|
@@ -1 +0,0 @@
|
|
1
|
-
declare type OmitFilesRuleset<A> = A extends readonly [unknown, unknown, ...infer An_1] ? An_1 : never;
|