@eslinted/core 13.5.0 → 14.0.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/factory/index.d.ts +7 -7
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -2
- package/dist/index.js.map +1 -1
- package/dist/index.spec.js +19 -4
- package/dist/index.spec.js.map +1 -1
- package/dist/interface/input/imports.d.ts +2 -6
- package/dist/interface/input/imports.d.ts.map +1 -1
- package/dist/interface/input/index.d.ts +2 -2
- package/dist/interface/input/index.d.ts.map +1 -1
- package/dist/interface/output/common/index.d.ts +0 -1
- package/dist/interface/output/common/index.d.ts.map +1 -1
- package/dist/interface/output/index.d.ts +2 -3
- package/dist/interface/output/index.d.ts.map +1 -1
- package/dist/interface/output/scope/settings.d.ts +1 -1
- package/dist/interface/output/scope/settings.d.ts.map +1 -1
- package/dist/interface/shared/config/index.d.ts +2 -5
- package/dist/interface/shared/config/index.d.ts.map +1 -1
- package/dist/scopes/imports/index.d.ts +0 -1
- package/dist/scopes/imports/index.d.ts.map +1 -1
- package/dist/test/input.d.ts.map +1 -1
- package/dist/test/input.js +1 -10
- package/dist/test/input.js.map +1 -1
- package/package.json +1 -1
- package/src/index.spec.ts +21 -4
- package/src/index.ts +1 -2
- package/src/interface/input/imports.ts +5 -10
- package/src/interface/input/index.ts +2 -5
- package/src/interface/output/common/index.ts +0 -1
- package/src/interface/output/index.ts +1 -3
- package/src/interface/output/scope/settings.ts +0 -6
- package/src/interface/shared/config/index.ts +2 -7
- package/src/scopes/imports/index.ts +0 -1
- package/src/test/input.ts +1 -11
- package/dist/interface/output/common/plugins.d.ts +0 -3
- package/dist/interface/output/common/plugins.d.ts.map +0 -1
- package/dist/interface/output/common/plugins.js +0 -2
- package/dist/interface/output/common/plugins.js.map +0 -1
- package/dist/scopes/imports/plugins.d.ts +0 -2
- package/dist/scopes/imports/plugins.d.ts.map +0 -1
- package/dist/scopes/imports/plugins.js +0 -2
- package/dist/scopes/imports/plugins.js.map +0 -1
- package/src/interface/output/common/plugins.ts +0 -7
- package/src/scopes/imports/plugins.ts +0 -9
package/dist/factory/index.d.ts
CHANGED
@@ -21,16 +21,16 @@ export declare class Factory {
|
|
21
21
|
};
|
22
22
|
};
|
23
23
|
readonly scopes: {
|
24
|
-
readonly files: Readonly<Record<"*" | "
|
25
|
-
readonly ignores: Readonly<Record<"*" | "
|
26
|
-
readonly rules: Readonly<Record<"
|
24
|
+
readonly files: Readonly<Record<"*" | "ts" | "svelte" | "html" | "jsonc" | "yml" | "json" | "mocha" | "js", string[]>>;
|
25
|
+
readonly ignores: Readonly<Record<"*" | "ts" | "svelte" | "html" | "jsonc" | "yml" | "json" | "mocha" | "js", string[]>>;
|
26
|
+
readonly rules: Readonly<Record<"ts" | "svelte" | "html" | "jsonc" | "yml" | "json" | "mocha" | "js", import("../interface/shared/config/rule/index.js").NamedBag[]>>;
|
27
27
|
};
|
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
31
|
readonly name: `linted/${S}/${string}/`;
|
32
|
-
readonly files: Readonly<Record<"*" | "
|
33
|
-
readonly ignores: Readonly<Record<"*" | "
|
32
|
+
readonly files: Readonly<Record<"*" | "ts" | "svelte" | "html" | "jsonc" | "yml" | "json" | "mocha" | "js", string[]>>[S];
|
33
|
+
readonly ignores: Readonly<Record<"*" | "ts" | "svelte" | "html" | "jsonc" | "yml" | "json" | "mocha" | "js", string[]>>[S];
|
34
34
|
readonly rules: Readonly<Record<string, import("../interface/shared/config/rule/index.js").State | readonly [
|
35
35
|
import("../interface/shared/config/rule/index.js").State,
|
36
36
|
...unknown[]
|
@@ -38,8 +38,8 @@ export declare class Factory {
|
|
38
38
|
} | {
|
39
39
|
readonly processor?: "svelte/svelte";
|
40
40
|
readonly name: `linted/${S}/`;
|
41
|
-
readonly files: Readonly<Record<"*" | "
|
42
|
-
readonly ignores: Readonly<Record<"*" | "
|
41
|
+
readonly files: Readonly<Record<"*" | "ts" | "svelte" | "html" | "jsonc" | "yml" | "json" | "mocha" | "js", string[]>>[S];
|
42
|
+
readonly ignores: Readonly<Record<"*" | "ts" | "svelte" | "html" | "jsonc" | "yml" | "json" | "mocha" | "js", string[]>>[S];
|
43
43
|
readonly languageOptions: {
|
44
44
|
readonly parserOptions?: {
|
45
45
|
readonly parser?: unknown;
|
package/dist/index.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import type { Input, Output } from "./interface/index.js";
|
2
2
|
export type * from "./interface/index.js";
|
3
3
|
export type * from "./scopes/index.js";
|
4
|
-
export default function ({ imports: {
|
4
|
+
export default function ({ imports: { parsers }, defaults, extensions, }: Input): Output;
|
5
5
|
//# 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":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAIjD,mBAAmB,aAAa,CAAC;AACjC,mBAAmB,UAAU,CAAC;AAC9B,MAAM,CAAC,OAAO,WAAW,EACvB,OAAO,EAAE,EAAE,OAAO,EAAE,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAIjD,mBAAmB,aAAa,CAAC;AACjC,mBAAmB,UAAU,CAAC;AAC9B,MAAM,CAAC,OAAO,WAAW,EACvB,OAAO,EAAE,EAAE,OAAO,EAAE,EACpB,QAAQ,EACR,UAAU,GACX,EAAE,KAAK,GAAG,MAAM,CAahB"}
|
package/dist/index.js
CHANGED
@@ -1,11 +1,10 @@
|
|
1
1
|
import { scopes, tree } from "./scopes/index.js";
|
2
2
|
import { Factory } from "./factory/index.js";
|
3
|
-
export default function ({ imports: {
|
3
|
+
export default function ({ imports: { parsers }, defaults, extensions, }) {
|
4
4
|
try {
|
5
5
|
const factory = new Factory(tree, parsers, defaults, extensions);
|
6
6
|
return [
|
7
7
|
factory.common.settings,
|
8
|
-
{ name: `linted/*/plugins/`, plugins },
|
9
8
|
factory.common.ignores,
|
10
9
|
...scopes.flatMap(scope => factory.scope(scope)),
|
11
10
|
];
|
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,
|
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,EACpB,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,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"}
|
package/dist/index.spec.js
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
import { expect } from "chai";
|
2
2
|
import core from "./index.js";
|
3
|
+
import { scopes } from "./scopes/index.js";
|
3
4
|
import { TestInput } from "./test/input.js";
|
4
5
|
const configs = core(TestInput);
|
5
6
|
describe("Core", function () {
|
@@ -16,13 +17,27 @@ describe("Core", function () {
|
|
16
17
|
});
|
17
18
|
it("is non-empty", function () {
|
18
19
|
expect(configs)
|
19
|
-
.lengthOf.
|
20
|
+
.has.lengthOf.above(1);
|
21
|
+
});
|
22
|
+
it(`has length >= common ignores + common settings + ${scopes.length} scopes = ${scopes.length + 2} [Actual: ${configs.length}`, function () {
|
23
|
+
expect(configs)
|
24
|
+
.lengthOf.at.least(scopes.length + 2);
|
25
|
+
});
|
26
|
+
it("has only config-like members", function () {
|
27
|
+
expect(configs)
|
28
|
+
.satisfies((configs) => configs.every(config => typeof config === "object" && config !== null && "name" in config && typeof config.name === "string"));
|
20
29
|
});
|
21
30
|
});
|
22
|
-
describe("
|
23
|
-
it("
|
31
|
+
describe("configs", function () {
|
32
|
+
it("begin with common settings", function () {
|
33
|
+
expect(configs[0])
|
34
|
+
.has.property("name", "linted/*/");
|
35
|
+
expect(configs[0])
|
36
|
+
.has.property("linterOptions");
|
37
|
+
expect(configs[0])
|
38
|
+
.has.nested.property("languageOptions.sourceType");
|
24
39
|
expect(configs[0])
|
25
|
-
.
|
40
|
+
.has.nested.property("languageOptions.ecmaVersion");
|
26
41
|
});
|
27
42
|
});
|
28
43
|
});
|
package/dist/index.spec.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.spec.js","sourceRoot":"","sources":["../src/index.spec.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,4BAA4B,CAAC,CAAC;YACrD,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;iBACf,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,6BAA6B,CAAC,CAAC;QACxD,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
@@ -1,6 +1,2 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
readonly plugins: Config<Plugins>["plugins"];
|
4
|
-
readonly parsers: Readonly<Record<Parsers, unknown>>;
|
5
|
-
}
|
6
|
-
//# sourceMappingURL=imports.d.ts.map
|
1
|
+
export type Imports<Parsers extends string> = Readonly<Record<"parsers", Readonly<Record<Parsers, unknown>>>>;
|
2
|
+
//# sourceMappingURL=imports.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"imports.d.ts","sourceRoot":"","sources":["../../../src/interface/input/imports.ts"],"names":[],"mappings":"AAAA,
|
1
|
+
{"version":3,"file":"imports.d.ts","sourceRoot":"","sources":["../../../src/interface/input/imports.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,OAAO,CAAC,OAAO,SAAS,MAAM,IAAI,QAAQ,CAAC,MAAM,CAC3D,SAAS,EACT,QAAQ,CAAC,MAAM,CACb,OAAO,EACP,OAAO,CACR,CAAC,CACH,CAAC,CAAC"}
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import type { Imports } from "./imports.js";
|
2
2
|
import type { Defaults, Extensions } from "./scopes/index.js";
|
3
|
-
import type {
|
3
|
+
import type { Parsers, Scopes } from "../../scopes/index.js";
|
4
4
|
export interface Input {
|
5
|
-
readonly imports: Imports<
|
5
|
+
readonly imports: Imports<Parsers>;
|
6
6
|
readonly defaults: Defaults<Scopes>;
|
7
7
|
readonly extensions: Extensions<Scopes>;
|
8
8
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/interface/input/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACrD,OAAO,KAAK,EAAE,OAAO,EAAE,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/interface/input/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACrD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEpD,MAAM,WAAW,KAAK;IACpB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IACnC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IACpC,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC;CACzC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/interface/output/common/index.ts"],"names":[],"mappings":"AAAA,mBAAmB,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/interface/output/common/index.ts"],"names":[],"mappings":"AAAA,mBAAmB,YAAY,CAAC;AAChC,mBAAmB,WAAW,CAAC"}
|
@@ -1,9 +1,8 @@
|
|
1
|
-
import type {
|
1
|
+
import type { CommonSettings, CommonIgnores } from "./common/index.js";
|
2
2
|
import type { ScopeSettings, ScopeRules } from "./scope/index.js";
|
3
|
-
import type {
|
3
|
+
import type { Scopes } from "../../scopes/index.js";
|
4
4
|
export type Output = readonly [
|
5
5
|
CommonSettings,
|
6
|
-
CommonPlugins<Plugins>,
|
7
6
|
CommonIgnores,
|
8
7
|
...readonly (ScopeSettings<Scopes> | ScopeRules<Scopes>)[]
|
9
8
|
];
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/interface/output/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/interface/output/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EACd,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EACV,aAAa,EACb,UAAU,EACX,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAE3C,MAAM,MAAM,MAAM,GAAG,SAAS;IAC5B,cAAc;IACd,aAAa;IACb,GAAG,SAAS,CAAC,aAAa,CAAC,MAAM,CAAC,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,EAAE;CAC3D,CAAC"}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import type { PartialConfig } from "../../shared/index.js";
|
2
|
-
export type ScopeSettings<Scopes extends string> = PartialConfig<`linted/${Scopes}/`, "files" | "ignores" | "processor" | "language" | "settings",
|
2
|
+
export type ScopeSettings<Scopes extends string> = PartialConfig<`linted/${Scopes}/`, "files" | "ignores" | "processor" | "language" | "settings", {
|
3
3
|
readonly languageOptions: object;
|
4
4
|
}>;
|
5
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,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
|
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;IAAE,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAA;CAAE,CACrC,CAAC"}
|
@@ -1,10 +1,7 @@
|
|
1
1
|
import type * as Rule from "./rule/index.js";
|
2
2
|
export type { Rule };
|
3
|
-
export interface Config
|
3
|
+
export interface Config {
|
4
4
|
readonly name: `linted/${string}/`;
|
5
|
-
readonly plugins: Readonly<Record<Plugins, {
|
6
|
-
readonly configs: unknown;
|
7
|
-
}>>;
|
8
5
|
readonly files: readonly string[];
|
9
6
|
readonly ignores: readonly string[];
|
10
7
|
readonly rules: Rule.Bag;
|
@@ -20,7 +17,7 @@ export interface Config<Plugins extends string = string> {
|
|
20
17
|
readonly language?: string;
|
21
18
|
readonly settings?: Readonly<Record<string, unknown>>;
|
22
19
|
}
|
23
|
-
export type PartialConfig<Name extends Config["name"], Picks extends Exclude<keyof Config, "name" | keyof Rest>,
|
20
|
+
export type PartialConfig<Name extends Config["name"], Picks extends Exclude<keyof Config, "name" | keyof Rest>, Rest extends object = object> = (Rest & Pick<Config, Picks> & {
|
24
21
|
readonly name: Name;
|
25
22
|
} & Readonly<Partial<Record<Exclude<keyof Config, "name" | keyof Rest | Picks>, never>>>);
|
26
23
|
//# 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
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/interface/shared/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nB;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"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/scopes/imports/index.ts"],"names":[],"mappings":"AAAA,mBAAmB,WAAW,CAAC
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/scopes/imports/index.ts"],"names":[],"mappings":"AAAA,mBAAmB,WAAW,CAAC"}
|
package/dist/test/input.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../src/test/input.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,IAAI,CAAC;
|
1
|
+
{"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../src/test/input.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,IAAI,CAAC;AAM3B,eAAO,MAAM,SAAS,EAAE,UAAU,CAAC,OAAO,IAAI,CAAC,CAAC,CAAC,CA0FvC,CAAC"}
|
package/dist/test/input.js
CHANGED
@@ -1,15 +1,6 @@
|
|
1
|
-
const ERROR = "error", OFF = "off"
|
1
|
+
const ERROR = "error", OFF = "off";
|
2
2
|
export const TestInput = {
|
3
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
4
|
parsers: {
|
14
5
|
ts: "parsers.ts",
|
15
6
|
svelte: "parsers.svelte",
|
package/dist/test/input.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"input.js","sourceRoot":"","sources":["../../src/test/input.ts"],"names":[],"mappings":"AAEA,MACA,KAAK,GAAG,OAAO,EACf,GAAG,GAAG,KAAK,
|
1
|
+
{"version":3,"file":"input.js","sourceRoot":"","sources":["../../src/test/input.ts"],"names":[],"mappings":"AAEA,MACA,KAAK,GAAG,OAAO,EACf,GAAG,GAAG,KAAK,CAAC;AAEZ,MAAM,CAAC,MAAM,SAAS,GAA+B;IACnD,OAAO,EAAE;QACP,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,gBAAgB,CAAC;YAC1B,KAAK,EAAE,CAAC,eAAe,CAAC;YACxB,IAAI,EAAE,CAAC,cAAc,CAAC;YACtB,IAAI,EAAE,CAAC,cAAc,CAAC;YACtB,KAAK,EAAE,CAAC,eAAe,CAAC;YACxB,GAAG,EAAE,CAAC,aAAa,CAAC;SACZ;QACV,OAAO,EAAE;YACP,GAAG,EAAE,CAAC,kBAAkB,CAAC;YACzB,EAAE,EAAE,CAAC,mBAAmB,CAAC;YACzB,EAAE,EAAE,CAAC,mBAAmB,CAAC;YACzB,MAAM,EAAE,CAAC,uBAAuB,CAAC;YACjC,KAAK,EAAE,CAAC,sBAAsB,CAAC;YAC/B,IAAI,EAAE,CAAC,qBAAqB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,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/index.spec.ts
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
import { expect } from "chai";
|
2
2
|
import core from ".";
|
3
|
+
import { scopes } from "./scopes";
|
3
4
|
import { TestInput } from "./test/input";
|
4
5
|
|
5
6
|
const configs = core(TestInput);
|
@@ -18,13 +19,29 @@ describe("Core", function () {
|
|
18
19
|
});
|
19
20
|
it("is non-empty", function () {
|
20
21
|
expect(configs)
|
21
|
-
.lengthOf.
|
22
|
+
.has.lengthOf.above(1);
|
23
|
+
// .not.empty;
|
24
|
+
// replace with not.empty after new rule
|
25
|
+
});
|
26
|
+
it(`has length >= common ignores + common settings + ${scopes.length} scopes = ${scopes.length + 2} [Actual: ${configs.length}`, function () {
|
27
|
+
expect(configs)
|
28
|
+
.lengthOf.at.least(scopes.length + 2);
|
29
|
+
});
|
30
|
+
it("has only config-like members", function () {
|
31
|
+
expect(configs)
|
32
|
+
.satisfies((configs: readonly unknown[]) => configs.every(config => typeof config === "object" && config !== null && "name" in config && typeof config.name === "string"));
|
22
33
|
});
|
23
34
|
});
|
24
|
-
describe("
|
25
|
-
it("
|
35
|
+
describe("configs", function () {
|
36
|
+
it("begin with common settings", function () {
|
37
|
+
expect(configs[0])
|
38
|
+
.has.property("name", "linted/*/");
|
39
|
+
expect(configs[0])
|
40
|
+
.has.property("linterOptions");
|
41
|
+
expect(configs[0])
|
42
|
+
.has.nested.property("languageOptions.sourceType");
|
26
43
|
expect(configs[0])
|
27
|
-
.
|
44
|
+
.has.nested.property("languageOptions.ecmaVersion");
|
28
45
|
});
|
29
46
|
});
|
30
47
|
});
|
package/src/index.ts
CHANGED
@@ -5,7 +5,7 @@ import { Factory } from "./factory";
|
|
5
5
|
export type * from "./interface";
|
6
6
|
export type * from "./scopes";
|
7
7
|
export default function ({
|
8
|
-
imports: {
|
8
|
+
imports: { parsers },
|
9
9
|
defaults,
|
10
10
|
extensions,
|
11
11
|
}: Input): Output {
|
@@ -14,7 +14,6 @@ export default function ({
|
|
14
14
|
|
15
15
|
return [
|
16
16
|
factory.common.settings,
|
17
|
-
{ name: `linted/*/plugins/`, plugins } as const,
|
18
17
|
factory.common.ignores,
|
19
18
|
...scopes.flatMap(scope => factory.scope(scope)),
|
20
19
|
] as const;
|
@@ -1,12 +1,7 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
Plugins extends string,
|
5
|
-
Parsers extends string,
|
6
|
-
> {
|
7
|
-
readonly plugins: Config<Plugins>["plugins"];
|
8
|
-
readonly parsers: Readonly<Record<
|
1
|
+
export type Imports<Parsers extends string> = Readonly<Record<
|
2
|
+
"parsers",
|
3
|
+
Readonly<Record<
|
9
4
|
Parsers,
|
10
5
|
unknown
|
11
|
-
|
12
|
-
|
6
|
+
>>
|
7
|
+
>>;
|
@@ -1,12 +1,9 @@
|
|
1
1
|
import type { Imports } from "./imports";
|
2
2
|
import type { Defaults, Extensions } from "./scopes";
|
3
|
-
import type {
|
3
|
+
import type { Parsers, Scopes } from "../../scopes";
|
4
4
|
|
5
5
|
export interface Input {
|
6
|
-
readonly imports: Imports<
|
7
|
-
Plugins,
|
8
|
-
Parsers
|
9
|
-
>;
|
6
|
+
readonly imports: Imports<Parsers>;
|
10
7
|
readonly defaults: Defaults<Scopes>;
|
11
8
|
readonly extensions: Extensions<Scopes>;
|
12
9
|
}
|
@@ -1,5 +1,4 @@
|
|
1
1
|
import type {
|
2
|
-
CommonPlugins,
|
3
2
|
CommonSettings,
|
4
3
|
CommonIgnores,
|
5
4
|
} from "./common";
|
@@ -7,11 +6,10 @@ import type {
|
|
7
6
|
ScopeSettings,
|
8
7
|
ScopeRules,
|
9
8
|
} from "./scope";
|
10
|
-
import type {
|
9
|
+
import type { Scopes } from "../../scopes";
|
11
10
|
|
12
11
|
export type Output = readonly [
|
13
12
|
CommonSettings,
|
14
|
-
CommonPlugins<Plugins>,
|
15
13
|
CommonIgnores,
|
16
14
|
...readonly (ScopeSettings<Scopes> | ScopeRules<Scopes>)[],
|
17
15
|
];
|
@@ -8,11 +8,5 @@ export type ScopeSettings<Scopes extends string> = PartialConfig<
|
|
8
8
|
| "language"
|
9
9
|
| "settings"
|
10
10
|
,
|
11
|
-
string,
|
12
11
|
{ readonly languageOptions: object }
|
13
12
|
>;
|
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">;
|
@@ -1,12 +1,8 @@
|
|
1
1
|
import type * as Rule from "./rule";
|
2
2
|
|
3
3
|
export type { Rule };
|
4
|
-
export interface Config
|
4
|
+
export interface Config {
|
5
5
|
readonly name: `linted/${string}/`;
|
6
|
-
readonly plugins: Readonly<Record<
|
7
|
-
Plugins,
|
8
|
-
{ readonly configs: unknown }
|
9
|
-
>>;
|
10
6
|
readonly files: readonly string[];
|
11
7
|
readonly ignores: readonly string[];
|
12
8
|
readonly rules: Rule.Bag;
|
@@ -50,11 +46,10 @@ export type PartialConfig<
|
|
50
46
|
| "name"
|
51
47
|
| keyof Rest
|
52
48
|
>,
|
53
|
-
Plugins extends string = string,
|
54
49
|
Rest extends object = object,
|
55
50
|
> = (
|
56
51
|
& Rest
|
57
|
-
& Pick<Config
|
52
|
+
& Pick<Config, Picks>
|
58
53
|
& { readonly name: Name }
|
59
54
|
& Readonly<Partial<Record<
|
60
55
|
Exclude<
|
package/src/test/input.ts
CHANGED
@@ -2,20 +2,10 @@ import type Core from "..";
|
|
2
2
|
|
3
3
|
const
|
4
4
|
ERROR = "error",
|
5
|
-
OFF = "off"
|
6
|
-
Plugin = { configs: null } as const;
|
5
|
+
OFF = "off";
|
7
6
|
|
8
7
|
export const TestInput: Parameters<typeof Core>[0] = {
|
9
8
|
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
9
|
parsers: {
|
20
10
|
ts: "parsers.ts",
|
21
11
|
svelte: "parsers.svelte",
|
@@ -1 +0,0 @@
|
|
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 +0,0 @@
|
|
1
|
-
{"version":3,"file":"plugins.js","sourceRoot":"","sources":["../../../../src/interface/output/common/plugins.ts"],"names":[],"mappings":""}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"plugins.d.ts","sourceRoot":"","sources":["../../../src/scopes/imports/plugins.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,OAAO,GAAG,CAClB,YAAY,GACZ,oBAAoB,GACpB,QAAQ,GACR,OAAO,GACP,cAAc,GACd,OAAO,GACP,KAAK,CACR,CAAC"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"plugins.js","sourceRoot":"","sources":["../../../src/scopes/imports/plugins.ts"],"names":[],"mappings":""}
|