@eslinted/core 0.8.1 → 0.9.0-rc.2
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/boundary/boundary.d.ts +5 -10
- package/dist/boundary/boundary.d.ts.map +1 -1
- package/dist/boundary/boundary.js +2 -1
- package/dist/boundary/boundary.js.map +1 -1
- package/dist/boundary/input/input.d.ts +4 -7
- package/dist/boundary/input/input.d.ts.map +1 -1
- package/dist/boundary/input/parsers/parsers.d.ts +2 -2
- package/dist/boundary/input/parsers/parsers.d.ts.map +1 -1
- package/dist/boundary/input/plugins/plugins.d.ts +1 -2
- package/dist/boundary/input/plugins/plugins.d.ts.map +1 -1
- package/dist/boundary/output/output.d.ts +2 -2
- package/dist/boundary/output/output.d.ts.map +1 -1
- package/dist/boundary/scopes/scopes.d.ts.map +1 -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 → Factory.js} +3 -3
- package/dist/factory/Factory.js.map +1 -0
- package/dist/factory/files/Files.d.ts +1 -1
- package/dist/factory/files/Files.d.ts.map +1 -1
- package/dist/factory/files/Files.js +4 -9
- package/dist/factory/files/Files.js.map +1 -1
- package/dist/factory/options/Options.d.ts +3 -1
- package/dist/factory/options/Options.d.ts.map +1 -1
- package/dist/factory/options/Options.js +1 -1
- package/dist/factory/options/Options.js.map +1 -1
- package/dist/factory/options/option/Option.d.ts +22 -8
- package/dist/factory/options/option/Option.d.ts.map +1 -1
- package/dist/factory/options/option/Option.js +23 -33
- package/dist/factory/options/option/Option.js.map +1 -1
- package/dist/factory/options/option/html/index.d.ts.map +1 -1
- package/dist/factory/options/option/html/index.js +2 -7
- package/dist/factory/options/option/html/index.js.map +1 -1
- package/dist/factory/options/option/js/index.d.ts.map +1 -1
- package/dist/factory/options/option/js/index.js +4 -9
- package/dist/factory/options/option/js/index.js.map +1 -1
- package/dist/factory/options/option/json/index.d.ts.map +1 -1
- package/dist/factory/options/option/json/index.js +2 -7
- package/dist/factory/options/option/json/index.js.map +1 -1
- package/dist/factory/options/option/jsonc/index.d.ts.map +1 -1
- package/dist/factory/options/option/jsonc/index.js +2 -7
- package/dist/factory/options/option/jsonc/index.js.map +1 -1
- package/dist/factory/options/option/svelte/index.d.ts.map +1 -1
- package/dist/factory/options/option/svelte/index.js +11 -16
- package/dist/factory/options/option/svelte/index.js.map +1 -1
- package/dist/factory/options/option/ts/index.d.ts.map +1 -1
- package/dist/factory/options/option/ts/index.js +9 -14
- package/dist/factory/options/option/ts/index.js.map +1 -1
- package/dist/factory/options/option/yml/index.d.ts.map +1 -1
- package/dist/factory/options/option/yml/index.js +2 -7
- package/dist/factory/options/option/yml/index.js.map +1 -1
- package/dist/factory/ruleset/Ruleset.d.ts +1 -1
- package/dist/factory/ruleset/Ruleset.d.ts.map +1 -1
- package/dist/factory/ruleset/Ruleset.js +11 -31
- package/dist/factory/ruleset/Ruleset.js.map +1 -1
- package/dist/index.d.ts +5 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- 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.ts → parsers/parsers.ts} +2 -2
- package/src/boundary/input/{plugins.ts → plugins/plugins.ts} +1 -2
- package/src/boundary/output/output.ts +3 -0
- package/src/factory/Factory.ts +13 -0
- package/src/factory/files/Files.ts +5 -13
- package/src/factory/options/{options.ts → Options.ts} +2 -0
- package/src/factory/options/option/Option.ts +51 -71
- package/src/factory/options/option/html/index.ts +2 -10
- package/src/factory/options/option/js/index.ts +4 -12
- package/src/factory/options/option/json/index.ts +2 -10
- package/src/factory/options/option/jsonc/index.ts +2 -10
- package/src/factory/options/option/svelte/index.ts +11 -19
- package/src/factory/options/option/ts/index.ts +9 -17
- package/src/factory/options/option/yml/index.ts +2 -10
- package/src/factory/ruleset/Ruleset.ts +15 -47
- package/src/index.ts +13 -9
- package/dist/boundary/input/parsers.d.ts +0 -7
- package/dist/boundary/input/parsers.d.ts.map +0 -1
- package/dist/boundary/input/parsers.js +0 -2
- package/dist/boundary/input/parsers.js.map +0 -1
- package/dist/boundary/input/plugins.d.ts +0 -7
- package/dist/boundary/input/plugins.d.ts.map +0 -1
- package/dist/boundary/input/plugins.js +0 -2
- package/dist/boundary/input/plugins.js.map +0 -1
- package/dist/boundary/input.d.ts +0 -8
- package/dist/boundary/input.d.ts.map +0 -1
- package/dist/boundary/input.js +0 -2
- package/dist/boundary/input.js.map +0 -1
- package/dist/boundary/output/IConfig.d.ts +0 -19
- package/dist/boundary/output/IConfig.d.ts.map +0 -1
- package/dist/boundary/output/IConfig.js +0 -2
- package/dist/boundary/output/IConfig.js.map +0 -1
- package/dist/boundary/output.d.ts +0 -3
- package/dist/boundary/output.d.ts.map +0 -1
- package/dist/boundary/output.js +0 -2
- package/dist/boundary/output.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.map +0 -1
- package/dist/scopes/scopes.d.ts.map +0 -1
- package/dist/scopes/scopes.js.map +0 -1
- package/src/boundary/input.ts +0 -9
- package/src/boundary/output.ts +0 -3
- package/src/factory/factory.ts +0 -10
- /package/dist/{scopes → boundary/scopes}/scopes.d.ts +0 -0
- /package/dist/{scopes → boundary/scopes}/scopes.js +0 -0
- /package/src/boundary/output/{IConfig.ts → config/IConfig.ts} +0 -0
- /package/src/boundary/output/{interface → config/interface}/option/IOption.d.ts +0 -0
- /package/src/boundary/output/{interface → config/interface}/option/language/IOLanguage.d.ts +0 -0
- /package/src/boundary/output/{interface → config/interface}/option/language/ecma/IOLanguageEcma.d.ts +0 -0
- /package/src/boundary/output/{interface → config/interface}/option/language/globals/IOLanguageGlobals.d.ts +0 -0
- /package/src/boundary/output/{interface → config/interface}/option/language/source/IOLanguageSource.d.ts +0 -0
- /package/src/boundary/output/{interface → config/interface}/option/linter/IOLinter.d.ts +0 -0
- /package/src/boundary/output/{interface → config/interface}/option/plugins/IOPlugins.d.ts +0 -0
- /package/src/boundary/output/{interface → config/interface}/option/processor/IOProcessor.d.ts +0 -0
- /package/src/boundary/output/{interface → config/interface}/rules/IRule.d.ts +0 -0
- /package/src/boundary/output/{interface → config/interface}/rules/state/RuleSeverity.d.ts +0 -0
- /package/src/{scopes → boundary/scopes}/scopes.ts +0 -0
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Ruleset.d.ts","sourceRoot":"","sources":["../../../src/factory/ruleset/Ruleset.ts"],"names":[],"mappings":"AAAA,OAAO,
|
1
|
+
{"version":3,"file":"Ruleset.d.ts","sourceRoot":"","sources":["../../../src/factory/ruleset/Ruleset.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,gBAAgB,CAAC;AAClC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAE,IAAI,EAAE,CAAC;AAChB,MAAM,CAAC,OAAO,OAAO,OAAO,CAAC,CAAC,SAAS,KAAK;IAKxC,OAAO,CAAC,QAAQ,CAAC,KAAK;IAJxB,SAAgB,OAAO,EAAE,SAAS,IAAI,EAAE,CAAC;IAClC,SAAS,EAAE,IAAI,CAAC,IAAI,CAAC,CAAQ;gBAGjB,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,EACrC,GAAG,OAAO,EAAE,SAAS,IAAI,EAAE;IAK7B,IAAW,EAAE,kBAIZ;IAED,IAAW,OAAO,iCAOjB;IAEM,QAAQ,CAAC,SAAS,EAAE,SAAS,GAAG,KAAK;CAS7C"}
|
@@ -6,43 +6,23 @@ export default class Ruleset {
|
|
6
6
|
overrides = null;
|
7
7
|
constructor(scope, ...ruleset) {
|
8
8
|
this.scope = scope;
|
9
|
-
|
10
|
-
this.ruleset = [...ruleset];
|
11
|
-
}
|
12
|
-
catch (e) {
|
13
|
-
throw new Error(`linted.factory.Ruleset`, { cause: e });
|
14
|
-
}
|
9
|
+
this.ruleset = [...ruleset];
|
15
10
|
}
|
16
11
|
get id() {
|
17
|
-
|
18
|
-
|
19
|
-
return scope;
|
20
|
-
}
|
21
|
-
catch (e) {
|
22
|
-
throw new Error(`linted.factory.Ruleset: id`, { cause: e });
|
23
|
-
}
|
12
|
+
const { scope } = this;
|
13
|
+
return scope;
|
24
14
|
}
|
25
15
|
get records() {
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
];
|
32
|
-
}
|
33
|
-
catch (e) {
|
34
|
-
throw new Error(`linted.factory.Ruleset: records`, { cause: e });
|
35
|
-
}
|
16
|
+
const { ruleset, overrides } = this;
|
17
|
+
return [
|
18
|
+
...ruleset.map(rules => [rules.id, rules.rules]),
|
19
|
+
...overrides === null ? [] : [[overrides.id, overrides.rules]],
|
20
|
+
];
|
36
21
|
}
|
37
22
|
override(overrides) {
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
return this;
|
42
|
-
}
|
43
|
-
catch (e) {
|
44
|
-
throw new Error(`linted.factory.Ruleset: override`, { cause: e });
|
45
|
-
}
|
23
|
+
if (typeof overrides !== "undefined")
|
24
|
+
this.overrides = new Rule("override", overrides);
|
25
|
+
return this;
|
46
26
|
}
|
47
27
|
}
|
48
28
|
//# sourceMappingURL=Ruleset.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Ruleset.js","sourceRoot":"","sources":["../../../src/factory/ruleset/Ruleset.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"Ruleset.js","sourceRoot":"","sources":["../../../src/factory/ruleset/Ruleset.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,gBAAgB,CAAC;AAGlC,OAAO,EAAE,IAAI,EAAE,CAAC;AAChB,MAAM,CAAC,OAAO,OAAO,OAAO;IAKP;IAJH,OAAO,CAAkB;IAClC,SAAS,GAAe,IAAI,CAAC;IAEpC,YACmB,KAAoB,EACrC,GAAG,OAAwB;QADV,UAAK,GAAL,KAAK,CAAe;QAGrC,IAAI,CAAC,OAAO,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC;IAC9B,CAAC;IAED,IAAW,EAAE;QACX,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;QAEvB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAW,OAAO;QAChB,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC;QAEpC,OAAO;YACL,GAAG,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,EAAE,EAAE,KAAK,CAAC,KAAK,CAAU,CAAC;YACzD,GAAG,SAAS,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE,EAAE,SAAS,CAAC,KAAK,CAAU,CAAU;SACjF,CAAC;IACJ,CAAC;IAEM,QAAQ,CAAC,SAA4B;QAC1C,IAAI,OAAO,SAAS,KAAK,WAAW;YAClC,IAAI,CAAC,SAAS,GAAG,IAAI,IAAI,CACvB,UAAU,EACV,SAAS,CACV,CAAC;QAEJ,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
|
package/dist/index.d.ts
CHANGED
@@ -1,10 +1,8 @@
|
|
1
|
-
import {
|
2
|
-
import
|
3
|
-
|
4
|
-
import { Ruleset, Rule } from "./factory/factory.js";
|
5
|
-
export type { Scope, Output };
|
1
|
+
import type { Scope, Plugins, Parsers, IConfig } from "./boundary/boundary.js";
|
2
|
+
import { Ruleset, Rule } from "./factory/Factory.js";
|
3
|
+
export type { Scope };
|
6
4
|
export { Ruleset, Rule };
|
7
|
-
export default function (plugins:
|
5
|
+
export default function (plugins: Plugins, parsers: Parsers, base: Record<Scope, string[]>, includes: Particord<Scope, string[]>, rulesets: {
|
8
6
|
[S in Scope]: Ruleset<S>;
|
9
|
-
}, overrides: Particord<Scope, IRule>):
|
7
|
+
}, overrides: Particord<Scope, IRule>): IConfig[];
|
10
8
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,KAAK,EACL,OAAO,EACP,OAAO,EACP,OAAO,EACR,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAGL,OAAO,EACP,IAAI,EACL,MAAM,sBAAsB,CAAC;AAE9B,YAAY,EAAE,KAAK,EAAE,CAAC;AACtB,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AACzB,MAAM,CAAC,OAAO,WACZ,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC,EAC7B,QAAQ,EAAE,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC,EACpC,QAAQ,EAAE;KAAG,CAAC,IAAI,KAAK,GAAG,OAAO,CAAC,CAAC,CAAC;CAAE,EACtC,SAAS,EAAE,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC,GACjC,OAAO,EAAE,CA0FX"}
|
package/dist/index.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
import scopes
|
2
|
-
import { Options, Files, Ruleset, Rule, } from "./factory/
|
1
|
+
import scopes from "./boundary/boundary.js";
|
2
|
+
import { Options, Files, Ruleset, Rule, } from "./factory/Factory.js";
|
3
3
|
export { Ruleset, Rule };
|
4
4
|
export default function (plugins, parsers, base, includes, rulesets, overrides) {
|
5
5
|
try {
|
@@ -45,7 +45,7 @@ export default function (plugins, parsers, base, includes, rulesets, overrides)
|
|
45
45
|
.flat();
|
46
46
|
}
|
47
47
|
catch (e) {
|
48
|
-
throw new Error(`linted
|
48
|
+
throw new Error(`linted(): Caught exception.`, { cause: e });
|
49
49
|
}
|
50
50
|
}
|
51
51
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"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"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@eslinted/core",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.9.0-rc.2",
|
4
4
|
"description": "Core ESLint flat config factory npm package `linted`.",
|
5
5
|
"keywords": [],
|
6
6
|
"license": "MIT",
|
@@ -21,7 +21,7 @@
|
|
21
21
|
"dependencies": {},
|
22
22
|
"devDependencies": {
|
23
23
|
"eslint": "~8.57.0",
|
24
|
-
"linted": "~15.4.
|
24
|
+
"linted": "~15.4.5",
|
25
25
|
"npm-run-all": "^4.1.5",
|
26
26
|
"typescript": "^5.5.4"
|
27
27
|
},
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import type { Scope } from "
|
2
|
-
import type { Options } from "
|
1
|
+
import type { Scope } from "../input.js";
|
2
|
+
import type { Options } from "../../../factory/Factory.js";
|
3
3
|
|
4
4
|
type Parsers = {
|
5
5
|
readonly [S in Scope]: ConstructorParameters<typeof Options[S]>[2] extends readonly [unknown, ...unknown[]]
|
@@ -1,5 +1,4 @@
|
|
1
|
-
import type { Scope } from "
|
2
|
-
import type { Options } from "../../factory/factory.js";
|
1
|
+
import type { Scope, Options } from "../../../factory/Factory.js";
|
3
2
|
|
4
3
|
type Plugins = {
|
5
4
|
readonly [S in Scope]: InstanceType<typeof Options[S]>["plugins"];
|
@@ -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
|
+
};
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import type { Scope } from "
|
1
|
+
import type { Scope } from "../Factory.js";
|
2
2
|
|
3
3
|
export default class Files {
|
4
4
|
constructor(
|
@@ -7,17 +7,9 @@ export default class Files {
|
|
7
7
|
) {}
|
8
8
|
|
9
9
|
public files(scope: Scope): readonly string[] {
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
];
|
15
|
-
}
|
16
|
-
catch (e) {
|
17
|
-
throw new Error(
|
18
|
-
`linted.factory.Files/scope:${scope}`,
|
19
|
-
{ cause: e },
|
20
|
-
);
|
21
|
-
}
|
10
|
+
return [
|
11
|
+
...this.base[scope],
|
12
|
+
...this.includes[scope] ?? [],
|
13
|
+
];
|
22
14
|
}
|
23
15
|
}
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import type { Scope } from "../Factory.js";
|
1
2
|
import JsOption from "./option/js/index.js";
|
2
3
|
import TsOption from "./option/ts/index.js";
|
3
4
|
import SvelteOption from "./option/svelte/index.js";
|
@@ -6,6 +7,7 @@ import JsonOption from "./option/json/index.js";
|
|
6
7
|
import JsoncOption from "./option/jsonc/index.js";
|
7
8
|
import YmlOption from "./option/yml/index.js";
|
8
9
|
|
10
|
+
export type { Scope };
|
9
11
|
export default {
|
10
12
|
js: JsOption,
|
11
13
|
ts: TsOption,
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import type { Scope } from "
|
2
|
-
import type { Ruleset } from "../../
|
3
|
-
import type
|
1
|
+
import type { Scope } from "../Options.js";
|
2
|
+
import type { Ruleset } from "../../Factory.js";
|
3
|
+
import type { IConfig } from "../../../boundary/boundary.js";
|
4
4
|
|
5
5
|
export default abstract class Option<
|
6
6
|
S extends Scope,
|
@@ -11,17 +11,13 @@ export default abstract class Option<
|
|
11
11
|
GlobalTypes extends string = never,
|
12
12
|
Processor extends object = never,
|
13
13
|
> {
|
14
|
-
|
14
|
+
public readonly linterOptions = {
|
15
15
|
noInlineConfig: true,
|
16
16
|
reportUnusedDisableDirectives: "error",
|
17
17
|
} as const;
|
18
18
|
|
19
19
|
public abstract readonly scope: literalful<S>;
|
20
|
-
public abstract readonly processor: Interface<Processor> extends never
|
21
|
-
? object
|
22
|
-
: Interface<Processor> extends Readonly<Record<"processor", string>>
|
23
|
-
? Interface<Processor>
|
24
|
-
: object;
|
20
|
+
public abstract readonly processor: (Interface<Processor> extends never ? object : Interface<Processor> extends { "interface": string } ? Interface<Processor> : object);
|
25
21
|
|
26
22
|
constructor(
|
27
23
|
public readonly files: readonly string[],
|
@@ -30,78 +26,62 @@ export default abstract class Option<
|
|
30
26
|
public readonly parser: Tuple<unknown, ParserCount>,
|
31
27
|
) {}
|
32
28
|
|
33
|
-
public get configs():
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
} = this;
|
29
|
+
public get configs(): IConfig[] {
|
30
|
+
const {
|
31
|
+
scope,
|
32
|
+
ruleset,
|
33
|
+
files,
|
34
|
+
option,
|
35
|
+
} = this;
|
41
36
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
37
|
+
if (ruleset.id !== scope)
|
38
|
+
throw new TypeError(
|
39
|
+
`Option and Ruleset scope mismatch`,
|
40
|
+
{ cause: { option: scope, ruleset: ruleset.id } },
|
41
|
+
);
|
42
|
+
else if (files.length < 1)
|
43
|
+
return [];
|
44
|
+
else {
|
45
|
+
const baseName = `scope:${scope}/rule:${ruleset.id}` as const;
|
51
46
|
|
52
|
-
|
53
|
-
|
54
|
-
|
47
|
+
return ruleset.records.map(
|
48
|
+
([ruleId, rules]) => {
|
49
|
+
const name = `${baseName}+${ruleId}` as const;
|
55
50
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
);
|
64
|
-
}
|
65
|
-
}
|
66
|
-
catch (e) {
|
67
|
-
throw new Error(
|
68
|
-
`linted.factory.Option/scope:${this.scope}: configs`,
|
69
|
-
{ cause: e },
|
51
|
+
return {
|
52
|
+
name,
|
53
|
+
files,
|
54
|
+
rules,
|
55
|
+
...option,
|
56
|
+
};
|
57
|
+
},
|
70
58
|
);
|
71
59
|
}
|
72
60
|
}
|
73
61
|
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
} = this;
|
62
|
+
public get option() {
|
63
|
+
const {
|
64
|
+
plugins,
|
65
|
+
linterOptions,
|
66
|
+
languageOptions,
|
67
|
+
processor,
|
68
|
+
} = this;
|
82
69
|
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
}
|
96
|
-
catch (e) {
|
97
|
-
throw new Error(
|
98
|
-
`linted.factory.Option/scope:${this.scope}: option`,
|
99
|
-
{ cause: e },
|
100
|
-
);
|
101
|
-
}
|
70
|
+
return {
|
71
|
+
linterOptions,
|
72
|
+
languageOptions,
|
73
|
+
plugins,
|
74
|
+
...processor,
|
75
|
+
} satisfies IOption<
|
76
|
+
PluginId,
|
77
|
+
IsEcma,
|
78
|
+
ParserOptions,
|
79
|
+
GlobalTypes,
|
80
|
+
Processor
|
81
|
+
>;
|
102
82
|
}
|
103
83
|
|
104
|
-
|
84
|
+
public abstract get languageOptions(): IOLanguage<
|
105
85
|
IsEcma,
|
106
86
|
ParserOptions,
|
107
87
|
GlobalTypes
|
@@ -11,16 +11,8 @@ export default class HtmlOption 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
|
}
|
@@ -5,17 +5,9 @@ export default class JsOption extends Option<"js", "@stylistic"> {
|
|
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
|
}
|
@@ -11,16 +11,8 @@ export default class JsonOption 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
|
}
|
@@ -11,16 +11,8 @@ export default class JsoncOption 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
|
}
|
@@ -16,27 +16,19 @@ export default class SvelteOption extends Option<
|
|
16
16
|
public readonly processor = { processor: "svelte/svelte" } as const;
|
17
17
|
|
18
18
|
public get languageOptions() {
|
19
|
-
|
20
|
-
const [parser, tsParser] = this.parser;
|
19
|
+
const [parser, tsParser] = this.parser;
|
21
20
|
|
22
|
-
|
21
|
+
return {
|
22
|
+
ecmaVersion: "latest",
|
23
|
+
sourceType: "module",
|
24
|
+
parser,
|
25
|
+
parserOptions: {
|
23
26
|
ecmaVersion: "latest",
|
24
27
|
sourceType: "module",
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
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
|
-
}
|
28
|
+
project: "tsconfig.json",
|
29
|
+
extraFileExtensions: [".svelte"] as const,
|
30
|
+
parser: tsParser,
|
31
|
+
},
|
32
|
+
} as const;
|
41
33
|
}
|
42
34
|
}
|
@@ -13,25 +13,17 @@ export default class TsOption extends Option<
|
|
13
13
|
public readonly processor = {} as const;
|
14
14
|
|
15
15
|
public get languageOptions() {
|
16
|
-
|
17
|
-
const [parser] = this.parser;
|
16
|
+
const [parser] = this.parser;
|
18
17
|
|
19
|
-
|
18
|
+
return {
|
19
|
+
ecmaVersion: "latest",
|
20
|
+
sourceType: "module",
|
21
|
+
parser,
|
22
|
+
parserOptions: {
|
20
23
|
ecmaVersion: "latest",
|
21
24
|
sourceType: "module",
|
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
|
-
}
|
25
|
+
project: "tsconfig.json",
|
26
|
+
},
|
27
|
+
} as const;
|
36
28
|
}
|
37
29
|
}
|
@@ -11,16 +11,8 @@ export default class YmlOption 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
|
}
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import type { Scope } from "../../scopes/scopes.js";
|
2
1
|
import Rule from "./rule/Rule.js";
|
2
|
+
import type { Scope } from "../Factory.js";
|
3
3
|
|
4
4
|
export { Rule };
|
5
5
|
export default class Ruleset<S extends Scope> {
|
@@ -10,63 +10,31 @@ export default class Ruleset<S extends Scope> {
|
|
10
10
|
private readonly scope: literalful<S>,
|
11
11
|
...ruleset: readonly Rule[]
|
12
12
|
) {
|
13
|
-
|
14
|
-
this.ruleset = [...ruleset];
|
15
|
-
}
|
16
|
-
catch (e) {
|
17
|
-
throw new Error(
|
18
|
-
`linted.factory.Ruleset`,
|
19
|
-
{ cause: e },
|
20
|
-
);
|
21
|
-
}
|
13
|
+
this.ruleset = [...ruleset];
|
22
14
|
}
|
23
15
|
|
24
16
|
public get id() {
|
25
|
-
|
26
|
-
const { scope } = this;
|
17
|
+
const { scope } = this;
|
27
18
|
|
28
|
-
|
29
|
-
}
|
30
|
-
catch (e) {
|
31
|
-
throw new Error(
|
32
|
-
`linted.factory.Ruleset: id`,
|
33
|
-
{ cause: e },
|
34
|
-
);
|
35
|
-
}
|
19
|
+
return scope;
|
36
20
|
}
|
37
21
|
|
38
22
|
public get records() {
|
39
|
-
|
40
|
-
const { ruleset, overrides } = this;
|
23
|
+
const { ruleset, overrides } = this;
|
41
24
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
}
|
47
|
-
catch (e) {
|
48
|
-
throw new Error(
|
49
|
-
`linted.factory.Ruleset: records`,
|
50
|
-
{ cause: e },
|
51
|
-
);
|
52
|
-
}
|
25
|
+
return [
|
26
|
+
...ruleset.map(rules => [rules.id, rules.rules] as const),
|
27
|
+
...overrides === null ? [] : [[overrides.id, overrides.rules] as const] as const,
|
28
|
+
];
|
53
29
|
}
|
54
30
|
|
55
31
|
public override(overrides: undefined | IRule) {
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
overrides,
|
61
|
-
);
|
62
|
-
|
63
|
-
return this;
|
64
|
-
}
|
65
|
-
catch (e) {
|
66
|
-
throw new Error(
|
67
|
-
`linted.factory.Ruleset: override`,
|
68
|
-
{ cause: e },
|
32
|
+
if (typeof overrides !== "undefined")
|
33
|
+
this.overrides = new Rule(
|
34
|
+
"override",
|
35
|
+
overrides,
|
69
36
|
);
|
70
|
-
|
37
|
+
|
38
|
+
return this;
|
71
39
|
}
|
72
40
|
}
|