@eslinted/core 0.6.0 → 0.7.0-rc.4
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/boundary/boundary.d.ts +6 -0
- package/dist/boundary/boundary.d.ts.map +1 -0
- package/dist/boundary/boundary.js +3 -0
- package/dist/boundary/boundary.js.map +1 -0
- package/dist/boundary/input/input.d.ts +5 -0
- package/dist/boundary/input/input.d.ts.map +1 -0
- package/dist/boundary/input/input.js +2 -0
- package/dist/boundary/input/input.js.map +1 -0
- package/dist/boundary/input/parsers/index.d.ts +5 -0
- 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/parsers/parsers.d.ts +7 -0
- package/dist/boundary/input/parsers/parsers.d.ts.map +1 -0
- package/dist/boundary/input/parsers/parsers.js +2 -0
- package/dist/boundary/input/parsers/parsers.js.map +1 -0
- package/dist/boundary/input/plugins/index.d.ts +32 -0
- 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/plugins/plugins.d.ts +6 -0
- package/dist/boundary/input/plugins/plugins.d.ts.map +1 -0
- package/dist/boundary/input/plugins/plugins.js +2 -0
- package/dist/boundary/input/plugins/plugins.js.map +1 -0
- package/dist/boundary/output/config/IConfig.d.ts +19 -0
- package/dist/boundary/output/config/IConfig.d.ts.map +1 -0
- package/dist/boundary/output/config/IConfig.js +2 -0
- package/dist/boundary/output/config/IConfig.js.map +1 -0
- package/dist/boundary/output/config/index.d.ts +19 -0
- 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/output.d.ts +3 -0
- package/dist/boundary/output/output.d.ts.map +1 -0
- package/dist/boundary/output/output.js +2 -0
- package/dist/boundary/output/output.js.map +1 -0
- package/dist/boundary/scopes/scopes.d.ts +4 -0
- package/dist/boundary/scopes/scopes.d.ts.map +1 -0
- package/dist/boundary/scopes/scopes.js +11 -0
- package/dist/boundary/scopes/scopes.js.map +1 -0
- package/dist/factory/Factory.d.ts +7 -0
- package/dist/factory/Factory.d.ts.map +1 -0
- package/dist/factory/Factory.js +5 -0
- package/dist/factory/Factory.js.map +1 -0
- package/dist/factory/files/Files.d.ts +8 -0
- package/dist/factory/files/Files.d.ts.map +1 -0
- package/dist/factory/files/Files.js +15 -0
- package/dist/factory/files/Files.js.map +1 -0
- package/dist/factory/options/Options.d.ts +20 -0
- package/dist/factory/options/Options.d.ts.map +1 -0
- package/dist/factory/options/Options.js +17 -0
- package/dist/factory/options/Options.js.map +1 -0
- package/dist/factory/options/option/Option.d.ts +29 -0
- package/dist/factory/options/option/Option.d.ts.map +1 -0
- package/dist/factory/options/option/Option.js +26 -0
- package/dist/factory/options/option/Option.js.map +1 -0
- package/dist/factory/options/option/html/index.d.ts +7 -3
- package/dist/factory/options/option/html/index.d.ts.map +1 -1
- package/dist/factory/options/option/html/index.js +6 -12
- package/dist/factory/options/option/html/index.js.map +1 -1
- package/dist/factory/options/option/js/index.d.ts +7 -2
- package/dist/factory/options/option/js/index.d.ts.map +1 -1
- package/dist/factory/options/option/js/index.js +8 -15
- package/dist/factory/options/option/js/index.js.map +1 -1
- package/dist/factory/options/option/json/index.d.ts +7 -3
- package/dist/factory/options/option/json/index.d.ts.map +1 -1
- package/dist/factory/options/option/json/index.js +6 -12
- package/dist/factory/options/option/json/index.js.map +1 -1
- package/dist/factory/options/option/jsonc/index.d.ts +7 -3
- package/dist/factory/options/option/jsonc/index.d.ts.map +1 -1
- package/dist/factory/options/option/jsonc/index.js +6 -12
- package/dist/factory/options/option/jsonc/index.js.map +1 -1
- package/dist/factory/options/option/svelte/index.d.ts +22 -5
- package/dist/factory/options/option/svelte/index.d.ts.map +1 -1
- package/dist/factory/options/option/svelte/index.js +14 -21
- package/dist/factory/options/option/svelte/index.js.map +1 -1
- package/dist/factory/options/option/ts/index.d.ts +15 -4
- package/dist/factory/options/option/ts/index.d.ts.map +1 -1
- package/dist/factory/options/option/ts/index.js +12 -18
- package/dist/factory/options/option/ts/index.js.map +1 -1
- package/dist/factory/options/option/yml/index.d.ts +7 -3
- package/dist/factory/options/option/yml/index.d.ts.map +1 -1
- package/dist/factory/options/option/yml/index.js +6 -12
- package/dist/factory/options/option/yml/index.js.map +1 -1
- package/dist/factory/ruleset/Ruleset.d.ts +12 -0
- package/dist/factory/ruleset/Ruleset.d.ts.map +1 -0
- package/dist/factory/ruleset/Ruleset.js +27 -0
- package/dist/factory/ruleset/Ruleset.js.map +1 -0
- package/dist/factory/ruleset/rule/Rule.d.ts +6 -0
- package/dist/factory/ruleset/rule/Rule.d.ts.map +1 -0
- package/dist/factory/ruleset/rule/Rule.js +9 -0
- package/dist/factory/ruleset/rule/Rule.js.map +1 -0
- package/dist/index.d.ts +3 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +38 -26
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/boundary/boundary.ts +11 -0
- package/src/boundary/input/input.ts +5 -0
- package/src/boundary/input/parsers/parsers.ts +6 -0
- package/src/boundary/input/plugins/plugins.ts +7 -0
- package/src/{config/index.ts → boundary/output/config/IConfig.ts} +3 -4
- package/src/boundary/output/config/interface/option/IOption.d.ts +20 -0
- package/src/boundary/output/config/interface/option/language/IOLanguage.d.ts +18 -0
- package/src/boundary/output/config/interface/option/language/ecma/IOLanguageEcma.d.ts +1 -0
- package/src/boundary/output/config/interface/option/language/globals/IOLanguageGlobals.d.ts +1 -0
- package/src/boundary/output/config/interface/option/language/source/IOLanguageSource.d.ts +3 -0
- package/src/boundary/output/config/interface/option/linter/IOLinter.d.ts +4 -0
- package/src/boundary/output/config/interface/option/name/IOName.d.ts +1 -0
- package/src/boundary/output/config/interface/option/plugins/IOPlugins.d.ts +1 -0
- package/src/boundary/output/config/interface/option/processor/IOProcessor.d.ts +1 -0
- package/src/boundary/output/output.ts +3 -0
- package/src/factory/Factory.ts +13 -0
- package/src/factory/files/Files.ts +15 -0
- package/src/factory/options/{index.ts → Options.ts} +2 -2
- package/src/factory/options/option/Option.ts +58 -0
- package/src/factory/options/option/html/index.ts +10 -23
- package/src/factory/options/option/js/index.ts +9 -20
- package/src/factory/options/option/json/index.ts +10 -23
- package/src/factory/options/option/jsonc/index.ts +10 -23
- package/src/factory/options/option/svelte/index.ts +23 -34
- package/src/factory/options/option/ts/index.ts +20 -29
- package/src/factory/options/option/yml/index.ts +10 -23
- package/src/factory/ruleset/{index.ts → Ruleset.ts} +1 -1
- package/src/index.ts +62 -72
- package/types/project/OmitLast.d.ts +1 -0
- package/src/config/files/IFiles.d.ts +0 -1
- package/src/config/option/IOption.d.ts +0 -25
- package/src/config/option/language/IOLanguage.d.ts +0 -15
- package/src/config/option/language/ecma/IOLanguageEcma.d.ts +0 -19
- package/src/config/option/language/globals/IOLanguageGlobals.d.ts +0 -3
- package/src/config/option/language/parser/IOLanguageParser.d.ts +0 -3
- package/src/config/option/language/parserOptions/IOLanguageParserOptions.d.ts +0 -5
- package/src/config/option/language/source/IOLanguageSource.d.ts +0 -12
- package/src/config/option/linter/IOLinter.d.ts +0 -30
- package/src/config/option/name/IOName.d.ts +0 -3
- package/src/config/option/plugins/IOPlugins.d.ts +0 -3
- package/src/config/option/processor/IOProcessor.d.ts +0 -3
- package/src/config/rules/IRules.d.ts +0 -1
- package/src/factory/files/index.ts +0 -20
- package/src/factory/index.ts +0 -12
- package/src/factory/options/option/index.ts +0 -27
- package/src/module/boundary/index.ts +0 -3
- package/src/module/boundary/parsers/index.ts +0 -12
- package/src/module/boundary/plugins/index.ts +0 -20
- package/src/module/index.ts +0 -9
- /package/src/{config/rules/rule → boundary/output/config/interface/rules}/IRule.d.ts +0 -0
- /package/src/{config/rules/rule → boundary/output/config/interface/rules}/state/RuleSeverity.d.ts +0 -0
- /package/src/{module/scopes/index.ts → boundary/scopes/scopes.ts} +0 -0
- /package/src/factory/ruleset/rule/{index.ts → Rule.ts} +0 -0
- /package/types/{literal → typioca/literal}/number/base32.d.ts +0 -0
- /package/types/{literal → typioca/literal}/number/base64.d.ts +0 -0
- /package/types/{literal → typioca/literal}/number/binary.d.ts +0 -0
- /package/types/{literal → typioca/literal}/number/decimal.d.ts +0 -0
- /package/types/{literal → typioca/literal}/number/hex.d.ts +0 -0
- /package/types/{literal → typioca/literal}/number/octal.d.ts +0 -0
- /package/types/{literal → typioca/literal}/number/quatral.d.ts +0 -0
- /package/types/{literal → typioca/literal}/number/ternary.d.ts +0 -0
- /package/types/{literal → typioca/literal}/string/base64char.d.ts +0 -0
- /package/types/{literal → typioca/literal}/string/digit.d.ts +0 -0
- /package/types/{literal → typioca/literal}/string/hexchar.d.ts +0 -0
- /package/types/{literal → typioca/literal}/string/letter.d.ts +0 -0
- /package/types/{safe → typioca/safe}/Safe.d.ts +0 -0
- /package/types/{safe → typioca/safe}/numbers/finite/Finite.d.ts +0 -0
- /package/types/{safe → typioca/safe}/numbers/finite.d.ts +0 -0
- /package/types/{safe → typioca/safe}/numbers/fint.d.ts +0 -0
- /package/types/{safe → typioca/safe}/numbers/int/Int.d.ts +0 -0
- /package/types/{safe → typioca/safe}/numbers/int.d.ts +0 -0
- /package/types/{safe → typioca/safe}/numbers/numberful.d.ts +0 -0
- /package/types/{safe → typioca/safe}/numbers/polarity/Negative.d.ts +0 -0
- /package/types/{safe → typioca/safe}/numbers/polarity/Positive.d.ts +0 -0
- /package/types/{safe → typioca/safe}/numbers/polarity/pole/Pole.d.ts +0 -0
- /package/types/{safe → typioca/safe}/primitive.d.ts +0 -0
- /package/types/{safe → typioca/safe}/strings/char.d.ts +0 -0
- /package/types/{safe → typioca/safe}/strings/length/PropLength.d.ts +0 -0
- /package/types/{safe → typioca/safe}/strings/stringful.d.ts +0 -0
- /package/types/{utility → typioca/utility}/interface/construct/Particord.d.ts +0 -0
- /package/types/{utility → typioca/utility}/interface/construct/Property.d.ts +0 -0
- /package/types/{utility → typioca/utility}/interface/construct/Recordful.d.ts +0 -0
- /package/types/{utility → typioca/utility}/interface/construct/Table.d.ts +0 -0
- /package/types/{utility → typioca/utility}/interface/construct/properties/Field.d.ts +0 -0
- /package/types/{utility → typioca/utility}/interface/construct/properties/Flag.d.ts +0 -0
- /package/types/{utility → typioca/utility}/interface/construct/properties/Limit.d.ts +0 -0
- /package/types/{utility → typioca/utility}/interface/construct/properties/List.d.ts +0 -0
- /package/types/{utility → typioca/utility}/interface/construct/properties/Listish.d.ts +0 -0
- /package/types/{utility → typioca/utility}/interface/construct/properties/Scalar.d.ts +0 -0
- /package/types/{utility → typioca/utility}/interface/construct/tables/FieldTable.d.ts +0 -0
- /package/types/{utility → typioca/utility}/interface/construct/tables/FlagTable.d.ts +0 -0
- /package/types/{utility → typioca/utility}/interface/construct/tables/ListTable.d.ts +0 -0
- /package/types/{utility → typioca/utility}/interface/construct/tables/ListishTable.d.ts +0 -0
- /package/types/{utility → typioca/utility}/interface/construct/tables/ScalarTable.d.ts +0 -0
- /package/types/{utility → typioca/utility}/interface/identity/Interface.d.ts +0 -0
- /package/types/{utility → typioca/utility}/interface/identity/Keys.d.ts +0 -0
- /package/types/{utility → typioca/utility}/interface/transform/Unrequire.d.ts +0 -0
- /package/types/{utility → typioca/utility}/iterable/construct/ArrayN.d.ts +0 -0
- /package/types/{utility → typioca/utility}/iterable/construct/Tuple.d.ts +0 -0
- /package/types/{utility → typioca/utility}/iterable/construct/arrays/Arrays.d.ts +0 -0
- /package/types/{utility → typioca/utility}/iterable/construct/tuples/Tuples.d.ts +0 -0
- /package/types/{utility → typioca/utility}/iterable/identity/DyadType.d.ts +0 -0
- /package/types/{utility → typioca/utility}/iterable/identity/MonadType.d.ts +0 -0
- /package/types/{utility → typioca/utility}/iterable/identity/TriadType.d.ts +0 -0
- /package/types/{utility → typioca/utility}/iterable/identity/array/ArrayType.d.ts +0 -0
- /package/types/{utility → typioca/utility}/iterable/identity/array/length/ArrayLength.d.ts +0 -0
- /package/types/{utility → typioca/utility}/iterable/transform/Join.d.ts +0 -0
- /package/types/{utility → typioca/utility}/iterable/transform/Unflat.d.ts +0 -0
- /package/types/{utility → typioca/utility}/iterable/transform/stringarray/Chain.d.ts +0 -0
- /package/types/{utility → typioca/utility}/iterable/transform/stringarray/PathN.d.ts +0 -0
- /package/types/{utility → typioca/utility}/iterable/transform/stringarray/stringify/Stringify.d.ts +0 -0
- /package/types/{utility → typioca/utility}/length/Length.d.ts +0 -0
- /package/types/{utility → typioca/utility}/null/null.d.ts +0 -0
- /package/types/{utility → typioca/utility}/null/nullable.d.ts +0 -0
- /package/types/{utility → typioca/utility}/primitive/Primeval.d.ts +0 -0
- /package/types/{utility → typioca/utility}/primitive/boolean/True.d.ts +0 -0
- /package/types/{utility → typioca/utility}/primitive/number/Numbered.d.ts +0 -0
- /package/types/{utility → typioca/utility}/primitive/string/literal.d.ts +0 -0
- /package/types/{utility → typioca/utility}/primitive/string/literalful.d.ts +0 -0
@@ -0,0 +1,13 @@
|
|
1
|
+
import Options from "./options/Options.js";
|
2
|
+
import Files from "./files/Files.js";
|
3
|
+
import Ruleset, { Rule } from "./ruleset/Ruleset.js";
|
4
|
+
import type { Scope } from "../index.js";
|
5
|
+
|
6
|
+
export type Blanka = ConstructorParameters<typeof Options["js"]>;
|
7
|
+
export {
|
8
|
+
Options,
|
9
|
+
Files,
|
10
|
+
Ruleset,
|
11
|
+
Rule,
|
12
|
+
type Scope,
|
13
|
+
};
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import type { Scope } from "../Factory.js";
|
2
|
+
|
3
|
+
export default class Files {
|
4
|
+
constructor(
|
5
|
+
private readonly base: Record<Scope, string[]>,
|
6
|
+
private readonly includes: Particord<Scope, string[]>,
|
7
|
+
) {}
|
8
|
+
|
9
|
+
public files(scope: Scope): readonly string[] {
|
10
|
+
return [
|
11
|
+
...this.base[scope],
|
12
|
+
...this.includes[scope] ?? [],
|
13
|
+
];
|
14
|
+
}
|
15
|
+
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import type { Scope } from "../
|
1
|
+
import type { Scope } from "../Factory.js";
|
2
2
|
import JsOption from "./option/js/index.js";
|
3
3
|
import TsOption from "./option/ts/index.js";
|
4
4
|
import SvelteOption from "./option/svelte/index.js";
|
@@ -16,4 +16,4 @@ export default {
|
|
16
16
|
json: JsonOption,
|
17
17
|
jsonc: JsoncOption,
|
18
18
|
yml: YmlOption,
|
19
|
-
}
|
19
|
+
} as const;
|
@@ -0,0 +1,58 @@
|
|
1
|
+
import type { Scope } from "../Options.js";
|
2
|
+
|
3
|
+
export default abstract class Option<
|
4
|
+
S extends Scope,
|
5
|
+
PluginId extends string,
|
6
|
+
IsEcma extends boolean = true,
|
7
|
+
ParserOptions extends object | boolean = false,
|
8
|
+
ParserCount extends 0 | 1 | 2 = 0,
|
9
|
+
GlobalTypes extends string = never,
|
10
|
+
Processor extends object = never,
|
11
|
+
> {
|
12
|
+
public readonly linterOptions = {
|
13
|
+
noInlineConfig: true,
|
14
|
+
reportUnusedDisableDirectives: "error",
|
15
|
+
} as const;
|
16
|
+
|
17
|
+
public abstract readonly name: literalful<`scope:${S}`>;
|
18
|
+
public abstract readonly processor: (Interface<Processor> extends never ? object : Interface<Processor> extends { "interface": string } ? Interface<Processor> : object);
|
19
|
+
|
20
|
+
constructor(
|
21
|
+
public readonly files: readonly string[],
|
22
|
+
public readonly plugins: IOPlugins<PluginId>,
|
23
|
+
public readonly parser: Tuple<unknown, ParserCount>,
|
24
|
+
) {}
|
25
|
+
|
26
|
+
public get option() {
|
27
|
+
const {
|
28
|
+
name,
|
29
|
+
files,
|
30
|
+
plugins,
|
31
|
+
linterOptions,
|
32
|
+
languageOptions,
|
33
|
+
processor,
|
34
|
+
} = this;
|
35
|
+
|
36
|
+
return {
|
37
|
+
name,
|
38
|
+
files,
|
39
|
+
linterOptions,
|
40
|
+
languageOptions,
|
41
|
+
plugins,
|
42
|
+
...processor,
|
43
|
+
} satisfies IOption<
|
44
|
+
`scope:${S}`,
|
45
|
+
PluginId,
|
46
|
+
IsEcma,
|
47
|
+
ParserOptions,
|
48
|
+
GlobalTypes,
|
49
|
+
Processor
|
50
|
+
>;
|
51
|
+
}
|
52
|
+
|
53
|
+
public abstract get languageOptions(): IOLanguage<
|
54
|
+
IsEcma,
|
55
|
+
ParserOptions,
|
56
|
+
GlobalTypes
|
57
|
+
>;
|
58
|
+
}
|
@@ -1,31 +1,18 @@
|
|
1
|
-
import Option from "../
|
1
|
+
import Option from "../Option.js";
|
2
2
|
|
3
3
|
export default class HtmlOption extends Option<
|
4
4
|
"html",
|
5
5
|
"@html-eslint",
|
6
|
+
false,
|
6
7
|
true,
|
7
|
-
|
8
|
-
never,
|
9
|
-
never,
|
10
|
-
never,
|
11
|
-
never
|
8
|
+
1
|
12
9
|
> {
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
name: "linted/scope:html",
|
21
|
-
files,
|
22
|
-
plugins,
|
23
|
-
linterOptions: {
|
24
|
-
noInlineConfig: true,
|
25
|
-
reportUnusedDisableDirectives: "error",
|
26
|
-
},
|
27
|
-
languageOptions: { parser },
|
28
|
-
},
|
29
|
-
);
|
10
|
+
public readonly name = "scope:html";
|
11
|
+
public readonly processor = {} as const;
|
12
|
+
|
13
|
+
public get languageOptions() {
|
14
|
+
const [parser] = this.parser;
|
15
|
+
|
16
|
+
return { parser } as const;
|
30
17
|
}
|
31
18
|
}
|
@@ -1,24 +1,13 @@
|
|
1
|
-
import Option from "../
|
1
|
+
import Option from "../Option.js";
|
2
2
|
|
3
3
|
export default class JsOption extends Option<"js", "@stylistic"> {
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
) {
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
plugins,
|
13
|
-
linterOptions: {
|
14
|
-
noInlineConfig: true,
|
15
|
-
reportUnusedDisableDirectives: "error",
|
16
|
-
},
|
17
|
-
languageOptions: {
|
18
|
-
ecmaVersion: "latest",
|
19
|
-
sourceType: "module",
|
20
|
-
},
|
21
|
-
},
|
22
|
-
);
|
4
|
+
public readonly name = "scope:js";
|
5
|
+
public readonly processor = {};
|
6
|
+
|
7
|
+
public get languageOptions() {
|
8
|
+
return {
|
9
|
+
ecmaVersion: "latest",
|
10
|
+
sourceType: "module",
|
11
|
+
} as const;
|
23
12
|
}
|
24
13
|
}
|
@@ -1,31 +1,18 @@
|
|
1
|
-
import Option from "../
|
1
|
+
import Option from "../Option.js";
|
2
2
|
|
3
3
|
export default class JsonOption extends Option<
|
4
4
|
"json",
|
5
5
|
"jsonc",
|
6
|
+
false,
|
6
7
|
true,
|
7
|
-
|
8
|
-
never,
|
9
|
-
never,
|
10
|
-
never,
|
11
|
-
never
|
8
|
+
1
|
12
9
|
> {
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
name: "linted/scope:json",
|
21
|
-
files,
|
22
|
-
plugins,
|
23
|
-
linterOptions: {
|
24
|
-
noInlineConfig: true,
|
25
|
-
reportUnusedDisableDirectives: "error",
|
26
|
-
},
|
27
|
-
languageOptions: { parser },
|
28
|
-
},
|
29
|
-
);
|
10
|
+
public readonly name = "scope:json";
|
11
|
+
public readonly processor = {} as const;
|
12
|
+
|
13
|
+
public get languageOptions() {
|
14
|
+
const [parser] = this.parser;
|
15
|
+
|
16
|
+
return { parser } as const;
|
30
17
|
}
|
31
18
|
}
|
@@ -1,31 +1,18 @@
|
|
1
|
-
import Option from "../
|
1
|
+
import Option from "../Option.js";
|
2
2
|
|
3
3
|
export default class JsoncOption extends Option<
|
4
4
|
"jsonc",
|
5
5
|
"jsonc",
|
6
|
+
false,
|
6
7
|
true,
|
7
|
-
|
8
|
-
never,
|
9
|
-
never,
|
10
|
-
never,
|
11
|
-
never
|
8
|
+
1
|
12
9
|
> {
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
name: "linted/scope:jsonc",
|
21
|
-
files,
|
22
|
-
plugins,
|
23
|
-
linterOptions: {
|
24
|
-
noInlineConfig: true,
|
25
|
-
reportUnusedDisableDirectives: "error",
|
26
|
-
},
|
27
|
-
languageOptions: { parser },
|
28
|
-
},
|
29
|
-
);
|
10
|
+
public readonly name = "scope:jsonc";
|
11
|
+
public readonly processor = {} as const;
|
12
|
+
|
13
|
+
public get languageOptions() {
|
14
|
+
const [parser] = this.parser;
|
15
|
+
|
16
|
+
return { parser } as const;
|
30
17
|
}
|
31
18
|
}
|
@@ -1,45 +1,34 @@
|
|
1
|
-
import Option from "../
|
1
|
+
import Option from "../Option.js";
|
2
2
|
import type TsOption from "../ts/index.js";
|
3
3
|
|
4
4
|
export default class SvelteOption extends Option<
|
5
5
|
"svelte",
|
6
|
-
"svelte" | keyof TsOption["
|
6
|
+
"svelte" | keyof TsOption["option"]["plugins"],
|
7
7
|
true,
|
8
|
-
& TsOption["
|
8
|
+
& TsOption["option"]["languageOptions"]["parserOptions"]
|
9
9
|
& { parser: unknown }
|
10
|
-
& { extraFileExtensions: [".svelte"] },
|
10
|
+
& { extraFileExtensions: readonly [".svelte"] },
|
11
|
+
2,
|
11
12
|
never,
|
12
|
-
"svelte/svelte"
|
13
|
+
{ processor: "svelte/svelte" }
|
13
14
|
> {
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
languageOptions: {
|
31
|
-
ecmaVersion: "latest",
|
32
|
-
sourceType: "module",
|
33
|
-
parser: svelteParser,
|
34
|
-
parserOptions: {
|
35
|
-
ecmaVersion: "latest",
|
36
|
-
sourceType: "module",
|
37
|
-
project: "tsconfig.json",
|
38
|
-
extraFileExtensions: [".svelte"],
|
39
|
-
parser: tsParser,
|
40
|
-
},
|
41
|
-
},
|
15
|
+
public readonly name = "scope:svelte";
|
16
|
+
public readonly processor = { processor: "svelte/svelte" } as const;
|
17
|
+
|
18
|
+
public get languageOptions() {
|
19
|
+
const [parser, tsParser] = this.parser;
|
20
|
+
|
21
|
+
return {
|
22
|
+
ecmaVersion: "latest",
|
23
|
+
sourceType: "module",
|
24
|
+
parser,
|
25
|
+
parserOptions: {
|
26
|
+
ecmaVersion: "latest",
|
27
|
+
sourceType: "module",
|
28
|
+
project: "tsconfig.json",
|
29
|
+
extraFileExtensions: [".svelte"] as const,
|
30
|
+
parser: tsParser,
|
42
31
|
},
|
43
|
-
|
32
|
+
} as const;
|
44
33
|
}
|
45
34
|
}
|
@@ -1,38 +1,29 @@
|
|
1
|
-
import Option from "../
|
1
|
+
import Option from "../Option.js";
|
2
2
|
import type JsOption from "../js/index.js";
|
3
3
|
|
4
4
|
export default class TsOption extends Option<
|
5
5
|
"ts",
|
6
|
-
"@typescript-eslint" | keyof JsOption["
|
6
|
+
"@typescript-eslint" | keyof JsOption["option"]["plugins"],
|
7
7
|
true,
|
8
|
-
& JsOption["
|
9
|
-
& { project: "tsconfig.json" }
|
8
|
+
& JsOption["option"]["languageOptions"]
|
9
|
+
& { project: "tsconfig.json" },
|
10
|
+
1
|
10
11
|
> {
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
languageOptions: {
|
26
|
-
ecmaVersion: "latest",
|
27
|
-
sourceType: "module",
|
28
|
-
parser,
|
29
|
-
parserOptions: {
|
30
|
-
ecmaVersion: "latest",
|
31
|
-
sourceType: "module",
|
32
|
-
project: "tsconfig.json",
|
33
|
-
},
|
34
|
-
},
|
12
|
+
public readonly name = "scope:ts";
|
13
|
+
public readonly processor = {} as const;
|
14
|
+
|
15
|
+
public get languageOptions() {
|
16
|
+
const [parser] = this.parser;
|
17
|
+
|
18
|
+
return {
|
19
|
+
ecmaVersion: "latest",
|
20
|
+
sourceType: "module",
|
21
|
+
parser,
|
22
|
+
parserOptions: {
|
23
|
+
ecmaVersion: "latest",
|
24
|
+
sourceType: "module",
|
25
|
+
project: "tsconfig.json",
|
35
26
|
},
|
36
|
-
|
27
|
+
} as const;
|
37
28
|
}
|
38
29
|
}
|
@@ -1,31 +1,18 @@
|
|
1
|
-
import Option from "../
|
1
|
+
import Option from "../Option.js";
|
2
2
|
|
3
3
|
export default class YmlOption extends Option<
|
4
4
|
"yml",
|
5
5
|
"yml",
|
6
|
+
false,
|
6
7
|
true,
|
7
|
-
|
8
|
-
never,
|
9
|
-
never,
|
10
|
-
never,
|
11
|
-
never
|
8
|
+
1
|
12
9
|
> {
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
name: "linted/scope:yml",
|
21
|
-
files,
|
22
|
-
plugins,
|
23
|
-
linterOptions: {
|
24
|
-
noInlineConfig: true,
|
25
|
-
reportUnusedDisableDirectives: "error",
|
26
|
-
},
|
27
|
-
languageOptions: { parser },
|
28
|
-
},
|
29
|
-
);
|
10
|
+
public readonly name = "scope:yml";
|
11
|
+
public readonly processor = {} as const;
|
12
|
+
|
13
|
+
public get languageOptions() {
|
14
|
+
const [parser] = this.parser;
|
15
|
+
|
16
|
+
return { parser } as const;
|
30
17
|
}
|
31
18
|
}
|
package/src/index.ts
CHANGED
@@ -1,19 +1,19 @@
|
|
1
|
-
import scopes from "./
|
2
|
-
import {
|
3
|
-
options,
|
4
|
-
Files,
|
5
|
-
Ruleset,
|
6
|
-
Rule,
|
7
|
-
} from "./factory/index.js";
|
1
|
+
import scopes from "./boundary/boundary.js";
|
8
2
|
import type {
|
9
3
|
Scope,
|
10
4
|
Plugins,
|
11
5
|
Parsers,
|
12
|
-
|
13
|
-
|
6
|
+
Config,
|
7
|
+
} from "./boundary/boundary.js";
|
8
|
+
import {
|
9
|
+
Options,
|
10
|
+
Files,
|
11
|
+
Ruleset,
|
12
|
+
Rule,
|
13
|
+
} from "./factory/Factory.js";
|
14
14
|
|
15
|
-
export { Ruleset, Rule };
|
16
15
|
export type { Scope };
|
16
|
+
export { Ruleset, Rule };
|
17
17
|
export default function (
|
18
18
|
plugins: Plugins,
|
19
19
|
parsers: Parsers,
|
@@ -23,97 +23,87 @@ export default function (
|
|
23
23
|
overrides: Particord<Scope, IRule>,
|
24
24
|
): Config[] {
|
25
25
|
try {
|
26
|
+
const files = new Files(
|
27
|
+
base,
|
28
|
+
includes,
|
29
|
+
),
|
30
|
+
imports: {
|
31
|
+
[S in Scope]: OmitFirst<ConstructorParameters<typeof Options[S]>>;
|
32
|
+
} = {
|
33
|
+
js: [plugins.js, []] as const,
|
34
|
+
ts: [plugins.ts, [parsers.ts]] as const,
|
35
|
+
svelte: [
|
36
|
+
plugins.svelte,
|
37
|
+
[parsers.svelte, parsers.ts],
|
38
|
+
] as const,
|
39
|
+
html: [plugins.html, [parsers.html]] as const,
|
40
|
+
json: [plugins.json, [parsers.json]] as const,
|
41
|
+
jsonc: [plugins.jsonc, [parsers.jsonc]] as const,
|
42
|
+
yml: [plugins.yml, [parsers.yml]] as const,
|
43
|
+
} as const;
|
44
|
+
|
26
45
|
for (const scope of scopes)
|
27
46
|
rulesets[scope].override(overrides[scope]);
|
28
47
|
|
29
|
-
const
|
48
|
+
const options: {
|
30
49
|
[S in Scope]: InstanceType<
|
31
|
-
typeof
|
32
|
-
>["
|
50
|
+
typeof Options[S]
|
51
|
+
>["option"]
|
33
52
|
} = {
|
34
|
-
js: new
|
53
|
+
js: new Options
|
35
54
|
.js(
|
36
|
-
|
37
|
-
|
38
|
-
"js",
|
39
|
-
{ base, includes },
|
40
|
-
).files,
|
41
|
-
|
55
|
+
files.files("js"),
|
56
|
+
...imports.js,
|
42
57
|
)
|
43
|
-
.
|
44
|
-
ts: new
|
58
|
+
.option,
|
59
|
+
ts: new Options
|
45
60
|
.ts(
|
46
|
-
|
47
|
-
|
48
|
-
new Files(
|
49
|
-
"ts",
|
50
|
-
{ base, includes },
|
51
|
-
).files,
|
61
|
+
files.files("ts"),
|
62
|
+
...imports.ts,
|
52
63
|
)
|
53
|
-
.
|
54
|
-
svelte: new
|
64
|
+
.option,
|
65
|
+
svelte: new Options
|
55
66
|
.svelte(
|
56
|
-
|
57
|
-
|
58
|
-
parsers.ts,
|
59
|
-
new Files(
|
60
|
-
"svelte",
|
61
|
-
{ base, includes },
|
62
|
-
).files,
|
67
|
+
files.files("svelte"),
|
68
|
+
...imports.svelte,
|
63
69
|
)
|
64
|
-
.
|
65
|
-
html: new
|
70
|
+
.option,
|
71
|
+
html: new Options
|
66
72
|
.html(
|
67
|
-
|
68
|
-
|
69
|
-
new Files(
|
70
|
-
"html",
|
71
|
-
{ base, includes },
|
72
|
-
).files,
|
73
|
+
files.files("html"),
|
74
|
+
...imports.html,
|
73
75
|
)
|
74
|
-
.
|
75
|
-
json: new
|
76
|
+
.option,
|
77
|
+
json: new Options
|
76
78
|
.json(
|
77
|
-
|
78
|
-
|
79
|
-
new Files(
|
80
|
-
"json",
|
81
|
-
{ base, includes },
|
82
|
-
).files,
|
79
|
+
files.files("json"),
|
80
|
+
...imports.json,
|
83
81
|
)
|
84
|
-
.
|
85
|
-
jsonc: new
|
82
|
+
.option,
|
83
|
+
jsonc: new Options
|
86
84
|
.jsonc(
|
87
|
-
|
88
|
-
|
89
|
-
new Files(
|
90
|
-
"jsonc",
|
91
|
-
{ base, includes },
|
92
|
-
).files,
|
85
|
+
files.files("jsonc"),
|
86
|
+
...imports.jsonc,
|
93
87
|
)
|
94
|
-
.
|
95
|
-
yml: new
|
88
|
+
.option,
|
89
|
+
yml: new Options
|
96
90
|
.yml(
|
97
|
-
|
98
|
-
|
99
|
-
new Files(
|
100
|
-
"yml",
|
101
|
-
{ base, includes },
|
102
|
-
).files,
|
91
|
+
files.files("yml"),
|
92
|
+
...imports.yml,
|
103
93
|
)
|
104
|
-
.
|
94
|
+
.option,
|
105
95
|
};
|
106
96
|
|
107
97
|
return scopes
|
108
98
|
.map(
|
109
|
-
scope =>
|
99
|
+
scope => options[scope].files.length > 0
|
110
100
|
? rulesets[scope]
|
111
101
|
.flat
|
112
102
|
.map(
|
113
103
|
rules => {
|
114
104
|
return {
|
115
105
|
rules,
|
116
|
-
...
|
106
|
+
...options[scope],
|
117
107
|
};
|
118
108
|
},
|
119
109
|
)
|
@@ -0,0 +1 @@
|
|
1
|
+
declare type OmitFirst<A> = A extends readonly [unknown, ...infer An_1] ? An_1 : never;
|
@@ -1 +0,0 @@
|
|
1
|
-
declare interface IFiles { files: readonly string[] }
|
@@ -1,25 +0,0 @@
|
|
1
|
-
declare type IOption<
|
2
|
-
Name extends string,
|
3
|
-
NoInline extends boolean,
|
4
|
-
ReportUnused extends boolean | IOLinter.States,
|
5
|
-
PluginId extends string,
|
6
|
-
Ecma extends number | IOLanguageEcma.Ecma,
|
7
|
-
Source extends IOLanguageSource.Source,
|
8
|
-
UseParser extends boolean,
|
9
|
-
ParserOptions extends object,
|
10
|
-
GlobalTypes extends string,
|
11
|
-
ProcessorId extends string,
|
12
|
-
> =
|
13
|
-
& IFiles
|
14
|
-
& IOName<Name>
|
15
|
-
& IOLinter<NoInline, ReportUnused>
|
16
|
-
& IOPlugins<PluginId>
|
17
|
-
& IOLanguage<
|
18
|
-
Ecma,
|
19
|
-
Source,
|
20
|
-
UseParser,
|
21
|
-
ParserOptions,
|
22
|
-
GlobalTypes
|
23
|
-
>
|
24
|
-
& IOProcessor<ProcessorId>
|
25
|
-
;
|
@@ -1,15 +0,0 @@
|
|
1
|
-
declare type IOLanguage<
|
2
|
-
Ecma extends number | IOLanguageEcma.Ecma,
|
3
|
-
Source extends IOLanguageSource.Source,
|
4
|
-
UseParser extends boolean,
|
5
|
-
ParserOptions extends object,
|
6
|
-
GlobalTypes extends string,
|
7
|
-
> = {
|
8
|
-
languageOptions:
|
9
|
-
& IOLanguageEcma<Ecma>
|
10
|
-
& IOLanguageSource<Source>
|
11
|
-
& IOLanguageGlobals<GlobalTypes>
|
12
|
-
& IOLanguageParser<UseParser>
|
13
|
-
& IOLanguageParserOptions<ParserOptions>
|
14
|
-
;
|
15
|
-
};
|