@eslinted/core 13.3.0-rc.1 → 13.3.0-rc.2
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/factory/factory.d.ts +183 -81
- package/dist/factory/factory.d.ts.map +1 -1
- package/dist/factory/factory.js +22 -3
- package/dist/factory/factory.js.map +1 -1
- package/dist/factory/settings/scopes/html.d.ts +4 -3
- package/dist/factory/settings/scopes/html.d.ts.map +1 -1
- package/dist/factory/settings/scopes/html.js +2 -4
- package/dist/factory/settings/scopes/html.js.map +1 -1
- package/dist/factory/settings/scopes/js.d.ts +3 -2
- package/dist/factory/settings/scopes/js.d.ts.map +1 -1
- package/dist/factory/settings/scopes/js.js +2 -3
- package/dist/factory/settings/scopes/js.js.map +1 -1
- package/dist/factory/settings/scopes/json.d.ts +4 -3
- package/dist/factory/settings/scopes/json.d.ts.map +1 -1
- package/dist/factory/settings/scopes/json.js +2 -4
- package/dist/factory/settings/scopes/json.js.map +1 -1
- package/dist/factory/settings/scopes/jsonc.d.ts +4 -3
- package/dist/factory/settings/scopes/jsonc.d.ts.map +1 -1
- package/dist/factory/settings/scopes/jsonc.js +2 -4
- package/dist/factory/settings/scopes/jsonc.js.map +1 -1
- package/dist/factory/settings/scopes/mocha.d.ts +5 -3
- package/dist/factory/settings/scopes/mocha.d.ts.map +1 -1
- package/dist/factory/settings/scopes/mocha.js +11 -12
- package/dist/factory/settings/scopes/mocha.js.map +1 -1
- package/dist/factory/settings/scopes/svelte.d.ts +16 -12
- package/dist/factory/settings/scopes/svelte.d.ts.map +1 -1
- package/dist/factory/settings/scopes/svelte.js +12 -13
- package/dist/factory/settings/scopes/svelte.js.map +1 -1
- package/dist/factory/settings/scopes/ts.d.ts +10 -6
- package/dist/factory/settings/scopes/ts.d.ts.map +1 -1
- package/dist/factory/settings/scopes/ts.js +10 -11
- package/dist/factory/settings/scopes/ts.js.map +1 -1
- package/dist/factory/settings/scopes/yml.d.ts +4 -3
- package/dist/factory/settings/scopes/yml.d.ts.map +1 -1
- package/dist/factory/settings/scopes/yml.js +2 -4
- package/dist/factory/settings/scopes/yml.js.map +1 -1
- package/dist/factory/settings/setting.d.ts +50 -37
- package/dist/factory/settings/setting.d.ts.map +1 -1
- package/dist/factory/settings/setting.js +5 -6
- package/dist/factory/settings/setting.js.map +1 -1
- package/dist/index.js +9 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/factory/factory.ts +22 -2
- package/src/factory/settings/scopes/html.ts +3 -8
- package/src/factory/settings/scopes/js.ts +3 -5
- package/src/factory/settings/scopes/json.ts +3 -8
- package/src/factory/settings/scopes/jsonc.ts +3 -8
- package/src/factory/settings/scopes/mocha.ts +13 -17
- package/src/factory/settings/scopes/svelte.ts +19 -21
- package/src/factory/settings/scopes/ts.ts +16 -17
- package/src/factory/settings/scopes/yml.ts +3 -9
- package/src/factory/settings/setting.ts +39 -43
- package/src/index.ts +9 -9
@@ -2,31 +2,29 @@ import { ScopeSetting } from "../setting";
|
|
2
2
|
import type TsSetting from "./ts";
|
3
3
|
|
4
4
|
export default class SvelteSetting extends ScopeSetting<
|
5
|
-
"svelte",
|
6
|
-
{
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
5
|
+
"svelte" | "ts",
|
6
|
+
TsSetting["parserOptions"] & {
|
7
|
+
parserOptions: {
|
8
|
+
readonly parser: "ts";
|
9
|
+
readonly extraFileExtensions: readonly [".svelte"];
|
10
|
+
};
|
11
|
+
},
|
11
12
|
false,
|
12
13
|
{ readonly processor: "svelte/svelte" }
|
13
14
|
> {
|
14
15
|
public readonly scope = "svelte";
|
15
16
|
public readonly processor = { processor: "svelte/svelte" } as const;
|
16
17
|
public readonly language = {} as const;
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
parser,
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
} as const,
|
30
|
-
} as const;
|
31
|
-
}
|
18
|
+
public readonly parserOptions = {
|
19
|
+
parserOptions: {
|
20
|
+
project: "tsconfig.json",
|
21
|
+
sourceType: "module",
|
22
|
+
ecmaVersion: 2023,
|
23
|
+
parser: "ts",
|
24
|
+
extraFileExtensions: [".svelte"] as const,
|
25
|
+
} as const,
|
26
|
+
} as const;
|
27
|
+
public readonly languageOptions = {
|
28
|
+
parser: "svelte",
|
29
|
+
} as const;
|
32
30
|
}
|
@@ -3,26 +3,25 @@ import { ScopeSetting } from "../setting";
|
|
3
3
|
export default class TsSetting extends ScopeSetting<
|
4
4
|
"ts",
|
5
5
|
{
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
6
|
+
parserOptions: {
|
7
|
+
readonly project: "tsconfig.json";
|
8
|
+
readonly sourceType: "module";
|
9
|
+
readonly ecmaVersion: 2023;
|
10
|
+
};
|
11
|
+
}
|
11
12
|
> {
|
12
13
|
public readonly scope = "ts";
|
13
14
|
public readonly processor = {} as const;
|
14
15
|
public readonly language = {} as const;
|
16
|
+
public readonly parserOptions = {
|
17
|
+
parserOptions: {
|
18
|
+
project: "tsconfig.json",
|
19
|
+
sourceType: "module",
|
20
|
+
ecmaVersion: 2023,
|
21
|
+
} as const,
|
22
|
+
} as const;
|
23
|
+
public readonly languageOptions = {
|
24
|
+
parser: "ts",
|
15
25
|
|
16
|
-
|
17
|
-
const [parser] = this.parser;
|
18
|
-
|
19
|
-
return {
|
20
|
-
parser,
|
21
|
-
parserOptions: {
|
22
|
-
project: "tsconfig.json",
|
23
|
-
sourceType: "module",
|
24
|
-
ecmaVersion: 2023,
|
25
|
-
} as const,
|
26
|
-
} as const;
|
27
|
-
}
|
26
|
+
} as const;
|
28
27
|
}
|
@@ -1,17 +1,11 @@
|
|
1
1
|
import { ScopeSetting } from "../setting";
|
2
2
|
|
3
3
|
export default class YmlSetting extends ScopeSetting<
|
4
|
-
"yml"
|
5
|
-
true,
|
6
|
-
1
|
4
|
+
"yml"
|
7
5
|
> {
|
8
6
|
public readonly scope = "yml";
|
9
7
|
public readonly processor = {} as const;
|
10
8
|
public readonly language = {} as const;
|
11
|
-
|
12
|
-
public
|
13
|
-
const [parser] = this.parser;
|
14
|
-
|
15
|
-
return { parser } as const;
|
16
|
-
}
|
9
|
+
public readonly parserOptions = {} as const;
|
10
|
+
public readonly languageOptions = { parser: "yml" } as const;
|
17
11
|
}
|
@@ -2,61 +2,57 @@ import globals from "globals";
|
|
2
2
|
import type { Scopes } from "../..";
|
3
3
|
|
4
4
|
export abstract class ScopeSetting<
|
5
|
-
|
6
|
-
ParserOptions extends
|
7
|
-
|
|
8
|
-
| boolean = false,
|
9
|
-
ParserCount extends 0 | 1 | 2 = ParserOptions extends false ? 0 : 1,
|
10
|
-
G extends keyof typeof globals | false = false,
|
5
|
+
Parser extends Scopes | false = false,
|
6
|
+
ParserOptions extends object = object,
|
7
|
+
Global extends keyof typeof globals | false = false,
|
11
8
|
Processor extends object = object,
|
12
9
|
Language extends object = object,
|
13
10
|
> {
|
14
|
-
public abstract readonly scope:
|
15
|
-
public abstract readonly processor: (Processor extends
|
16
|
-
?
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
:
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
11
|
+
public abstract readonly scope: Scopes;
|
12
|
+
public abstract readonly processor: (Processor extends { readonly processor: infer P }
|
13
|
+
? string extends P
|
14
|
+
? Record<string, never>
|
15
|
+
: { readonly processor: P }
|
16
|
+
: Record<string, never>);
|
17
|
+
public abstract readonly language: (Language extends { readonly language: infer L }
|
18
|
+
? string extends L
|
19
|
+
? Record<string, never>
|
20
|
+
: { readonly language: L }
|
21
|
+
: Record<string, never>);
|
22
|
+
public abstract readonly parserOptions: (ParserOptions extends { readonly parserOptions: infer PO }
|
23
|
+
? PO extends { readonly parser: infer P }
|
24
|
+
? P extends Parser
|
25
|
+
? ParserOptions
|
26
|
+
: Record<string, never>
|
27
|
+
: ParserOptions
|
28
|
+
: Record<string, never>);
|
29
|
+
public abstract readonly languageOptions: (
|
30
|
+
[Parser] extends [boolean]
|
31
|
+
? { readonly parser?: never }
|
32
|
+
: { parser: Parser }
|
33
|
+
|
34
|
+
) & (
|
35
|
+
Global extends boolean
|
36
|
+
? { readonly globals?: never }
|
37
|
+
: { readonly globals: Readonly<Record<string, unknown>> }
|
38
|
+
);
|
30
39
|
|
31
40
|
public get option() {
|
32
|
-
const {
|
41
|
+
const {
|
42
|
+
languageOptions, parserOptions, processor, language,
|
43
|
+
} = this;
|
33
44
|
|
34
45
|
return {
|
35
|
-
languageOptions
|
46
|
+
languageOptions: {
|
47
|
+
...languageOptions,
|
48
|
+
...parserOptions,
|
49
|
+
},
|
36
50
|
...processor,
|
37
51
|
...language,
|
38
52
|
} as const;
|
39
53
|
}
|
40
54
|
|
41
|
-
protected
|
42
|
-
(G extends never
|
43
|
-
? object
|
44
|
-
: G extends boolean
|
45
|
-
? object
|
46
|
-
: G extends string
|
47
|
-
? string extends G
|
48
|
-
? object
|
49
|
-
: { readonly globals: Readonly<Record<string, unknown>> }
|
50
|
-
: object
|
51
|
-
) & ParserOptions extends never
|
52
|
-
? object
|
53
|
-
: ParserOptions extends boolean
|
54
|
-
? ParserOptions extends true
|
55
|
-
? { readonly parser: unknown }
|
56
|
-
: object
|
57
|
-
: { readonly parser: unknown; readonly parserOptions: ParserOptions };
|
58
|
-
|
59
|
-
protected globals(global: G & keyof typeof globals) {
|
55
|
+
protected globals(global: Global & keyof typeof globals) {
|
60
56
|
if (typeof global === "boolean")
|
61
57
|
throw new TypeError("`global` must be a string key of `globals` package");
|
62
58
|
|
package/src/index.ts
CHANGED
@@ -10,16 +10,16 @@ export default function ({
|
|
10
10
|
extensions,
|
11
11
|
}: Input): Output {
|
12
12
|
try {
|
13
|
-
const factory = new Factory(defaults, extensions),
|
13
|
+
const factory = new Factory(parsers, defaults, extensions),
|
14
14
|
options: { readonly [S in typeof scopes[number]]: InstanceType<typeof ScopeSettings[S]> } = {
|
15
|
-
js: new ScopeSettings.js(
|
16
|
-
ts: new ScopeSettings.ts(
|
17
|
-
svelte: new ScopeSettings.svelte(
|
18
|
-
mocha: new ScopeSettings.mocha(
|
19
|
-
html: new ScopeSettings.html(
|
20
|
-
json: new ScopeSettings.json(
|
21
|
-
jsonc: new ScopeSettings.jsonc(
|
22
|
-
yml: new ScopeSettings.yml(
|
15
|
+
js: new ScopeSettings.js(),
|
16
|
+
ts: new ScopeSettings.ts(),
|
17
|
+
svelte: new ScopeSettings.svelte(),
|
18
|
+
mocha: new ScopeSettings.mocha(),
|
19
|
+
html: new ScopeSettings.html(),
|
20
|
+
json: new ScopeSettings.json(),
|
21
|
+
jsonc: new ScopeSettings.jsonc(),
|
22
|
+
yml: new ScopeSettings.yml(),
|
23
23
|
} as const;
|
24
24
|
|
25
25
|
return [
|