@eslinted/core 8.0.0 → 9.0.0
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/.github/workflows/RELEASE.yml +36 -36
- package/.github/workflows/rc.yml +36 -36
- package/.markdownlint.jsonc +122 -122
- package/LICENSE +21 -21
- package/README.md +5 -5
- package/SECURITY.md +9 -9
- package/eslint.config.js +3 -3
- package/package.json +96 -96
- package/src/factory/files.ts +26 -26
- package/src/factory/index.ts +27 -27
- package/src/factory/options/html.ts +18 -18
- package/src/factory/options/index.ts +21 -21
- package/src/factory/options/js.ts +13 -13
- package/src/factory/options/json.ts +18 -18
- package/src/factory/options/jsonc.ts +18 -18
- package/src/factory/options/mocha.ts +28 -28
- package/src/factory/options/option/index.ts +91 -91
- package/src/factory/options/option/template/globals.ts +5 -5
- package/src/factory/options/option/template/index.ts +26 -26
- package/src/factory/options/option/template/language/ecma.ts +3 -3
- package/src/factory/options/option/template/language/index.ts +21 -21
- package/src/factory/options/option/template/language/source.ts +4 -4
- package/src/factory/options/option/template/linter.ts +8 -8
- package/src/factory/options/option/template/plugins.ts +1 -1
- package/src/factory/options/svelte.ts +32 -32
- package/src/factory/options/ts.ts +24 -24
- package/src/factory/options/yml.ts +18 -18
- package/src/factory/rulesets/index.ts +24 -24
- package/src/factory/rulesets/ruleset.ts +25 -25
- package/src/index.ts +77 -77
- package/src/input/files.ts +6 -6
- package/src/input/imports/parsers.ts +10 -10
- package/src/input/imports/plugins.ts +9 -9
- package/src/input/index.ts +23 -23
- package/src/input/parsers.ts +3 -3
- package/src/input/plugins.ts +3 -3
- package/src/input/rules/entry/index.ts +7 -7
- package/src/input/rules/entry/record/index.ts +3 -3
- package/src/input/rules/entry/record/state.ts +5 -5
- package/src/input/rules/index.ts +14 -14
- package/src/output.ts +24 -24
- package/src/scopes.spec.ts +37 -37
- package/src/scopes.ts +11 -11
- package/tsconfig.json +163 -163
- package/typings/common/literals/number/bases/base32.d.ts +19 -19
- package/typings/common/literals/number/bases/base64.d.ts +35 -35
- package/typings/common/literals/number/bases/binary.d.ts +4 -4
- package/typings/common/literals/number/bases/decimal.d.ts +5 -5
- package/typings/common/literals/number/bases/hex.d.ts +10 -10
- package/typings/common/literals/number/bases/octal.d.ts +7 -7
- package/typings/common/literals/number/bases/quatral.d.ts +4 -4
- package/typings/common/literals/number/bases/ternary.d.ts +4 -4
- package/typings/common/literals/string/letter/digit/extended/base64/index.d.ts +13 -13
- package/typings/common/literals/string/letter/digit/extended/hex/index.d.ts +9 -9
- package/typings/common/literals/string/letter/digit/index.d.ts +12 -12
- package/typings/common/literals/string/letter/index.d.ts +35 -35
- package/typings/common/primitive/index.d.ts +5 -5
- package/typings/common/safe/index.d.ts +2 -2
- package/typings/common/safe/numbers/finite/index.d.ts +2 -2
- package/typings/common/safe/numbers/fint.d.ts +1 -1
- package/typings/common/safe/numbers/integer/index.d.ts +2 -2
- package/typings/common/safe/numbers/integer/numberful/index.d.ts +1 -1
- package/typings/common/safe/numbers/polarity/negative.d.ts +4 -4
- package/typings/common/safe/numbers/polarity/pole/index.d.ts +18 -18
- package/typings/common/safe/numbers/polarity/positive.d.ts +4 -4
- package/typings/common/safe/strings/char.d.ts +1 -1
- package/typings/common/safe/strings/stringful/index.d.ts +1 -1
- package/typings/common/safe/strings/stringful/length/index.d.ts +3 -3
- package/typings/common/utility/interface/build/particord/index.d.ts +1 -1
- package/typings/common/utility/interface/build/properties/Field.d.ts +1 -1
- package/typings/common/utility/interface/build/properties/Flag.d.ts +1 -1
- package/typings/common/utility/interface/build/properties/Limit.d.ts +8 -8
- package/typings/common/utility/interface/build/properties/List.d.ts +1 -1
- package/typings/common/utility/interface/build/properties/Listish.d.ts +1 -1
- package/typings/common/utility/interface/build/properties/Scalar.d.ts +1 -1
- package/typings/common/utility/interface/build/properties/property/index.d.ts +8 -8
- package/typings/common/utility/interface/build/recordful/index.d.ts +5 -5
- package/typings/common/utility/interface/build/tables/FieldTable.d.ts +1 -1
- package/typings/common/utility/interface/build/tables/FlagTable.d.ts +1 -1
- package/typings/common/utility/interface/build/tables/ListTable.d.ts +1 -1
- package/typings/common/utility/interface/build/tables/ListishTable.d.ts +1 -1
- package/typings/common/utility/interface/build/tables/ScalarTable.d.ts +1 -1
- package/typings/common/utility/interface/build/tables/table/index.d.ts +3 -3
- package/typings/common/utility/interface/identity/interface/index.d.ts +80 -80
- package/typings/common/utility/interface/identity/keys/index.d.ts +71 -71
- package/typings/common/utility/interface/transform/partial/unrequire/index.d.ts +45 -45
- package/typings/common/utility/iterable/build/arrays/array/index.d.ts +11 -11
- package/typings/common/utility/iterable/build/arrays/index.d.ts +2 -2
- package/typings/common/utility/iterable/build/tuples/index.d.ts +10 -10
- package/typings/common/utility/iterable/build/tuples/tuple/index.d.ts +26 -26
- package/typings/common/utility/iterable/identity/array/index.d.ts +65 -65
- package/typings/common/utility/iterable/identity/array/length/index.d.ts +16 -16
- package/typings/common/utility/iterable/identity/dyad.d.ts +3 -3
- package/typings/common/utility/iterable/identity/monad.d.ts +48 -48
- package/typings/common/utility/iterable/identity/triad.d.ts +3 -3
- package/typings/common/utility/iterable/transform/flat/index.d.ts +3 -3
- package/typings/common/utility/iterable/transform/flat/unflat/index.d.ts +3 -3
- package/typings/common/utility/iterable/transform/string/index.d.ts +30 -30
- package/typings/common/utility/iterable/transform/string/stringify/index.d.ts +27 -27
- package/typings/common/utility/nullable/index.d.ts +1 -1
- package/typings/common/utility/nullable/index.spec.d.ts +13 -13
- package/typings/common/utility/nullable/null/index.d.ts +1 -1
- package/typings/common/utility/nullable/null/index.spec.d.ts +13 -13
- package/typings/common/utility/object/build/index.d.ts +3 -3
- package/typings/common/utility/primitive/boolean/true/index.d.ts +30 -30
- package/typings/common/utility/primitive/index.d.ts +42 -42
- package/typings/common/utility/primitive/number/length/index.d.ts +35 -35
- package/typings/common/utility/primitive/number/length/numbered/index.d.ts +35 -35
- package/typings/common/utility/primitive/string/fake/index.d.ts +1 -1
- package/typings/common/utility/primitive/string/literalful/index.d.ts +28 -28
- package/typings/common/utility/primitive/string/literalful/literal/index.d.ts +22 -22
- package/typings/common/utility/test.d.ts +2 -2
- package/typings/common/valid/index.d.ts +7 -7
- package/typings/common/valid/string/index.d.ts +1 -1
|
@@ -1,91 +1,91 @@
|
|
|
1
|
-
import globals from "globals";
|
|
2
|
-
import type { Ruleset } from "../../rulesets/ruleset";
|
|
3
|
-
import type {
|
|
4
|
-
Scope,
|
|
5
|
-
Input,
|
|
6
|
-
Output,
|
|
7
|
-
OptionTemplate,
|
|
8
|
-
LanguageOptions,
|
|
9
|
-
Plugins,
|
|
10
|
-
Globals,
|
|
11
|
-
} from "./template";
|
|
12
|
-
|
|
13
|
-
export default abstract class Option<
|
|
14
|
-
S extends Scope,
|
|
15
|
-
Plugin extends keyof Input["plugins"],
|
|
16
|
-
IsEcma extends boolean = true,
|
|
17
|
-
ParserOptions extends object | boolean = false,
|
|
18
|
-
ParserCount extends 0 | 1 | 2 = 0,
|
|
19
|
-
Global extends Globals = never,
|
|
20
|
-
Processor extends object = never,
|
|
21
|
-
> {
|
|
22
|
-
private readonly linterOptions = { noInlineConfig: true, reportUnusedDisableDirectives: "error" } as const;
|
|
23
|
-
|
|
24
|
-
public abstract readonly scope: literalful<S>;
|
|
25
|
-
public abstract readonly processor: Interface<Processor> extends never
|
|
26
|
-
? object
|
|
27
|
-
: Interface<Processor> extends Readonly<Record<"processor", string>>
|
|
28
|
-
? Interface<Processor>
|
|
29
|
-
: object;
|
|
30
|
-
|
|
31
|
-
constructor(
|
|
32
|
-
public readonly plugins: Plugins<Plugin>,
|
|
33
|
-
public readonly parser: Tuple<ParserCount, unknown>,
|
|
34
|
-
public readonly files: string[],
|
|
35
|
-
public readonly ruleset: Ruleset,
|
|
36
|
-
) {}
|
|
37
|
-
|
|
38
|
-
public get configs(): Output {
|
|
39
|
-
const {
|
|
40
|
-
scope,
|
|
41
|
-
ruleset,
|
|
42
|
-
files,
|
|
43
|
-
option,
|
|
44
|
-
} = this;
|
|
45
|
-
|
|
46
|
-
if (ruleset.scope !== scope)
|
|
47
|
-
throw new TypeError(`Scope mismatch between option and ruleset`, { cause: { option: scope, ruleset: ruleset.scope } });
|
|
48
|
-
|
|
49
|
-
return files.length < 1
|
|
50
|
-
? []
|
|
51
|
-
: ruleset.ruleset.map(({ id, rule }) => {
|
|
52
|
-
return {
|
|
53
|
-
name: `linted/${id}`,
|
|
54
|
-
files,
|
|
55
|
-
rules: rule,
|
|
56
|
-
...option,
|
|
57
|
-
};
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
private get option() {
|
|
62
|
-
try {
|
|
63
|
-
const {
|
|
64
|
-
plugins,
|
|
65
|
-
linterOptions,
|
|
66
|
-
languageOptions,
|
|
67
|
-
processor,
|
|
68
|
-
} = this;
|
|
69
|
-
|
|
70
|
-
return {
|
|
71
|
-
plugins,
|
|
72
|
-
linterOptions,
|
|
73
|
-
languageOptions,
|
|
74
|
-
...processor,
|
|
75
|
-
} satisfies OptionTemplate<
|
|
76
|
-
Plugin,
|
|
77
|
-
IsEcma,
|
|
78
|
-
ParserOptions,
|
|
79
|
-
Global,
|
|
80
|
-
Processor
|
|
81
|
-
>;
|
|
82
|
-
}
|
|
83
|
-
catch (e) { throw new Error(`linted.factory.Option/scope:${this.scope}: option`, { cause: e }); }
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
protected abstract get languageOptions(): LanguageOptions<IsEcma, ParserOptions, Global>;
|
|
87
|
-
|
|
88
|
-
protected globals(type: Global) {
|
|
89
|
-
return globals[type];
|
|
90
|
-
}
|
|
91
|
-
}
|
|
1
|
+
import globals from "globals";
|
|
2
|
+
import type { Ruleset } from "../../rulesets/ruleset";
|
|
3
|
+
import type {
|
|
4
|
+
Scope,
|
|
5
|
+
Input,
|
|
6
|
+
Output,
|
|
7
|
+
OptionTemplate,
|
|
8
|
+
LanguageOptions,
|
|
9
|
+
Plugins,
|
|
10
|
+
Globals,
|
|
11
|
+
} from "./template";
|
|
12
|
+
|
|
13
|
+
export default abstract class Option<
|
|
14
|
+
S extends Scope,
|
|
15
|
+
Plugin extends keyof Input["plugins"],
|
|
16
|
+
IsEcma extends boolean = true,
|
|
17
|
+
ParserOptions extends object | boolean = false,
|
|
18
|
+
ParserCount extends 0 | 1 | 2 = 0,
|
|
19
|
+
Global extends Globals = never,
|
|
20
|
+
Processor extends object = never,
|
|
21
|
+
> {
|
|
22
|
+
private readonly linterOptions = { noInlineConfig: true, reportUnusedDisableDirectives: "error" } as const;
|
|
23
|
+
|
|
24
|
+
public abstract readonly scope: literalful<S>;
|
|
25
|
+
public abstract readonly processor: Interface<Processor> extends never
|
|
26
|
+
? object
|
|
27
|
+
: Interface<Processor> extends Readonly<Record<"processor", string>>
|
|
28
|
+
? Interface<Processor>
|
|
29
|
+
: object;
|
|
30
|
+
|
|
31
|
+
constructor(
|
|
32
|
+
public readonly plugins: Plugins<Plugin>,
|
|
33
|
+
public readonly parser: Tuple<ParserCount, unknown>,
|
|
34
|
+
public readonly files: string[],
|
|
35
|
+
public readonly ruleset: Ruleset,
|
|
36
|
+
) {}
|
|
37
|
+
|
|
38
|
+
public get configs(): Output {
|
|
39
|
+
const {
|
|
40
|
+
scope,
|
|
41
|
+
ruleset,
|
|
42
|
+
files,
|
|
43
|
+
option,
|
|
44
|
+
} = this;
|
|
45
|
+
|
|
46
|
+
if (ruleset.scope !== scope)
|
|
47
|
+
throw new TypeError(`Scope mismatch between option and ruleset`, { cause: { option: scope, ruleset: ruleset.scope } });
|
|
48
|
+
|
|
49
|
+
return files.length < 1
|
|
50
|
+
? []
|
|
51
|
+
: ruleset.ruleset.map(({ id, rule }) => {
|
|
52
|
+
return {
|
|
53
|
+
name: `linted/${id}`,
|
|
54
|
+
files,
|
|
55
|
+
rules: rule,
|
|
56
|
+
...option,
|
|
57
|
+
};
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
private get option() {
|
|
62
|
+
try {
|
|
63
|
+
const {
|
|
64
|
+
plugins,
|
|
65
|
+
linterOptions,
|
|
66
|
+
languageOptions,
|
|
67
|
+
processor,
|
|
68
|
+
} = this;
|
|
69
|
+
|
|
70
|
+
return {
|
|
71
|
+
plugins,
|
|
72
|
+
linterOptions,
|
|
73
|
+
languageOptions,
|
|
74
|
+
...processor,
|
|
75
|
+
} satisfies OptionTemplate<
|
|
76
|
+
Plugin,
|
|
77
|
+
IsEcma,
|
|
78
|
+
ParserOptions,
|
|
79
|
+
Global,
|
|
80
|
+
Processor
|
|
81
|
+
>;
|
|
82
|
+
}
|
|
83
|
+
catch (e) { throw new Error(`linted.factory.Option/scope:${this.scope}: option`, { cause: e }); }
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
protected abstract get languageOptions(): LanguageOptions<IsEcma, ParserOptions, Global>;
|
|
87
|
+
|
|
88
|
+
protected globals(type: Global) {
|
|
89
|
+
return globals[type];
|
|
90
|
+
}
|
|
91
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type globals from "globals";
|
|
2
|
-
|
|
3
|
-
export type Globals = keyof typeof globals & (
|
|
4
|
-
| "mocha"
|
|
5
|
-
);
|
|
1
|
+
import type globals from "globals";
|
|
2
|
+
|
|
3
|
+
export type Globals = keyof typeof globals & (
|
|
4
|
+
| "mocha"
|
|
5
|
+
);
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
export type { Scope, Input, Output } from "../..";
|
|
2
|
-
|
|
3
|
-
import type { LanguageOptions } from "./language";
|
|
4
|
-
import type { Linter } from "./linter";
|
|
5
|
-
import type { Plugins } from "./plugins";
|
|
6
|
-
import type { Globals } from "./globals";
|
|
7
|
-
|
|
8
|
-
export type {
|
|
9
|
-
LanguageOptions,
|
|
10
|
-
Linter,
|
|
11
|
-
Plugins,
|
|
12
|
-
Globals,
|
|
13
|
-
};
|
|
14
|
-
export type OptionTemplate<
|
|
15
|
-
PluginId extends string,
|
|
16
|
-
IsEcma extends boolean,
|
|
17
|
-
ParserOptions extends boolean | object,
|
|
18
|
-
GlobalTypes extends Globals,
|
|
19
|
-
Processor extends object,
|
|
20
|
-
> =
|
|
21
|
-
& {
|
|
22
|
-
linterOptions: Linter;
|
|
23
|
-
languageOptions: LanguageOptions<IsEcma, ParserOptions, GlobalTypes>;
|
|
24
|
-
}
|
|
25
|
-
& (Plugins<PluginId> extends never ? object : { plugins: Plugins<PluginId> })
|
|
26
|
-
& (Interface<Processor> extends never ? object : Interface<Processor> extends { processor: string } ? Interface<Processor> : object);
|
|
1
|
+
export type { Scope, Input, Output } from "../..";
|
|
2
|
+
|
|
3
|
+
import type { LanguageOptions } from "./language";
|
|
4
|
+
import type { Linter } from "./linter";
|
|
5
|
+
import type { Plugins } from "./plugins";
|
|
6
|
+
import type { Globals } from "./globals";
|
|
7
|
+
|
|
8
|
+
export type {
|
|
9
|
+
LanguageOptions,
|
|
10
|
+
Linter,
|
|
11
|
+
Plugins,
|
|
12
|
+
Globals,
|
|
13
|
+
};
|
|
14
|
+
export type OptionTemplate<
|
|
15
|
+
PluginId extends string,
|
|
16
|
+
IsEcma extends boolean,
|
|
17
|
+
ParserOptions extends boolean | object,
|
|
18
|
+
GlobalTypes extends Globals,
|
|
19
|
+
Processor extends object,
|
|
20
|
+
> =
|
|
21
|
+
& {
|
|
22
|
+
linterOptions: Linter;
|
|
23
|
+
languageOptions: LanguageOptions<IsEcma, ParserOptions, GlobalTypes>;
|
|
24
|
+
}
|
|
25
|
+
& (Plugins<PluginId> extends never ? object : { plugins: Plugins<PluginId> })
|
|
26
|
+
& (Interface<Processor> extends never ? object : Interface<Processor> extends { processor: string } ? Interface<Processor> : object);
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export type EcmaVersion = (
|
|
2
|
-
| "latest"
|
|
3
|
-
);
|
|
1
|
+
export type EcmaVersion = (
|
|
2
|
+
| "latest"
|
|
3
|
+
);
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import type { EcmaVersion } from "./ecma";
|
|
2
|
-
import type { SourceType } from "./source";
|
|
3
|
-
|
|
4
|
-
export type LanguageOptions<
|
|
5
|
-
IsEcma extends boolean,
|
|
6
|
-
ParserOptions extends object | boolean,
|
|
7
|
-
GlobalTypes extends string,
|
|
8
|
-
> =
|
|
9
|
-
& (True<IsEcma> extends never ? object : { ecmaVersion: EcmaVersion; sourceType: SourceType })
|
|
10
|
-
& (literalful<GlobalTypes> extends never ? object : { globals: Record<string, unknown> })
|
|
11
|
-
& (
|
|
12
|
-
ParserOptions extends boolean
|
|
13
|
-
? True<ParserOptions> extends never
|
|
14
|
-
? object
|
|
15
|
-
: { parser: unknown }
|
|
16
|
-
: ParserOptions extends object
|
|
17
|
-
? Interface<ParserOptions> extends never
|
|
18
|
-
? object
|
|
19
|
-
: { parser: unknown; parserOptions: ParserOptions }
|
|
20
|
-
: object
|
|
21
|
-
);
|
|
1
|
+
import type { EcmaVersion } from "./ecma";
|
|
2
|
+
import type { SourceType } from "./source";
|
|
3
|
+
|
|
4
|
+
export type LanguageOptions<
|
|
5
|
+
IsEcma extends boolean,
|
|
6
|
+
ParserOptions extends object | boolean,
|
|
7
|
+
GlobalTypes extends string,
|
|
8
|
+
> =
|
|
9
|
+
& (True<IsEcma> extends never ? object : { ecmaVersion: EcmaVersion; sourceType: SourceType })
|
|
10
|
+
& (literalful<GlobalTypes> extends never ? object : { globals: Record<string, unknown> })
|
|
11
|
+
& (
|
|
12
|
+
ParserOptions extends boolean
|
|
13
|
+
? True<ParserOptions> extends never
|
|
14
|
+
? object
|
|
15
|
+
: { parser: unknown }
|
|
16
|
+
: ParserOptions extends object
|
|
17
|
+
? Interface<ParserOptions> extends never
|
|
18
|
+
? object
|
|
19
|
+
: { parser: unknown; parserOptions: ParserOptions }
|
|
20
|
+
: object
|
|
21
|
+
);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type SourceType = (
|
|
2
|
-
| "module"
|
|
3
|
-
| "script"
|
|
4
|
-
);
|
|
1
|
+
export type SourceType = (
|
|
2
|
+
| "module"
|
|
3
|
+
| "script"
|
|
4
|
+
);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export interface Linter {
|
|
2
|
-
noInlineConfig: boolean;
|
|
3
|
-
reportUnusedDisableDirectives:
|
|
4
|
-
| "error"
|
|
5
|
-
| "warn"
|
|
6
|
-
| "off"
|
|
7
|
-
;
|
|
8
|
-
}
|
|
1
|
+
export interface Linter {
|
|
2
|
+
noInlineConfig: boolean;
|
|
3
|
+
reportUnusedDisableDirectives:
|
|
4
|
+
| "error"
|
|
5
|
+
| "warn"
|
|
6
|
+
| "off"
|
|
7
|
+
;
|
|
8
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export type Plugins<PluginId extends string> = Record<literalful<PluginId>, { configs: unknown }>;
|
|
1
|
+
export type Plugins<PluginId extends string> = Record<literalful<PluginId>, { configs: unknown }>;
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import Option from "./option";
|
|
2
|
-
import type Ts from "./ts";
|
|
3
|
-
|
|
4
|
-
export default class Svelte extends Option<
|
|
5
|
-
"svelte",
|
|
6
|
-
"svelte" | keyof Ts["option"]["plugins"],
|
|
7
|
-
true,
|
|
8
|
-
{ parser: unknown } & { extraFileExtensions: readonly [".svelte"] } & Ts["option"]["languageOptions"]["parserOptions"],
|
|
9
|
-
2,
|
|
10
|
-
never,
|
|
11
|
-
{ processor: "svelte/svelte" }
|
|
12
|
-
> {
|
|
13
|
-
public readonly scope = "svelte";
|
|
14
|
-
public readonly processor = { processor: "svelte/svelte" } as const;
|
|
15
|
-
|
|
16
|
-
public get languageOptions() {
|
|
17
|
-
const [parser, tsParser] = this.parser;
|
|
18
|
-
|
|
19
|
-
return {
|
|
20
|
-
ecmaVersion: "latest",
|
|
21
|
-
sourceType: "module",
|
|
22
|
-
parser,
|
|
23
|
-
parserOptions: {
|
|
24
|
-
parser: tsParser,
|
|
25
|
-
extraFileExtensions: [".svelte"] as const,
|
|
26
|
-
project: "tsconfig.json",
|
|
27
|
-
ecmaVersion: "latest",
|
|
28
|
-
sourceType: "module",
|
|
29
|
-
},
|
|
30
|
-
} as const;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
1
|
+
import Option from "./option";
|
|
2
|
+
import type Ts from "./ts";
|
|
3
|
+
|
|
4
|
+
export default class Svelte extends Option<
|
|
5
|
+
"svelte",
|
|
6
|
+
"svelte" | keyof Ts["option"]["plugins"],
|
|
7
|
+
true,
|
|
8
|
+
{ parser: unknown } & { extraFileExtensions: readonly [".svelte"] } & Ts["option"]["languageOptions"]["parserOptions"],
|
|
9
|
+
2,
|
|
10
|
+
never,
|
|
11
|
+
{ processor: "svelte/svelte" }
|
|
12
|
+
> {
|
|
13
|
+
public readonly scope = "svelte";
|
|
14
|
+
public readonly processor = { processor: "svelte/svelte" } as const;
|
|
15
|
+
|
|
16
|
+
public get languageOptions() {
|
|
17
|
+
const [parser, tsParser] = this.parser;
|
|
18
|
+
|
|
19
|
+
return {
|
|
20
|
+
ecmaVersion: "latest",
|
|
21
|
+
sourceType: "module",
|
|
22
|
+
parser,
|
|
23
|
+
parserOptions: {
|
|
24
|
+
parser: tsParser,
|
|
25
|
+
extraFileExtensions: [".svelte"] as const,
|
|
26
|
+
project: "tsconfig.json",
|
|
27
|
+
ecmaVersion: "latest",
|
|
28
|
+
sourceType: "module",
|
|
29
|
+
},
|
|
30
|
+
} as const;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import Option from "./option";
|
|
2
|
-
import type Js from "./js";
|
|
3
|
-
|
|
4
|
-
export default class Ts extends Option<
|
|
5
|
-
"ts",
|
|
6
|
-
"@typescript-eslint" | keyof Js["option"]["plugins"],
|
|
7
|
-
true,
|
|
8
|
-
{ project: "tsconfig.json" } & Js["option"]["languageOptions"],
|
|
9
|
-
1
|
|
10
|
-
> {
|
|
11
|
-
public readonly scope = "ts";
|
|
12
|
-
public readonly processor = {} as const;
|
|
13
|
-
|
|
14
|
-
public get languageOptions() {
|
|
15
|
-
const [parser] = this.parser;
|
|
16
|
-
|
|
17
|
-
return {
|
|
18
|
-
ecmaVersion: "latest",
|
|
19
|
-
sourceType: "module",
|
|
20
|
-
parser,
|
|
21
|
-
parserOptions: { project: "tsconfig.json", ecmaVersion: "latest", sourceType: "module" },
|
|
22
|
-
} as const;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
1
|
+
import Option from "./option";
|
|
2
|
+
import type Js from "./js";
|
|
3
|
+
|
|
4
|
+
export default class Ts extends Option<
|
|
5
|
+
"ts",
|
|
6
|
+
"@typescript-eslint" | keyof Js["option"]["plugins"],
|
|
7
|
+
true,
|
|
8
|
+
{ project: "tsconfig.json" } & Js["option"]["languageOptions"],
|
|
9
|
+
1
|
|
10
|
+
> {
|
|
11
|
+
public readonly scope = "ts";
|
|
12
|
+
public readonly processor = {} as const;
|
|
13
|
+
|
|
14
|
+
public get languageOptions() {
|
|
15
|
+
const [parser] = this.parser;
|
|
16
|
+
|
|
17
|
+
return {
|
|
18
|
+
ecmaVersion: "latest",
|
|
19
|
+
sourceType: "module",
|
|
20
|
+
parser,
|
|
21
|
+
parserOptions: { project: "tsconfig.json", ecmaVersion: "latest", sourceType: "module" },
|
|
22
|
+
} as const;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import Option from "./option";
|
|
2
|
-
|
|
3
|
-
export default class Yml extends Option<
|
|
4
|
-
"yml",
|
|
5
|
-
"yml",
|
|
6
|
-
false,
|
|
7
|
-
true,
|
|
8
|
-
1
|
|
9
|
-
> {
|
|
10
|
-
public readonly scope = "yml";
|
|
11
|
-
public readonly processor = {} as const;
|
|
12
|
-
|
|
13
|
-
public get languageOptions() {
|
|
14
|
-
const [parser] = this.parser;
|
|
15
|
-
|
|
16
|
-
return { parser } as const;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
1
|
+
import Option from "./option";
|
|
2
|
+
|
|
3
|
+
export default class Yml extends Option<
|
|
4
|
+
"yml",
|
|
5
|
+
"yml",
|
|
6
|
+
false,
|
|
7
|
+
true,
|
|
8
|
+
1
|
|
9
|
+
> {
|
|
10
|
+
public readonly scope = "yml";
|
|
11
|
+
public readonly processor = {} as const;
|
|
12
|
+
|
|
13
|
+
public get languageOptions() {
|
|
14
|
+
const [parser] = this.parser;
|
|
15
|
+
|
|
16
|
+
return { parser } as const;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import type { Input } from "..";
|
|
2
|
-
|
|
3
|
-
export type { Input };
|
|
4
|
-
|
|
5
|
-
import { Ruleset } from "./ruleset";
|
|
6
|
-
|
|
7
|
-
export class Rulesets {
|
|
8
|
-
private readonly rulesets = new Map<string, Ruleset>();
|
|
9
|
-
|
|
10
|
-
constructor(rules: Input["rules"]) {
|
|
11
|
-
const { rules: base, overrides } = rules,
|
|
12
|
-
scopes = Object.keys(base) as (keyof typeof base)[];
|
|
13
|
-
|
|
14
|
-
for (const scope of scopes)
|
|
15
|
-
this.rulesets.set(scope, new Ruleset(scope, base[scope], overrides[scope]));
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
public ruleset(scope: string): Ruleset {
|
|
19
|
-
if (!this.rulesets.has(scope))
|
|
20
|
-
throw new ReferenceError(`Ruleset not found for scope: ${scope}`);
|
|
21
|
-
|
|
22
|
-
return this.rulesets.get(scope) as Ruleset;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
1
|
+
import type { Input } from "..";
|
|
2
|
+
|
|
3
|
+
export type { Input };
|
|
4
|
+
|
|
5
|
+
import { Ruleset } from "./ruleset";
|
|
6
|
+
|
|
7
|
+
export class Rulesets {
|
|
8
|
+
private readonly rulesets = new Map<string, Ruleset>();
|
|
9
|
+
|
|
10
|
+
constructor(rules: Input["rules"]) {
|
|
11
|
+
const { rules: base, overrides } = rules,
|
|
12
|
+
scopes = Object.keys(base) as (keyof typeof base)[];
|
|
13
|
+
|
|
14
|
+
for (const scope of scopes)
|
|
15
|
+
this.rulesets.set(scope, new Ruleset(scope, base[scope], overrides[scope]));
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
public ruleset(scope: string): Ruleset {
|
|
19
|
+
if (!this.rulesets.has(scope))
|
|
20
|
+
throw new ReferenceError(`Ruleset not found for scope: ${scope}`);
|
|
21
|
+
|
|
22
|
+
return this.rulesets.get(scope) as Ruleset;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import type { Input } from ".";
|
|
2
|
-
|
|
3
|
-
export class Ruleset {
|
|
4
|
-
public readonly ruleset: { id: string; rule: Input.Rule.Entry.Record }[];
|
|
5
|
-
|
|
6
|
-
constructor(
|
|
7
|
-
public readonly scope: string,
|
|
8
|
-
rules: (readonly [string, Input.Rule.Entry.Record])[],
|
|
9
|
-
override?: Input.Rule.Entry.Record,
|
|
10
|
-
) {
|
|
11
|
-
const map = ([id, rule]: typeof rules[number]) => {
|
|
12
|
-
return {
|
|
13
|
-
id: `${scope}:${id}`,
|
|
14
|
-
rule,
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
this.ruleset = [
|
|
19
|
-
...rules.map(rule => map(rule)),
|
|
20
|
-
...typeof override === "undefined"
|
|
21
|
-
? []
|
|
22
|
-
: [map([`${scope}:override`, override])],
|
|
23
|
-
];
|
|
24
|
-
}
|
|
25
|
-
}
|
|
1
|
+
import type { Input } from ".";
|
|
2
|
+
|
|
3
|
+
export class Ruleset {
|
|
4
|
+
public readonly ruleset: { id: string; rule: Input.Rule.Entry.Record }[];
|
|
5
|
+
|
|
6
|
+
constructor(
|
|
7
|
+
public readonly scope: string,
|
|
8
|
+
rules: (readonly [string, Input.Rule.Entry.Record])[],
|
|
9
|
+
override?: Input.Rule.Entry.Record,
|
|
10
|
+
) {
|
|
11
|
+
const map = ([id, rule]: typeof rules[number]) => {
|
|
12
|
+
return {
|
|
13
|
+
id: `${scope}:${id}`,
|
|
14
|
+
rule,
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
this.ruleset = [
|
|
19
|
+
...rules.map(rule => map(rule)),
|
|
20
|
+
...typeof override === "undefined"
|
|
21
|
+
? []
|
|
22
|
+
: [map([`${scope}:override`, override])],
|
|
23
|
+
];
|
|
24
|
+
}
|
|
25
|
+
}
|