@eslinted/core 13.4.0-rc.6 → 13.4.0-rc.8
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/factory/index.d.ts +3 -3
- package/dist/factory/index.js +8 -8
- package/dist/factory/index.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.spec.d.ts +2 -0
- package/dist/index.spec.d.ts.map +1 -0
- package/dist/index.spec.js +29 -0
- package/dist/index.spec.js.map +1 -0
- package/dist/interface/output/common/ignores.d.ts +1 -3
- package/dist/interface/output/common/ignores.d.ts.map +1 -1
- package/dist/interface/output/common/plugins.d.ts +1 -3
- package/dist/interface/output/common/plugins.d.ts.map +1 -1
- package/dist/interface/output/common/settings.d.ts +1 -3
- package/dist/interface/output/common/settings.d.ts.map +1 -1
- package/dist/interface/output/scope/rules.d.ts +2 -4
- package/dist/interface/output/scope/rules.d.ts.map +1 -1
- package/dist/interface/output/scope/settings.d.ts +3 -4
- package/dist/interface/output/scope/settings.d.ts.map +1 -1
- package/dist/interface/shared/config/index.d.ts +4 -2
- package/dist/interface/shared/config/index.d.ts.map +1 -1
- package/dist/test/input.d.ts +3 -0
- package/dist/test/input.d.ts.map +1 -0
- package/dist/test/input.js +102 -0
- package/dist/test/input.js.map +1 -0
- package/package.json +1 -1
- package/src/factory/index.ts +12 -12
- package/src/index.spec.ts +30 -0
- package/src/index.ts +1 -1
- package/src/interface/output/common/ignores.ts +1 -1
- package/src/interface/output/common/plugins.ts +1 -1
- package/src/interface/output/common/settings.ts +1 -1
- package/src/interface/output/scope/rules.ts +11 -4
- package/src/interface/output/scope/settings.ts +17 -5
- package/src/interface/shared/config/index.ts +16 -5
- package/src/test/input.ts +107 -0
package/dist/factory/index.d.ts
CHANGED
@@ -12,11 +12,11 @@ export declare class Factory {
|
|
12
12
|
};
|
13
13
|
readonly languageOptions: {
|
14
14
|
readonly sourceType: "module" | "script";
|
15
|
-
readonly ecmaVersion:
|
15
|
+
readonly ecmaVersion: 3 | 5 | "latest" | 2015 | 2016 | 2017 | 2018 | 2019 | 2020 | 2021 | 2022 | 2023 | 2024;
|
16
16
|
};
|
17
17
|
};
|
18
18
|
readonly ignores: {
|
19
|
-
readonly name: "linted/*/ignores";
|
19
|
+
readonly name: "linted/*/ignores/";
|
20
20
|
readonly ignores: readonly string[];
|
21
21
|
};
|
22
22
|
};
|
@@ -28,7 +28,7 @@ export declare class Factory {
|
|
28
28
|
constructor(tree: typeof Tree, parsers: Input["imports"]["parsers"], { settings: defaultSettings, files: defaultFiles, ignores: defaultIgnores, rules: defaultRules, }: Input["defaults"], { "*": commonExtension, ...scopeExtensions }?: Input["extensions"]);
|
29
29
|
scope<S extends keyof typeof ScopeManifests>(scope: S): readonly [
|
30
30
|
] | ({
|
31
|
-
readonly name: `linted/${S}/${string}
|
31
|
+
readonly name: `linted/${S}/${string}/`;
|
32
32
|
readonly files: Readonly<Record<"*" | "svelte" | "mocha" | "jsonc" | "yml" | "ts" | "html" | "json" | "js", string[]>>[S];
|
33
33
|
readonly ignores: Readonly<Record<"*" | "svelte" | "mocha" | "jsonc" | "yml" | "ts" | "html" | "json" | "js", string[]>>[S];
|
34
34
|
readonly rules: Readonly<Record<string, import("../interface/shared/config/rule/index.js").State | readonly [
|
package/dist/factory/index.js
CHANGED
@@ -13,7 +13,7 @@ export class Factory {
|
|
13
13
|
languageOptions: { sourceType, ecmaVersion },
|
14
14
|
},
|
15
15
|
ignores: {
|
16
|
-
name: "linted/*/ignores",
|
16
|
+
name: "linted/*/ignores/",
|
17
17
|
ignores: [
|
18
18
|
...override ? [] : defaultIgnores["*"],
|
19
19
|
...ignores,
|
@@ -31,13 +31,13 @@ export class Factory {
|
|
31
31
|
this.scopes.ignores[scope].push(...moreIgnores);
|
32
32
|
if (moreRules !== null)
|
33
33
|
this.scopes.rules[scope].push([`${scope}/override`, moreRules]);
|
34
|
-
tree.forEach(([scope, parents]) => {
|
35
|
-
parents.forEach(parent => {
|
36
|
-
this.scopes.files[parent].push(...this.scopes.files[scope]);
|
37
|
-
this.scopes.ignores[parent].push(...this.scopes.ignores[scope]);
|
38
|
-
});
|
39
|
-
});
|
40
34
|
}
|
35
|
+
tree.forEach(([scope, parents]) => {
|
36
|
+
parents.forEach(parent => {
|
37
|
+
this.scopes.files[parent].push(...this.scopes.files[scope]);
|
38
|
+
this.scopes.ignores[parent].push(...this.scopes.ignores[scope]);
|
39
|
+
});
|
40
|
+
});
|
41
41
|
}
|
42
42
|
scope(scope) {
|
43
43
|
const { files: { [scope]: files }, ignores: { [scope]: ignores }, rules: { [scope]: rules }, } = this.scopes, ruleset = rules.map(([id, rules]) => ({ id: `${scope}/${id}`, rules })), { processor, language, languageOptions: { parser = null, ...languageOptionsStatic }, parserOptions: { parser: subparser = null, ...parserOptionsStatic }, } = new ScopeManifests[scope]();
|
@@ -66,7 +66,7 @@ export class Factory {
|
|
66
66
|
},
|
67
67
|
},
|
68
68
|
...ruleset.map(({ id, rules }) => ({
|
69
|
-
name: `linted/${id}
|
69
|
+
name: `linted/${id}/`,
|
70
70
|
files,
|
71
71
|
ignores,
|
72
72
|
rules,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/factory/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAI7C,MAAM,OAAO,OAAO;IAMA;IALF,MAAM,CAAC;IACP,MAAM,CAAC;IAEvB,YACE,IAAiB,EACD,OAAoC,EACpD,EACE,QAAQ,EAAE,eAAe,EACzB,KAAK,EAAE,YAAY,EACnB,OAAO,EAAE,cAAc,EACvB,KAAK,EAAE,YAAY,GACD,EACpB,EAAE,GAAG,EAAE,eAAe,GAAG,EAAE,EAAE,GAAG,eAAe,KAA0B,EAAW;QAPpE,YAAO,GAAP,OAAO,CAA6B;QASpD,MAAM,EACJ,cAAc,GAAG,eAAe,CAAC,cAAc,EAC/C,6BAA6B,GAAG,eAAe,CAAC,6BAA6B,EAC7E,UAAU,GAAG,eAAe,CAAC,UAAU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CAAC,CAAC,MAAM,GAAG,CAAC,IAAI,SAAS,KAAK,IAAI;gCAClE,CAAC,CAAC,EAAW;gCACb,CAAC,CAAC;oCACE,aAAa,EAAE;wCACb,GAAG,mBAAmB;wCACtB,GAAG,SAAS,KAAK,IAAI,CAAC,CAAC,CAAC,EAAW,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,EAAW;qCACnF;iCACO;yBACN;qBACF;oBACV,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;wBACjC,IAAI,EAAE,UAAU,EAAE,GAAG;wBACrB,KAAK;wBACL,OAAO;wBACP,KAAK;qBACI,CAAA,CAAC;iBACb,CAAC;IACV,CAAC;CACF"}
|
package/dist/index.js
CHANGED
@@ -5,7 +5,7 @@ export default function ({ imports: { plugins, parsers }, defaults, extensions,
|
|
5
5
|
const factory = new Factory(tree, parsers, defaults, extensions);
|
6
6
|
return [
|
7
7
|
factory.common.settings,
|
8
|
-
{ name: `linted/*/plugins
|
8
|
+
{ name: `linted/*/plugins/`, plugins },
|
9
9
|
factory.common.ignores,
|
10
10
|
...scopes.flatMap(scope => factory.scope(scope)),
|
11
11
|
];
|
package/dist/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,MAAM,CAAC,OAAO,WAAW,EACvB,OAAO,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,EAC7B,QAAQ,EACR,UAAU,GACJ;IACN,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;QAEjE,OAAO;YACL,OAAO,CAAC,MAAM,CAAC,QAAQ;YACvB,EAAE,IAAI,EAAE,
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,MAAM,CAAC,OAAO,WAAW,EACvB,OAAO,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,EAC7B,QAAQ,EACR,UAAU,GACJ;IACN,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;QAEjE,OAAO;YACL,OAAO,CAAC,MAAM,CAAC,QAAQ;YACvB,EAAE,IAAI,EAAE,mBAAmB,EAAE,OAAO,EAAW;YAC/C,OAAO,CAAC,MAAM,CAAC,OAAO;YACtB,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;SACxC,CAAC;IACb,CAAC;IACD,OAAO,CAAC,EAAE,CAAC;QACT,MAAM,IAAI,KAAK,CAAC,aAAa,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC;IAC/C,CAAC;AACH,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.spec.d.ts","sourceRoot":"","sources":["../src/index.spec.ts"],"names":[],"mappings":""}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
import { expect } from "chai";
|
2
|
+
import core from "./index.js";
|
3
|
+
import { TestInput } from "./test/input.js";
|
4
|
+
const configs = core(TestInput);
|
5
|
+
describe("Core", function () {
|
6
|
+
describe("shape", function () {
|
7
|
+
it("is a function", function () {
|
8
|
+
expect(core)
|
9
|
+
.a("function");
|
10
|
+
});
|
11
|
+
});
|
12
|
+
describe("output", function () {
|
13
|
+
it("is an array", function () {
|
14
|
+
expect(configs)
|
15
|
+
.an("array");
|
16
|
+
});
|
17
|
+
it("is non-empty", function () {
|
18
|
+
expect(configs)
|
19
|
+
.lengthOf.at.least(1);
|
20
|
+
});
|
21
|
+
});
|
22
|
+
describe("TBD: configs", function () {
|
23
|
+
it("have first three common", function () {
|
24
|
+
expect(configs[0])
|
25
|
+
.to.be.an("object");
|
26
|
+
});
|
27
|
+
});
|
28
|
+
});
|
29
|
+
//# sourceMappingURL=index.spec.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.spec.js","sourceRoot":"","sources":["../src/index.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAC9B,OAAO,IAAI,MAAM,GAAG,CAAC;AACrB,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC;AAEhC,QAAQ,CAAC,MAAM,EAAE;IACf,QAAQ,CAAC,OAAO,EAAE;QAChB,EAAE,CAAC,eAAe,EAAE;YAClB,MAAM,CAAC,IAAI,CAAC;iBACT,CAAC,CAAC,UAAU,CAAC,CAAC;QACnB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IACH,QAAQ,CAAC,QAAQ,EAAE;QACjB,EAAE,CAAC,aAAa,EAAE;YAChB,MAAM,CAAC,OAAO,CAAC;iBACZ,EAAE,CAAC,OAAO,CAAC,CAAC;QACjB,CAAC,CAAC,CAAC;QACH,EAAE,CAAC,cAAc,EAAE;YACjB,MAAM,CAAC,OAAO,CAAC;iBACZ,QAAQ,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAC1B,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IACH,QAAQ,CAAC,cAAc,EAAE;QACvB,EAAE,CAAC,yBAAyB,EAAE;YAC5B,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;iBACf,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC;QACxB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
@@ -1,5 +1,3 @@
|
|
1
1
|
import type { PartialConfig } from "../../shared/index.js";
|
2
|
-
export type CommonIgnores = PartialConfig<
|
3
|
-
readonly name: "linted/*/ignores";
|
4
|
-
}, "ignores">;
|
2
|
+
export type CommonIgnores = PartialConfig<"linted/*/ignores/", "ignores">;
|
5
3
|
//# sourceMappingURL=ignores.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ignores.d.ts","sourceRoot":"","sources":["../../../../src/interface/output/common/ignores.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAElD,MAAM,MAAM,aAAa,GAAG,aAAa,CACvC
|
1
|
+
{"version":3,"file":"ignores.d.ts","sourceRoot":"","sources":["../../../../src/interface/output/common/ignores.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAElD,MAAM,MAAM,aAAa,GAAG,aAAa,CACvC,mBAAmB,EACnB,SAAS,CACV,CAAC"}
|
@@ -1,5 +1,3 @@
|
|
1
1
|
import type { PartialConfig } from "../../shared/index.js";
|
2
|
-
export type CommonPlugins<Plugins extends string> = PartialConfig<
|
3
|
-
readonly name: `linted/*/plugins`;
|
4
|
-
}, "plugins", Plugins>;
|
2
|
+
export type CommonPlugins<Plugins extends string> = PartialConfig<"linted/*/plugins/", "plugins", Plugins>;
|
5
3
|
//# sourceMappingURL=plugins.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"plugins.d.ts","sourceRoot":"","sources":["../../../../src/interface/output/common/plugins.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAElD,MAAM,MAAM,aAAa,CAAC,OAAO,SAAS,MAAM,IAAI,aAAa,CAC/D
|
1
|
+
{"version":3,"file":"plugins.d.ts","sourceRoot":"","sources":["../../../../src/interface/output/common/plugins.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAElD,MAAM,MAAM,aAAa,CAAC,OAAO,SAAS,MAAM,IAAI,aAAa,CAC/D,mBAAmB,EACnB,SAAS,EACT,OAAO,CACR,CAAC"}
|
@@ -1,5 +1,3 @@
|
|
1
1
|
import type { PartialConfig } from "../../shared/index.js";
|
2
|
-
export type CommonSettings = PartialConfig<
|
3
|
-
readonly name: `linted/*/`;
|
4
|
-
}, "linterOptions" | "languageOptions">;
|
2
|
+
export type CommonSettings = PartialConfig<"linted/*/", "linterOptions" | "languageOptions">;
|
5
3
|
//# sourceMappingURL=settings.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../../../src/interface/output/common/settings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAElD,MAAM,MAAM,cAAc,GAAG,aAAa,CACxC
|
1
|
+
{"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../../../src/interface/output/common/settings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAElD,MAAM,MAAM,cAAc,GAAG,aAAa,CACxC,WAAW,EACT,eAAe,GACf,iBAAiB,CACpB,CAAC"}
|
@@ -1,5 +1,3 @@
|
|
1
|
-
import type {
|
2
|
-
export type ScopeRules<Scopes extends string> = {
|
3
|
-
readonly name: `linted/${Scopes}/${string}`;
|
4
|
-
} & Pick<Config, "files" | "ignores" | "rules">;
|
1
|
+
import type { PartialConfig } from "../../shared/index.js";
|
2
|
+
export type ScopeRules<Scopes extends string> = PartialConfig<`linted/${Scopes}/${string}/`, "files" | "ignores" | "rules">;
|
5
3
|
//# sourceMappingURL=rules.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"rules.d.ts","sourceRoot":"","sources":["../../../../src/interface/output/scope/rules.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
1
|
+
{"version":3,"file":"rules.d.ts","sourceRoot":"","sources":["../../../../src/interface/output/scope/rules.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAElD,MAAM,MAAM,UAAU,CAAC,MAAM,SAAS,MAAM,IAAI,aAAa,CAC3D,UAAU,MAAM,IAAI,MAAM,GAAG,EAC3B,OAAO,GACP,SAAS,GACT,OAAO,CACV,CAAC"}
|
@@ -1,6 +1,5 @@
|
|
1
|
-
import type {
|
2
|
-
export type ScopeSettings<Scopes extends string> = {
|
3
|
-
readonly name: `linted/${Scopes}/`;
|
1
|
+
import type { PartialConfig } from "../../shared/index.js";
|
2
|
+
export type ScopeSettings<Scopes extends string> = PartialConfig<`linted/${Scopes}/`, "files" | "ignores" | "processor" | "language" | "settings", string, {
|
4
3
|
readonly languageOptions: object;
|
5
|
-
}
|
4
|
+
}>;
|
6
5
|
//# sourceMappingURL=settings.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../../../src/interface/output/scope/settings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
1
|
+
{"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../../../src/interface/output/scope/settings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAElD,MAAM,MAAM,aAAa,CAAC,MAAM,SAAS,MAAM,IAAI,aAAa,CAC9D,UAAU,MAAM,GAAG,EACjB,OAAO,GACP,SAAS,GACT,WAAW,GACX,UAAU,GACV,UAAU,EAEZ,MAAM,EACN;IAAE,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAA;CAAE,CACrC,CAAC"}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import type * as Rule from "./rule/index.js";
|
2
2
|
export type { Rule };
|
3
3
|
export interface Config<Plugins extends string = string> {
|
4
|
-
readonly name: `linted/${string}
|
4
|
+
readonly name: `linted/${string}/`;
|
5
5
|
readonly plugins: Readonly<Record<Plugins, {
|
6
6
|
readonly configs: unknown;
|
7
7
|
}>>;
|
@@ -20,5 +20,7 @@ export interface Config<Plugins extends string = string> {
|
|
20
20
|
readonly language?: string;
|
21
21
|
readonly settings?: Readonly<Record<string, unknown>>;
|
22
22
|
}
|
23
|
-
export type PartialConfig<
|
23
|
+
export type PartialConfig<Name extends Config["name"], Picks extends Exclude<keyof Config, "name" | keyof Rest>, Plugins extends string = string, Rest extends object = object> = (Rest & Pick<Config<Plugins>, Picks> & {
|
24
|
+
readonly name: Name;
|
25
|
+
} & Readonly<Partial<Record<Exclude<keyof Config, "name" | keyof Rest | Picks>, never>>>);
|
24
26
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/interface/shared/config/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,IAAI,MAAM,QAAQ,CAAC;AAEpC,YAAY,EAAE,IAAI,EAAE,CAAC;AACrB,MAAM,WAAW,MAAM,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM;IACrD,QAAQ,CAAC,IAAI,EAAE,UAAU,MAAM,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/interface/shared/config/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,IAAI,MAAM,QAAQ,CAAC;AAEpC,YAAY,EAAE,IAAI,EAAE,CAAC;AACrB,MAAM,WAAW,MAAM,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM;IACrD,QAAQ,CAAC,IAAI,EAAE,UAAU,MAAM,GAAG,CAAC;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GAC5B;IAAE,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAA;CAAE,GACvB,QAAQ,CAAC,OAAO,CAAC,MAAM,CACvB,OAAO,CACL,MAAM,MAAM,EACV,MAAM,GACN,MAAM,IAAI,GACV,KAAK,CACR,EACD,KAAK,CACN,CAAC,CAAC,CACJ,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../src/test/input.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,IAAI,CAAC;AAO3B,eAAO,MAAM,SAAS,EAAE,UAAU,CAAC,OAAO,IAAI,CAAC,CAAC,CAAC,CAmGvC,CAAC"}
|
@@ -0,0 +1,102 @@
|
|
1
|
+
const ERROR = "error", OFF = "off", Plugin = { configs: null };
|
2
|
+
export const TestInput = {
|
3
|
+
imports: {
|
4
|
+
plugins: {
|
5
|
+
"@html-eslint": Plugin,
|
6
|
+
"@stylistic": Plugin,
|
7
|
+
"@typescript-eslint": Plugin,
|
8
|
+
mocha: Plugin,
|
9
|
+
svelte: Plugin,
|
10
|
+
jsonc: Plugin,
|
11
|
+
yml: Plugin,
|
12
|
+
},
|
13
|
+
parsers: {
|
14
|
+
ts: "parsers.ts",
|
15
|
+
svelte: "parsers.svelte",
|
16
|
+
html: "parsers.html",
|
17
|
+
jsonc: "parsers.jsonc",
|
18
|
+
yml: "parsers.yml",
|
19
|
+
},
|
20
|
+
},
|
21
|
+
extensions: {},
|
22
|
+
defaults: {
|
23
|
+
settings: {
|
24
|
+
ecmaVersion: 2024,
|
25
|
+
sourceType: "module",
|
26
|
+
noInlineConfig: true,
|
27
|
+
reportUnusedDisableDirectives: "error",
|
28
|
+
},
|
29
|
+
files: {
|
30
|
+
"*": ["default.*"],
|
31
|
+
js: ["default.js"],
|
32
|
+
ts: ["default.ts"],
|
33
|
+
svelte: ["default.svelte"],
|
34
|
+
mocha: ["default.mocha"],
|
35
|
+
html: ["default.html"],
|
36
|
+
json: ["default.json"],
|
37
|
+
jsonc: ["default.jsonc"],
|
38
|
+
yml: ["default.yml"],
|
39
|
+
},
|
40
|
+
ignores: {
|
41
|
+
"*": ["ignore/default.*"],
|
42
|
+
js: ["ignore/default.js"],
|
43
|
+
ts: ["ignore/default.ts"],
|
44
|
+
svelte: ["ignore/default.svelte"],
|
45
|
+
mocha: ["ignore/default.mocha"],
|
46
|
+
html: ["ignore/default.html"],
|
47
|
+
json: ["ignore/default.json"],
|
48
|
+
jsonc: ["ignore/default.jsonc"],
|
49
|
+
yml: ["ignore/default.yml"],
|
50
|
+
},
|
51
|
+
rules: {
|
52
|
+
js: [
|
53
|
+
[
|
54
|
+
"enable",
|
55
|
+
{
|
56
|
+
vanilla: ERROR,
|
57
|
+
vanilla0: ERROR,
|
58
|
+
vanilla1: ERROR,
|
59
|
+
vanilla2: ERROR,
|
60
|
+
},
|
61
|
+
],
|
62
|
+
["enable/stylistic", { "@stylistic/style-rule": ERROR }],
|
63
|
+
],
|
64
|
+
ts: [
|
65
|
+
["disable", { vanilla0: OFF }],
|
66
|
+
["enable", { "@typescript-eslint/vanilla-typed": ERROR }],
|
67
|
+
[
|
68
|
+
"enable/extension",
|
69
|
+
{
|
70
|
+
"@typescript-eslint/enums": ERROR,
|
71
|
+
"@typescript-eslint/destructure-expression": ERROR,
|
72
|
+
"@typescript-eslint/global": ERROR,
|
73
|
+
},
|
74
|
+
],
|
75
|
+
],
|
76
|
+
svelte: [
|
77
|
+
["disable", { vanilla1: OFF }],
|
78
|
+
["disable/ts", { "@typescript-eslint/destructure-expression": ERROR }],
|
79
|
+
["enable", { "svelte/destructure-expression": ERROR }],
|
80
|
+
["enable-extension", { "svelte/tags": ERROR }],
|
81
|
+
],
|
82
|
+
mocha: [
|
83
|
+
["disable", { vanilla2: OFF }],
|
84
|
+
["disable/ts", { "@typescript-eslint/global": ERROR }],
|
85
|
+
["enable", { "mocha/test-expression": ERROR }],
|
86
|
+
],
|
87
|
+
html: [["enable", { "html/attribute": ERROR }]],
|
88
|
+
json: [
|
89
|
+
[
|
90
|
+
"enable",
|
91
|
+
{
|
92
|
+
"jsonc/property-check": ERROR,
|
93
|
+
"jsonc/trailing-comma": [ERROR, "always"],
|
94
|
+
},
|
95
|
+
],
|
96
|
+
],
|
97
|
+
jsonc: [["override", { "jsonc/trailing-comma": [ERROR, "never"] }]],
|
98
|
+
yml: [["enable", { "yml/property-check": ERROR }]],
|
99
|
+
},
|
100
|
+
},
|
101
|
+
};
|
102
|
+
//# sourceMappingURL=input.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"input.js","sourceRoot":"","sources":["../../src/test/input.ts"],"names":[],"mappings":"AAEA,MACA,KAAK,GAAG,OAAO,EACf,GAAG,GAAG,KAAK,EACX,MAAM,GAAG,EAAE,OAAO,EAAE,IAAI,EAAW,CAAC;AAEpC,MAAM,CAAC,MAAM,SAAS,GAA+B;IACnD,OAAO,EAAE;QACP,OAAO,EAAE;YACP,cAAc,EAAE,MAAM;YACtB,YAAY,EAAE,MAAM;YACpB,oBAAoB,EAAE,MAAM;YAC5B,KAAK,EAAE,MAAM;YACb,MAAM,EAAE,MAAM;YACd,KAAK,EAAE,MAAM;YACb,GAAG,EAAE,MAAM;SACH;QACV,OAAO,EAAE;YACP,EAAE,EAAE,YAAY;YAChB,MAAM,EAAE,gBAAgB;YACxB,IAAI,EAAE,cAAc;YACpB,KAAK,EAAE,eAAe;YACtB,GAAG,EAAE,aAAa;SACV;KACF;IACV,UAAU,EAAE,EAAE;IACd,QAAQ,EAAE;QACR,QAAQ,EAAE;YACR,WAAW,EAAE,IAAI;YACjB,UAAU,EAAE,QAAQ;YACpB,cAAc,EAAE,IAAI;YACpB,6BAA6B,EAAE,OAAO;SACvC;QACD,KAAK,EAAE;YACL,GAAG,EAAE,CAAC,WAAW,CAAC;YAClB,EAAE,EAAE,CAAC,YAAY,CAAC;YAClB,EAAE,EAAE,CAAC,YAAY,CAAC;YAClB,MAAM,EAAE,CAAC,gBAA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/E,CAAC,QAAQ,EAAE,EAAE,+BAA+B,EAAE,KAAK,EAAE,CAAU;gBAC/D,CAAC,kBAAkB,EAAE,EAAE,aAAa,EAAE,KAAK,EAAE,CAAU;aACxD;YACD,KAAK,EAAE;gBACL,CAAC,SAAS,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAU;gBACvC,CAAC,YAAY,EAAE,EAAE,2BAA2B,EAAE,KAAK,EAAE,CAAU;gBAC/D,CAAC,QAAQ,EAAE,EAAE,uBAAuB,EAAE,KAAK,EAAE,CAAU;aACxD;YACD,IAAI,EAAE,CAAC,CAAC,QAAQ,EAAE,EAAE,gBAAgB,EAAE,KAAK,EAAE,CAAU,CAAC;YACxD,IAAI,EAAE;gBACJ;oBACE,QAAQ;oBACR;wBACE,sBAAsB,EAAE,KAAK;wBAC7B,sBAAsB,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC;qBAC1C;iBACO;aACX;YACD,KAAK,EAAE,CAAC,CAAC,UAAU,EAAE,EAAE,sBAAsB,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,EAAE,CAAU,CAAC;YAC5E,GAAG,EAAE,CAAC,CAAC,QAAQ,EAAE,EAAE,oBAAoB,EAAE,KAAK,EAAE,CAAU,CAAC;SACnD;KACF;CACF,CAAC"}
|
package/package.json
CHANGED
package/src/factory/index.ts
CHANGED
@@ -33,7 +33,7 @@ export class Factory {
|
|
33
33
|
languageOptions: { sourceType, ecmaVersion } as const,
|
34
34
|
} as const,
|
35
35
|
ignores: {
|
36
|
-
name: "linted/*/ignores",
|
36
|
+
name: "linted/*/ignores/",
|
37
37
|
ignores: [
|
38
38
|
...override ? [] as const : defaultIgnores["*"],
|
39
39
|
...ignores,
|
@@ -60,18 +60,18 @@ export class Factory {
|
|
60
60
|
|
61
61
|
if (moreRules !== null)
|
62
62
|
this.scopes.rules[scope as keyof typeof scopeExtensions].push([`${scope}/override`, moreRules]);
|
63
|
+
}
|
63
64
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
});
|
65
|
+
tree.forEach(([scope, parents]) => {
|
66
|
+
parents.forEach(parent => {
|
67
|
+
this.scopes.files[parent].push(
|
68
|
+
...this.scopes.files[scope],
|
69
|
+
);
|
70
|
+
this.scopes.ignores[parent].push(
|
71
|
+
...this.scopes.ignores[scope],
|
72
|
+
);
|
73
73
|
});
|
74
|
-
}
|
74
|
+
});
|
75
75
|
}
|
76
76
|
|
77
77
|
public scope<S extends keyof typeof ScopeManifests>(scope: S) {
|
@@ -119,7 +119,7 @@ export class Factory {
|
|
119
119
|
} as const,
|
120
120
|
} as const,
|
121
121
|
...ruleset.map(({ id, rules }) => ({
|
122
|
-
name: `linted/${id}
|
122
|
+
name: `linted/${id}/`,
|
123
123
|
files,
|
124
124
|
ignores,
|
125
125
|
rules,
|
@@ -0,0 +1,30 @@
|
|
1
|
+
import { expect } from "chai";
|
2
|
+
import core from ".";
|
3
|
+
import { TestInput } from "./test/input";
|
4
|
+
|
5
|
+
const configs = core(TestInput);
|
6
|
+
|
7
|
+
describe("Core", function () {
|
8
|
+
describe("shape", function () {
|
9
|
+
it("is a function", function () {
|
10
|
+
expect(core)
|
11
|
+
.a("function");
|
12
|
+
});
|
13
|
+
});
|
14
|
+
describe("output", function () {
|
15
|
+
it("is an array", function () {
|
16
|
+
expect(configs)
|
17
|
+
.an("array");
|
18
|
+
});
|
19
|
+
it("is non-empty", function () {
|
20
|
+
expect(configs)
|
21
|
+
.lengthOf.at.least(1);
|
22
|
+
});
|
23
|
+
});
|
24
|
+
describe("TBD: configs", function () {
|
25
|
+
it("have first three common", function () {
|
26
|
+
expect(configs[0])
|
27
|
+
.to.be.an("object");
|
28
|
+
});
|
29
|
+
});
|
30
|
+
});
|
package/src/index.ts
CHANGED
@@ -14,7 +14,7 @@ export default function ({
|
|
14
14
|
|
15
15
|
return [
|
16
16
|
factory.common.settings,
|
17
|
-
{ name: `linted/*/plugins
|
17
|
+
{ name: `linted/*/plugins/`, plugins } as const,
|
18
18
|
factory.common.ignores,
|
19
19
|
...scopes.flatMap(scope => factory.scope(scope)),
|
20
20
|
] as const;
|
@@ -1,5 +1,12 @@
|
|
1
|
-
import type {
|
1
|
+
import type { PartialConfig } from "../../shared";
|
2
2
|
|
3
|
-
export type ScopeRules<Scopes extends string> =
|
4
|
-
|
5
|
-
|
3
|
+
export type ScopeRules<Scopes extends string> = PartialConfig<
|
4
|
+
`linted/${Scopes}/${string}/`,
|
5
|
+
| "files"
|
6
|
+
| "ignores"
|
7
|
+
| "rules"
|
8
|
+
>;
|
9
|
+
|
10
|
+
// export type ScopeRules<Scopes extends string> = {
|
11
|
+
// readonly name: `linted/${Scopes}/${string}/`;
|
12
|
+
// } & Pick<Config, "files" | "ignores" | "rules">;
|
@@ -1,6 +1,18 @@
|
|
1
|
-
import type {
|
1
|
+
import type { PartialConfig } from "../../shared";
|
2
2
|
|
3
|
-
export type ScopeSettings<Scopes extends string> =
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
export type ScopeSettings<Scopes extends string> = PartialConfig<
|
4
|
+
`linted/${Scopes}/`,
|
5
|
+
| "files"
|
6
|
+
| "ignores"
|
7
|
+
| "processor"
|
8
|
+
| "language"
|
9
|
+
| "settings"
|
10
|
+
,
|
11
|
+
string,
|
12
|
+
{ readonly languageOptions: object }
|
13
|
+
>;
|
14
|
+
|
15
|
+
// export type ScopeSettings<Scopes extends string> = {
|
16
|
+
// readonly name: `linted/${Scopes}/`;
|
17
|
+
// readonly languageOptions: object;
|
18
|
+
// } & Pick<Config, "files" | "ignores" | "processor" | "language" | "settings">;
|
@@ -2,7 +2,7 @@ import type * as Rule from "./rule";
|
|
2
2
|
|
3
3
|
export type { Rule };
|
4
4
|
export interface Config<Plugins extends string = string> {
|
5
|
-
readonly name: `linted/${string}
|
5
|
+
readonly name: `linted/${string}/`;
|
6
6
|
readonly plugins: Readonly<Record<
|
7
7
|
Plugins,
|
8
8
|
{ readonly configs: unknown }
|
@@ -44,14 +44,25 @@ export interface Config<Plugins extends string = string> {
|
|
44
44
|
readonly settings?: Readonly<Record<string, unknown>>;
|
45
45
|
}
|
46
46
|
export type PartialConfig<
|
47
|
-
|
48
|
-
Picks extends Exclude<
|
47
|
+
Name extends Config["name"],
|
48
|
+
Picks extends Exclude<
|
49
|
+
keyof Config,
|
50
|
+
| "name"
|
51
|
+
| keyof Rest
|
52
|
+
>,
|
49
53
|
Plugins extends string = string,
|
54
|
+
Rest extends object = object,
|
50
55
|
> = (
|
51
|
-
&
|
56
|
+
& Rest
|
52
57
|
& Pick<Config<Plugins>, Picks>
|
58
|
+
& { readonly name: Name }
|
53
59
|
& Readonly<Partial<Record<
|
54
|
-
Exclude<
|
60
|
+
Exclude<
|
61
|
+
keyof Config,
|
62
|
+
| "name"
|
63
|
+
| keyof Rest
|
64
|
+
| Picks
|
65
|
+
>,
|
55
66
|
never
|
56
67
|
>>>
|
57
68
|
);
|
@@ -0,0 +1,107 @@
|
|
1
|
+
import type Core from "..";
|
2
|
+
|
3
|
+
const
|
4
|
+
ERROR = "error",
|
5
|
+
OFF = "off",
|
6
|
+
Plugin = { configs: null } as const;
|
7
|
+
|
8
|
+
export const TestInput: Parameters<typeof Core>[0] = {
|
9
|
+
imports: {
|
10
|
+
plugins: {
|
11
|
+
"@html-eslint": Plugin,
|
12
|
+
"@stylistic": Plugin,
|
13
|
+
"@typescript-eslint": Plugin,
|
14
|
+
mocha: Plugin,
|
15
|
+
svelte: Plugin,
|
16
|
+
jsonc: Plugin,
|
17
|
+
yml: Plugin,
|
18
|
+
} as const,
|
19
|
+
parsers: {
|
20
|
+
ts: "parsers.ts",
|
21
|
+
svelte: "parsers.svelte",
|
22
|
+
html: "parsers.html",
|
23
|
+
jsonc: "parsers.jsonc",
|
24
|
+
yml: "parsers.yml",
|
25
|
+
} as const,
|
26
|
+
} as const,
|
27
|
+
extensions: {},
|
28
|
+
defaults: {
|
29
|
+
settings: {
|
30
|
+
ecmaVersion: 2024,
|
31
|
+
sourceType: "module",
|
32
|
+
noInlineConfig: true,
|
33
|
+
reportUnusedDisableDirectives: "error",
|
34
|
+
},
|
35
|
+
files: {
|
36
|
+
"*": ["default.*"],
|
37
|
+
js: ["default.js"],
|
38
|
+
ts: ["default.ts"],
|
39
|
+
svelte: ["default.svelte"],
|
40
|
+
mocha: ["default.mocha"],
|
41
|
+
html: ["default.html"],
|
42
|
+
json: ["default.json"],
|
43
|
+
jsonc: ["default.jsonc"],
|
44
|
+
yml: ["default.yml"],
|
45
|
+
} as const,
|
46
|
+
ignores: {
|
47
|
+
"*": ["ignore/default.*"],
|
48
|
+
js: ["ignore/default.js"],
|
49
|
+
ts: ["ignore/default.ts"],
|
50
|
+
svelte: ["ignore/default.svelte"],
|
51
|
+
mocha: ["ignore/default.mocha"],
|
52
|
+
html: ["ignore/default.html"],
|
53
|
+
json: ["ignore/default.json"],
|
54
|
+
jsonc: ["ignore/default.jsonc"],
|
55
|
+
yml: ["ignore/default.yml"],
|
56
|
+
} as const,
|
57
|
+
rules: {
|
58
|
+
js: [
|
59
|
+
[
|
60
|
+
"enable",
|
61
|
+
{
|
62
|
+
vanilla: ERROR,
|
63
|
+
vanilla0: ERROR,
|
64
|
+
vanilla1: ERROR,
|
65
|
+
vanilla2: ERROR,
|
66
|
+
},
|
67
|
+
] as const,
|
68
|
+
["enable/stylistic", { "@stylistic/style-rule": ERROR }] as const,
|
69
|
+
],
|
70
|
+
ts: [
|
71
|
+
["disable", { vanilla0: OFF }] as const,
|
72
|
+
["enable", { "@typescript-eslint/vanilla-typed": ERROR }] as const,
|
73
|
+
[
|
74
|
+
"enable/extension",
|
75
|
+
{
|
76
|
+
"@typescript-eslint/enums": ERROR,
|
77
|
+
"@typescript-eslint/destructure-expression": ERROR,
|
78
|
+
"@typescript-eslint/global": ERROR,
|
79
|
+
},
|
80
|
+
] as const,
|
81
|
+
],
|
82
|
+
svelte: [
|
83
|
+
["disable", { vanilla1: OFF }] as const,
|
84
|
+
["disable/ts", { "@typescript-eslint/destructure-expression": ERROR }] as const,
|
85
|
+
["enable", { "svelte/destructure-expression": ERROR }] as const,
|
86
|
+
["enable-extension", { "svelte/tags": ERROR }] as const,
|
87
|
+
],
|
88
|
+
mocha: [
|
89
|
+
["disable", { vanilla2: OFF }] as const,
|
90
|
+
["disable/ts", { "@typescript-eslint/global": ERROR }] as const,
|
91
|
+
["enable", { "mocha/test-expression": ERROR }] as const,
|
92
|
+
],
|
93
|
+
html: [["enable", { "html/attribute": ERROR }] as const],
|
94
|
+
json: [
|
95
|
+
[
|
96
|
+
"enable",
|
97
|
+
{
|
98
|
+
"jsonc/property-check": ERROR,
|
99
|
+
"jsonc/trailing-comma": [ERROR, "always"],
|
100
|
+
},
|
101
|
+
] as const,
|
102
|
+
],
|
103
|
+
jsonc: [["override", { "jsonc/trailing-comma": [ERROR, "never"] }] as const],
|
104
|
+
yml: [["enable", { "yml/property-check": ERROR }] as const],
|
105
|
+
} as const,
|
106
|
+
} as const,
|
107
|
+
} as const;
|