@eslinted/core 3.0.3-rc.2 → 3.0.3
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/boundary/index.d.ts +4 -0
- package/dist/boundary/index.d.ts.map +1 -0
- package/dist/boundary/index.js +2 -0
- package/dist/boundary/index.js.map +1 -0
- package/dist/boundary/input/files/base/index.d.ts +4 -0
- package/dist/boundary/input/files/base/index.d.ts.map +1 -0
- package/dist/boundary/input/files/base/index.js +2 -0
- package/dist/boundary/input/files/base/index.js.map +1 -0
- package/dist/boundary/input/files/includes/index.d.ts +4 -0
- package/dist/boundary/input/files/includes/index.d.ts.map +1 -0
- package/dist/boundary/input/files/includes/index.js +2 -0
- package/dist/boundary/input/files/includes/index.js.map +1 -0
- package/dist/boundary/input/files/index.d.ts +4 -0
- package/dist/boundary/input/files/index.d.ts.map +1 -0
- package/dist/boundary/input/files/index.js +2 -0
- package/dist/boundary/input/files/index.js.map +1 -0
- package/dist/boundary/input/index.d.ts +6 -0
- package/dist/boundary/input/index.d.ts.map +1 -0
- package/dist/boundary/input/index.js +2 -0
- package/dist/boundary/input/index.js.map +1 -0
- package/dist/boundary/input/parsers/{parsers.d.ts → index.d.ts} +3 -3
- package/dist/boundary/input/parsers/index.d.ts.map +1 -0
- package/dist/boundary/input/parsers/index.js +2 -0
- package/dist/boundary/input/parsers/index.js.map +1 -0
- package/dist/boundary/input/plugins/{plugins.d.ts → index.d.ts} +3 -3
- package/dist/boundary/input/plugins/index.d.ts.map +1 -0
- package/dist/boundary/input/plugins/index.js +2 -0
- package/dist/boundary/input/plugins/index.js.map +1 -0
- package/dist/boundary/input/rules/index.d.ts +4 -0
- package/dist/boundary/input/rules/index.d.ts.map +1 -0
- package/dist/boundary/input/rules/index.js +2 -0
- package/dist/boundary/input/rules/index.js.map +1 -0
- package/dist/boundary/input/rules/overrides/index.d.ts +5 -0
- package/dist/boundary/input/rules/overrides/index.d.ts.map +1 -0
- package/dist/boundary/input/rules/overrides/index.js +2 -0
- package/dist/boundary/input/rules/overrides/index.js.map +1 -0
- package/dist/boundary/input/rules/preset/entry/index.d.ts +4 -0
- package/dist/boundary/input/rules/preset/entry/index.d.ts.map +1 -0
- package/dist/boundary/input/rules/preset/entry/index.js +2 -0
- package/dist/boundary/input/rules/preset/entry/index.js.map +1 -0
- package/dist/boundary/input/rules/preset/entry/object/index.d.ts +4 -0
- package/dist/boundary/input/rules/preset/entry/object/index.d.ts.map +1 -0
- package/dist/boundary/input/rules/preset/entry/object/index.js +2 -0
- package/dist/boundary/input/rules/preset/entry/object/index.js.map +1 -0
- package/dist/boundary/input/rules/preset/entry/object/state/index.d.ts +3 -0
- package/dist/boundary/input/rules/preset/entry/object/state/index.d.ts.map +1 -0
- package/dist/boundary/input/rules/preset/entry/object/state/index.js +2 -0
- package/dist/boundary/input/rules/preset/entry/object/state/index.js.map +1 -0
- package/dist/boundary/input/rules/preset/index.d.ts +5 -0
- package/dist/boundary/input/rules/preset/index.d.ts.map +1 -0
- package/dist/boundary/input/rules/preset/index.js +2 -0
- package/dist/boundary/input/rules/preset/index.js.map +1 -0
- package/dist/boundary/output/config/{config.d.ts → index.d.ts} +2 -2
- package/dist/boundary/output/config/index.d.ts.map +1 -0
- package/dist/boundary/output/config/index.js +2 -0
- package/dist/boundary/output/config/index.js.map +1 -0
- package/dist/boundary/output/index.d.ts +3 -0
- package/dist/boundary/output/index.d.ts.map +1 -0
- package/dist/boundary/output/index.js +2 -0
- package/dist/boundary/output/index.js.map +1 -0
- package/dist/dependency/{dependency.d.ts → index.d.ts} +2 -2
- package/dist/dependency/index.d.ts.map +1 -0
- package/dist/dependency/index.js +2 -0
- package/dist/dependency/index.js.map +1 -0
- package/dist/dependency/parsers/index.d.ts +1 -1
- package/dist/dependency/parsers/index.d.ts.map +1 -1
- package/dist/factory/files/{Files.d.ts → index.d.ts} +3 -3
- package/dist/factory/files/index.d.ts.map +1 -0
- package/dist/factory/files/{Files.js → index.js} +2 -5
- package/dist/factory/files/index.js.map +1 -0
- package/dist/factory/index.d.ts +5 -0
- package/dist/factory/index.d.ts.map +1 -0
- package/dist/factory/index.js +5 -0
- package/dist/factory/index.js.map +1 -0
- package/dist/factory/options/{Options.d.ts → index.d.ts} +1 -1
- package/dist/factory/options/index.d.ts.map +1 -0
- package/dist/factory/options/{Options.js → index.js} +1 -1
- package/dist/factory/options/index.js.map +1 -0
- package/dist/factory/options/option/html/index.d.ts +1 -1
- package/dist/factory/options/option/html/index.d.ts.map +1 -1
- package/dist/factory/options/option/html/index.js +3 -8
- package/dist/factory/options/option/html/index.js.map +1 -1
- package/dist/factory/options/option/{Option.d.ts → index.d.ts} +5 -5
- package/dist/factory/options/option/{Option.d.ts.map → index.d.ts.map} +1 -1
- package/dist/factory/options/option/{Option.js → index.js} +3 -11
- package/dist/factory/options/option/index.js.map +1 -0
- package/dist/factory/options/option/js/index.d.ts +1 -1
- package/dist/factory/options/option/js/index.d.ts.map +1 -1
- package/dist/factory/options/option/js/index.js +5 -10
- package/dist/factory/options/option/js/index.js.map +1 -1
- package/dist/factory/options/option/json/index.d.ts +1 -1
- package/dist/factory/options/option/json/index.d.ts.map +1 -1
- package/dist/factory/options/option/json/index.js +3 -8
- package/dist/factory/options/option/json/index.js.map +1 -1
- package/dist/factory/options/option/jsonc/index.d.ts +1 -1
- package/dist/factory/options/option/jsonc/index.d.ts.map +1 -1
- package/dist/factory/options/option/jsonc/index.js +3 -8
- package/dist/factory/options/option/jsonc/index.js.map +1 -1
- package/dist/factory/options/option/md/index.d.ts +1 -1
- package/dist/factory/options/option/md/index.d.ts.map +1 -1
- package/dist/factory/options/option/md/index.js +3 -8
- package/dist/factory/options/option/md/index.js.map +1 -1
- package/dist/factory/options/option/mocha/index.d.ts +2 -2
- package/dist/factory/options/option/mocha/index.d.ts.map +1 -1
- package/dist/factory/options/option/mocha/index.js +9 -18
- package/dist/factory/options/option/mocha/index.js.map +1 -1
- package/dist/factory/options/option/svelte/index.d.ts +6 -6
- package/dist/factory/options/option/svelte/index.d.ts.map +1 -1
- package/dist/factory/options/option/svelte/index.js +12 -17
- package/dist/factory/options/option/svelte/index.js.map +1 -1
- package/dist/factory/options/option/ts/index.d.ts +4 -4
- package/dist/factory/options/option/ts/index.d.ts.map +1 -1
- package/dist/factory/options/option/ts/index.js +8 -17
- package/dist/factory/options/option/ts/index.js.map +1 -1
- package/dist/factory/options/option/yml/index.d.ts +1 -1
- package/dist/factory/options/option/yml/index.d.ts.map +1 -1
- package/dist/factory/options/option/yml/index.js +3 -8
- package/dist/factory/options/option/yml/index.js.map +1 -1
- package/dist/factory/ruleset/{Ruleset.d.ts → index.d.ts} +4 -4
- package/dist/factory/ruleset/index.d.ts.map +1 -0
- package/dist/factory/ruleset/{Ruleset.js → index.js} +7 -17
- package/dist/factory/ruleset/index.js.map +1 -0
- package/dist/factory/ruleset/rule/{Rule.d.ts → index.d.ts} +2 -2
- package/dist/factory/ruleset/rule/index.d.ts.map +1 -0
- package/dist/factory/ruleset/rule/{Rule.js → index.js} +1 -1
- package/dist/factory/ruleset/rule/index.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -39
- package/dist/index.js.map +1 -1
- package/dist/scopes/{Scopes.d.ts → index.d.ts} +1 -1
- package/dist/scopes/index.d.ts.map +1 -0
- package/dist/scopes/{Scopes.js → index.js} +1 -1
- package/dist/scopes/index.js.map +1 -0
- package/package.json +1 -1
- package/src/boundary/index.ts +4 -0
- package/src/boundary/input/files/base/index.ts +5 -0
- package/src/boundary/input/files/includes/index.ts +5 -0
- package/src/boundary/input/files/index.ts +4 -0
- package/src/boundary/input/index.ts +6 -0
- package/src/boundary/input/parsers/{parsers.ts → index.ts} +2 -6
- package/src/boundary/input/plugins/{plugins.ts → index.ts} +2 -6
- package/src/boundary/input/rules/index.ts +4 -0
- package/src/boundary/input/rules/overrides/index.ts +6 -0
- package/src/boundary/input/rules/preset/entry/index.ts +5 -0
- package/src/boundary/input/rules/preset/entry/object/index.ts +9 -0
- package/src/boundary/input/rules/preset/entry/object/state/index.ts +6 -0
- package/src/boundary/input/rules/preset/index.ts +6 -0
- package/src/boundary/output/config/{config.ts → index.ts} +1 -1
- package/src/boundary/output/index.ts +3 -0
- package/src/dependency/{dependency.ts → index.ts} +1 -5
- package/src/dependency/parsers/index.ts +1 -1
- package/src/factory/files/index.ts +16 -0
- package/src/factory/index.ts +10 -0
- package/src/factory/options/option/html/index.ts +3 -11
- package/src/factory/options/option/{Option.ts → index.ts} +19 -49
- package/src/factory/options/option/js/index.ts +5 -13
- package/src/factory/options/option/json/index.ts +3 -11
- package/src/factory/options/option/jsonc/index.ts +3 -11
- package/src/factory/options/option/md/index.ts +3 -11
- package/src/factory/options/option/mocha/index.ts +11 -23
- package/src/factory/options/option/svelte/index.ts +13 -23
- package/src/factory/options/option/ts/index.ts +9 -22
- package/src/factory/options/option/yml/index.ts +3 -11
- package/src/factory/ruleset/index.ts +40 -0
- package/src/factory/ruleset/rule/{Rule.ts → index.ts} +1 -1
- package/src/index.ts +31 -98
- package/dist/boundary/boundary.d.ts +0 -4
- package/dist/boundary/boundary.d.ts.map +0 -1
- package/dist/boundary/boundary.js +0 -2
- package/dist/boundary/boundary.js.map +0 -1
- package/dist/boundary/input/files/base/base.d.ts +0 -5
- package/dist/boundary/input/files/base/base.d.ts.map +0 -1
- package/dist/boundary/input/files/base/base.js +0 -2
- package/dist/boundary/input/files/base/base.js.map +0 -1
- package/dist/boundary/input/files/base/list/list.d.ts +0 -3
- package/dist/boundary/input/files/base/list/list.d.ts.map +0 -1
- package/dist/boundary/input/files/base/list/list.js +0 -2
- package/dist/boundary/input/files/base/list/list.js.map +0 -1
- package/dist/boundary/input/files/files.d.ts +0 -4
- package/dist/boundary/input/files/files.d.ts.map +0 -1
- package/dist/boundary/input/files/files.js +0 -2
- package/dist/boundary/input/files/files.js.map +0 -1
- package/dist/boundary/input/files/includes/includes.d.ts +0 -4
- package/dist/boundary/input/files/includes/includes.d.ts.map +0 -1
- package/dist/boundary/input/files/includes/includes.js +0 -2
- package/dist/boundary/input/files/includes/includes.js.map +0 -1
- package/dist/boundary/input/input.d.ts +0 -6
- package/dist/boundary/input/input.d.ts.map +0 -1
- package/dist/boundary/input/input.js +0 -2
- package/dist/boundary/input/input.js.map +0 -1
- package/dist/boundary/input/parsers/parsers.d.ts.map +0 -1
- package/dist/boundary/input/parsers/parsers.js +0 -2
- package/dist/boundary/input/parsers/parsers.js.map +0 -1
- package/dist/boundary/input/plugins/plugins.d.ts.map +0 -1
- package/dist/boundary/input/plugins/plugins.js +0 -2
- package/dist/boundary/input/plugins/plugins.js.map +0 -1
- package/dist/boundary/input/rules/overrides/overrides.d.ts +0 -5
- package/dist/boundary/input/rules/overrides/overrides.d.ts.map +0 -1
- package/dist/boundary/input/rules/overrides/overrides.js +0 -2
- package/dist/boundary/input/rules/overrides/overrides.js.map +0 -1
- package/dist/boundary/input/rules/preset/entry/entry.d.ts +0 -4
- package/dist/boundary/input/rules/preset/entry/entry.d.ts.map +0 -1
- package/dist/boundary/input/rules/preset/entry/entry.js +0 -2
- package/dist/boundary/input/rules/preset/entry/entry.js.map +0 -1
- package/dist/boundary/input/rules/preset/entry/object/object.d.ts +0 -4
- package/dist/boundary/input/rules/preset/entry/object/object.d.ts.map +0 -1
- package/dist/boundary/input/rules/preset/entry/object/object.js +0 -2
- package/dist/boundary/input/rules/preset/entry/object/object.js.map +0 -1
- package/dist/boundary/input/rules/preset/entry/object/state/level.d.ts +0 -3
- package/dist/boundary/input/rules/preset/entry/object/state/level.d.ts.map +0 -1
- package/dist/boundary/input/rules/preset/entry/object/state/level.js +0 -2
- package/dist/boundary/input/rules/preset/entry/object/state/level.js.map +0 -1
- package/dist/boundary/input/rules/preset/preset.d.ts +0 -5
- package/dist/boundary/input/rules/preset/preset.d.ts.map +0 -1
- package/dist/boundary/input/rules/preset/preset.js +0 -2
- package/dist/boundary/input/rules/preset/preset.js.map +0 -1
- package/dist/boundary/input/rules/rules.d.ts +0 -4
- package/dist/boundary/input/rules/rules.d.ts.map +0 -1
- package/dist/boundary/input/rules/rules.js +0 -2
- package/dist/boundary/input/rules/rules.js.map +0 -1
- package/dist/boundary/output/config/config.d.ts.map +0 -1
- package/dist/boundary/output/config/config.js +0 -2
- package/dist/boundary/output/config/config.js.map +0 -1
- package/dist/boundary/output/output.d.ts +0 -3
- package/dist/boundary/output/output.d.ts.map +0 -1
- package/dist/boundary/output/output.js +0 -2
- package/dist/boundary/output/output.js.map +0 -1
- package/dist/dependency/dependency.d.ts.map +0 -1
- package/dist/dependency/dependency.js +0 -2
- package/dist/dependency/dependency.js.map +0 -1
- package/dist/factory/factory.d.ts +0 -5
- package/dist/factory/factory.d.ts.map +0 -1
- package/dist/factory/factory.js +0 -5
- package/dist/factory/factory.js.map +0 -1
- package/dist/factory/files/Files.d.ts.map +0 -1
- package/dist/factory/files/Files.js.map +0 -1
- package/dist/factory/options/Options.d.ts.map +0 -1
- package/dist/factory/options/Options.js.map +0 -1
- package/dist/factory/options/option/Option.js.map +0 -1
- package/dist/factory/ruleset/Ruleset.d.ts.map +0 -1
- package/dist/factory/ruleset/Ruleset.js.map +0 -1
- package/dist/factory/ruleset/rule/Rule.d.ts.map +0 -1
- package/dist/factory/ruleset/rule/Rule.js.map +0 -1
- package/dist/scopes/Scopes.d.ts.map +0 -1
- package/dist/scopes/Scopes.js.map +0 -1
- package/src/OmitFilesRuleset.d.ts +0 -1
- package/src/boundary/boundary.ts +0 -4
- package/src/boundary/input/files/base/base.ts +0 -9
- package/src/boundary/input/files/base/list/list.ts +0 -6
- package/src/boundary/input/files/files.ts +0 -7
- package/src/boundary/input/files/includes/includes.ts +0 -8
- package/src/boundary/input/input.ts +0 -9
- package/src/boundary/input/rules/overrides/overrides.ts +0 -9
- package/src/boundary/input/rules/preset/entry/entry.ts +0 -8
- package/src/boundary/input/rules/preset/entry/object/object.ts +0 -12
- package/src/boundary/input/rules/preset/entry/object/state/level.ts +0 -9
- package/src/boundary/input/rules/preset/preset.ts +0 -9
- package/src/boundary/input/rules/rules.ts +0 -7
- package/src/boundary/output/output.ts +0 -3
- package/src/factory/factory.ts +0 -10
- package/src/factory/files/Files.ts +0 -24
- package/src/factory/ruleset/Ruleset.ts +0 -72
- /package/src/boundary/output/config/option/{IOption.d.ts → index.d.ts} +0 -0
- /package/src/boundary/output/config/option/language/ecma/{IOLanguageEcma.d.ts → index.d.ts} +0 -0
- /package/src/boundary/output/config/option/language/{IOLanguage.d.ts → index.d.ts} +0 -0
- /package/src/boundary/output/config/option/language/source/{IOLanguageSource.d.ts → index.d.ts} +0 -0
- /package/src/boundary/output/config/option/linter/{IOLinter.d.ts → index.d.ts} +0 -0
- /package/src/boundary/output/config/option/plugins/{IOPlugins.d.ts → index.d.ts} +0 -0
- /package/src/boundary/output/config/option/processor/{IOProcessor.d.ts → index.d.ts} +0 -0
- /package/src/factory/options/{Options.ts → index.ts} +0 -0
- /package/src/scopes/{Scopes.ts → index.ts} +0 -0
@@ -1,9 +1,5 @@
|
|
1
|
-
import type { Parsers as Dependencies } from "../../../dependency/
|
1
|
+
import type { Parsers as Dependencies } from "../../../dependency/index.js";
|
2
2
|
|
3
3
|
type Parsers = Readonly<Record<Dependencies, unknown>>;
|
4
4
|
|
5
|
-
export type {
|
6
|
-
Parsers as default,
|
7
|
-
Parsers,
|
8
|
-
Dependencies,
|
9
|
-
};
|
5
|
+
export type { Dependencies, Parsers, Parsers as default };
|
@@ -1,9 +1,5 @@
|
|
1
|
-
import type { Plugins as Dependencies } from "../../../dependency/
|
1
|
+
import type { Plugins as Dependencies } from "../../../dependency/index.js";
|
2
2
|
|
3
3
|
type Plugins = Readonly<Record<Dependencies, { configs: unknown }>>;
|
4
4
|
|
5
|
-
export type {
|
6
|
-
Plugins as default,
|
7
|
-
Plugins,
|
8
|
-
Dependencies,
|
9
|
-
};
|
5
|
+
export type { Dependencies, Plugins, Plugins as default };
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import type { Scope } from "../../scopes/index.js";
|
2
|
+
import type { Input } from "../../boundary/index.js";
|
3
|
+
|
4
|
+
export default class Files {
|
5
|
+
constructor(
|
6
|
+
private readonly base: Input.Files.Base,
|
7
|
+
private readonly includes: Input.Files.Includes,
|
8
|
+
) {}
|
9
|
+
|
10
|
+
public files(scope: Scope): readonly string[] {
|
11
|
+
try {
|
12
|
+
return [...this.base[scope], ...this.includes[scope] ?? []];
|
13
|
+
}
|
14
|
+
catch (e) { throw new Error(`linted.factory.Files/scope:${scope}`, { cause: e }); }
|
15
|
+
}
|
16
|
+
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import Option from "../
|
1
|
+
import Option from "../index.js";
|
2
2
|
|
3
3
|
export default class Html extends Option<
|
4
4
|
"html",
|
@@ -11,16 +11,8 @@ export default class Html 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.html: languageOptions`,
|
22
|
-
{ cause: e },
|
23
|
-
);
|
24
|
-
}
|
16
|
+
return { parser } as const;
|
25
17
|
}
|
26
18
|
}
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import globals from "globals";
|
2
|
-
import type { Scope } from "../../../scopes/
|
3
|
-
import type { Ruleset } from "../../
|
4
|
-
import type { Plugins } from "../../../dependency/
|
5
|
-
import type { Output } from "../../../boundary/
|
2
|
+
import type { Scope } from "../../../scopes/index.js";
|
3
|
+
import type { Ruleset } from "../../index.js";
|
4
|
+
import type { Plugins } from "../../../dependency/index.js";
|
5
|
+
import type { Output } from "../../../boundary/index.js";
|
6
6
|
|
7
7
|
export default abstract class Option<
|
8
8
|
S extends Scope,
|
@@ -13,10 +13,7 @@ export default abstract class Option<
|
|
13
13
|
GlobalTypes extends keyof typeof globals = never,
|
14
14
|
Processor extends object = never,
|
15
15
|
> {
|
16
|
-
private readonly linterOptions = {
|
17
|
-
noInlineConfig: true,
|
18
|
-
reportUnusedDisableDirectives: "error",
|
19
|
-
} as const;
|
16
|
+
private readonly linterOptions = { noInlineConfig: true, reportUnusedDisableDirectives: "error" } as const;
|
20
17
|
|
21
18
|
public abstract readonly scope: literalful<S>;
|
22
19
|
public abstract readonly processor: Interface<Processor> extends never
|
@@ -42,35 +39,25 @@ export default abstract class Option<
|
|
42
39
|
} = this;
|
43
40
|
|
44
41
|
if (ruleset.id !== scope)
|
45
|
-
throw new TypeError(
|
46
|
-
`Option and Ruleset scope mismatch`,
|
47
|
-
{ cause: { option: scope, ruleset: ruleset.id } },
|
48
|
-
);
|
42
|
+
throw new TypeError(`Option and Ruleset scope mismatch`, { cause: { option: scope, ruleset: ruleset.id } });
|
49
43
|
else if (files.length < 1)
|
50
44
|
return [];
|
51
45
|
else {
|
52
46
|
const baseName = `linted/scope:${scope}/rule:${ruleset.id}` as const;
|
53
47
|
|
54
|
-
return ruleset.records.map(
|
55
|
-
|
56
|
-
const name = `${baseName}+${ruleId}` as const;
|
48
|
+
return ruleset.records.map(([ruleId, rules]) => {
|
49
|
+
const name = `${baseName}+${ruleId}` as const;
|
57
50
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
);
|
51
|
+
return {
|
52
|
+
name,
|
53
|
+
files,
|
54
|
+
rules,
|
55
|
+
...option,
|
56
|
+
};
|
57
|
+
});
|
66
58
|
}
|
67
59
|
}
|
68
|
-
catch (e) {
|
69
|
-
throw new Error(
|
70
|
-
`linted.factory.Option/scope:${this.scope}: configs`,
|
71
|
-
{ cause: e },
|
72
|
-
);
|
73
|
-
}
|
60
|
+
catch (e) { throw new Error(`linted.factory.Option/scope:${this.scope}: configs`, { cause: e }); }
|
74
61
|
}
|
75
62
|
|
76
63
|
private get option() {
|
@@ -95,29 +82,12 @@ export default abstract class Option<
|
|
95
82
|
Processor
|
96
83
|
>;
|
97
84
|
}
|
98
|
-
catch (e) {
|
99
|
-
throw new Error(
|
100
|
-
`linted.factory.Option/scope:${this.scope}: option`,
|
101
|
-
{ cause: e },
|
102
|
-
);
|
103
|
-
}
|
85
|
+
catch (e) { throw new Error(`linted.factory.Option/scope:${this.scope}: option`, { cause: e }); }
|
104
86
|
}
|
105
87
|
|
106
|
-
protected abstract get languageOptions(): IOLanguage<
|
107
|
-
IsEcma,
|
108
|
-
ParserOptions,
|
109
|
-
GlobalTypes
|
110
|
-
>;
|
88
|
+
protected abstract get languageOptions(): IOLanguage<IsEcma, ParserOptions, GlobalTypes>;
|
111
89
|
|
112
90
|
protected globals(type: GlobalTypes) {
|
113
|
-
|
114
|
-
return globals[type];
|
115
|
-
}
|
116
|
-
catch (e) {
|
117
|
-
throw new Error(
|
118
|
-
`linted.factory.Option/scope:${this.scope}: globals`,
|
119
|
-
{ cause: e },
|
120
|
-
);
|
121
|
-
}
|
91
|
+
return globals[type];
|
122
92
|
}
|
123
93
|
}
|
@@ -1,21 +1,13 @@
|
|
1
|
-
import Option from "../
|
1
|
+
import Option from "../index.js";
|
2
2
|
|
3
3
|
export default class Js extends Option<"js", "@stylistic"> {
|
4
4
|
public readonly scope = "js";
|
5
5
|
public readonly processor = {};
|
6
6
|
|
7
7
|
public get languageOptions() {
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
} as const;
|
13
|
-
}
|
14
|
-
catch (e) {
|
15
|
-
throw new Error(
|
16
|
-
`linted.factory.options.js: languageOptions`,
|
17
|
-
{ cause: e },
|
18
|
-
);
|
19
|
-
}
|
8
|
+
return {
|
9
|
+
ecmaVersion: "latest",
|
10
|
+
sourceType: "module",
|
11
|
+
} as const;
|
20
12
|
}
|
21
13
|
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import Option from "../
|
1
|
+
import Option from "../index.js";
|
2
2
|
|
3
3
|
export default class Json extends Option<
|
4
4
|
"json",
|
@@ -11,16 +11,8 @@ export default class Json 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.json: languageOptions`,
|
22
|
-
{ cause: e },
|
23
|
-
);
|
24
|
-
}
|
16
|
+
return { parser } as const;
|
25
17
|
}
|
26
18
|
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import Option from "../
|
1
|
+
import Option from "../index.js";
|
2
2
|
|
3
3
|
export default class Jsonc extends Option<
|
4
4
|
"jsonc",
|
@@ -11,16 +11,8 @@ export default class Jsonc 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.jsonc: languageOptions`,
|
22
|
-
{ cause: e },
|
23
|
-
);
|
24
|
-
}
|
16
|
+
return { parser } as const;
|
25
17
|
}
|
26
18
|
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import Option from "../
|
1
|
+
import Option from "../index.js";
|
2
2
|
|
3
3
|
export default class Md extends Option<
|
4
4
|
"md",
|
@@ -11,16 +11,8 @@ export default class Md 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.md: languageOptions`,
|
22
|
-
{ cause: e },
|
23
|
-
);
|
24
|
-
}
|
16
|
+
return { parser } as const;
|
25
17
|
}
|
26
18
|
}
|
@@ -1,11 +1,11 @@
|
|
1
|
-
import Option from "../
|
1
|
+
import Option from "../index.js";
|
2
2
|
import type Ts from "../ts/index.js";
|
3
3
|
|
4
4
|
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
|
}
|
@@ -1,13 +1,11 @@
|
|
1
|
-
import Option from "../
|
1
|
+
import Option from "../index.js";
|
2
2
|
import type Ts from "../ts/index.js";
|
3
3
|
|
4
4
|
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
|
}
|
@@ -1,37 +1,24 @@
|
|
1
|
-
import Option from "../
|
1
|
+
import Option from "../index.js";
|
2
2
|
import type Js from "../js/index.js";
|
3
3
|
|
4
4
|
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
|
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import Option from "../
|
1
|
+
import Option from "../index.js";
|
2
2
|
|
3
3
|
export default class Yml extends Option<
|
4
4
|
"yml",
|
@@ -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
|
}
|
@@ -0,0 +1,40 @@
|
|
1
|
+
import type { Scope } from "../../scopes/index.js";
|
2
|
+
import Rule from "./rule/index.js";
|
3
|
+
|
4
|
+
export { Rule };
|
5
|
+
export default class Ruleset<S extends Scope> {
|
6
|
+
public readonly ruleset: readonly Rule[];
|
7
|
+
public overrides: Null<Rule> = null;
|
8
|
+
|
9
|
+
constructor(private readonly scope: literalful<S>, ...rules: readonly Rule[]) {
|
10
|
+
try {
|
11
|
+
this.ruleset = [...rules];
|
12
|
+
}
|
13
|
+
catch (e) { throw new Error(`linted.factory.Ruleset`, { cause: e }); }
|
14
|
+
}
|
15
|
+
|
16
|
+
public get id() {
|
17
|
+
const { scope } = this;
|
18
|
+
|
19
|
+
return scope;
|
20
|
+
}
|
21
|
+
|
22
|
+
public get records() {
|
23
|
+
try {
|
24
|
+
const { ruleset, overrides } = this;
|
25
|
+
|
26
|
+
return [
|
27
|
+
...ruleset.map(rules => [rules.id, rules.rules] as const),
|
28
|
+
...overrides === null ? [] : [[overrides.id, overrides.rules] as const] as const,
|
29
|
+
];
|
30
|
+
}
|
31
|
+
catch (e) { throw new Error(`linted.factory.Ruleset: records`, { cause: e }); }
|
32
|
+
}
|
33
|
+
|
34
|
+
public override(overrides: undefined | Rule["rules"]) {
|
35
|
+
if (typeof overrides !== "undefined")
|
36
|
+
this.overrides = new Rule("override", overrides);
|
37
|
+
|
38
|
+
return this;
|
39
|
+
}
|
40
|
+
}
|