@eslinted/core 13.4.0-rc.0 → 13.4.0-rc.2
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/factory/index.d.ts +11 -10
- package/dist/factory/index.d.ts.map +1 -1
- package/dist/factory/index.js +14 -8
- package/dist/factory/index.js.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/interface/output/common/settings.d.ts +1 -1
- package/dist/interface/output/common/settings.d.ts.map +1 -1
- package/dist/interface/output/index.d.ts +1 -1
- 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/scopes/tree.d.ts +1 -10
- package/dist/scopes/tree.d.ts.map +1 -1
- package/dist/scopes/tree.js +6 -10
- package/dist/scopes/tree.js.map +1 -1
- package/package.json +1 -1
- package/src/factory/index.ts +20 -7
- package/src/index.ts +3 -3
- package/src/interface/output/common/settings.ts +1 -1
- package/src/interface/output/index.ts +1 -1
- package/src/interface/output/scope/settings.ts +1 -1
- package/src/scopes/tree.ts +6 -10
package/dist/factory/index.d.ts
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
import { ScopeSettings } from "./settings.js";
|
2
2
|
import type { Input } from "../interface/index.js";
|
3
|
+
import type { tree as Tree } from "../scopes/index.js";
|
3
4
|
export declare class Factory {
|
4
5
|
readonly parsers: Input["imports"]["parsers"];
|
5
6
|
readonly common: {
|
6
7
|
readonly settings: {
|
7
|
-
readonly name: "linted
|
8
|
+
readonly name: "linted/*";
|
8
9
|
readonly linterOptions: {
|
9
10
|
readonly noInlineConfig: boolean;
|
10
11
|
readonly reportUnusedDisableDirectives: "error" | "warn" | "off";
|
@@ -20,25 +21,25 @@ export declare class Factory {
|
|
20
21
|
};
|
21
22
|
};
|
22
23
|
readonly scopes: {
|
23
|
-
readonly files: Readonly<Record<"*" | "svelte" | "mocha" | "jsonc" | "yml" | "ts" | "html" | "
|
24
|
-
readonly ignores: Readonly<Record<"*" | "svelte" | "mocha" | "jsonc" | "yml" | "ts" | "html" | "
|
25
|
-
readonly rules: Readonly<Record<"svelte" | "mocha" | "jsonc" | "yml" | "ts" | "html" | "
|
24
|
+
readonly files: Readonly<Record<"*" | "svelte" | "mocha" | "jsonc" | "yml" | "ts" | "html" | "json" | "js", string[]>>;
|
25
|
+
readonly ignores: Readonly<Record<"*" | "svelte" | "mocha" | "jsonc" | "yml" | "ts" | "html" | "json" | "js", string[]>>;
|
26
|
+
readonly rules: Readonly<Record<"svelte" | "mocha" | "jsonc" | "yml" | "ts" | "html" | "json" | "js", import("../interface/shared/config/rule/index.js").NamedBag[]>>;
|
26
27
|
};
|
27
|
-
constructor(parsers: Input["imports"]["parsers"], { settings: defaultSettings, files: defaultFiles, ignores: defaultIgnores, rules: defaultRules, }: Input["defaults"], { "*": commonExtension, ...scopeExtensions }?: Input["extensions"]);
|
28
|
+
constructor(tree: typeof Tree, parsers: Input["imports"]["parsers"], { settings: defaultSettings, files: defaultFiles, ignores: defaultIgnores, rules: defaultRules, }: Input["defaults"], { "*": commonExtension, ...scopeExtensions }?: Input["extensions"]);
|
28
29
|
scope<S extends keyof typeof ScopeSettings>(scope: S): readonly [
|
29
30
|
] | ({
|
30
31
|
readonly name: `linted/${S}/${string}`;
|
31
|
-
readonly files: Readonly<Record<"*" | "svelte" | "mocha" | "jsonc" | "yml" | "ts" | "html" | "
|
32
|
-
readonly ignores: Readonly<Record<"*" | "svelte" | "mocha" | "jsonc" | "yml" | "ts" | "html" | "
|
32
|
+
readonly files: Readonly<Record<"*" | "svelte" | "mocha" | "jsonc" | "yml" | "ts" | "html" | "json" | "js", string[]>>[S];
|
33
|
+
readonly ignores: Readonly<Record<"*" | "svelte" | "mocha" | "jsonc" | "yml" | "ts" | "html" | "json" | "js", string[]>>[S];
|
33
34
|
readonly rules: Readonly<Record<string, import("../interface/shared/config/rule/index.js").State | readonly [
|
34
35
|
import("../interface/shared/config/rule/index.js").State,
|
35
36
|
...unknown[]
|
36
37
|
]>>;
|
37
38
|
} | {
|
38
39
|
readonly processor?: "svelte/svelte";
|
39
|
-
readonly name: `linted/${S}
|
40
|
-
readonly files: Readonly<Record<"*" | "svelte" | "mocha" | "jsonc" | "yml" | "ts" | "html" | "
|
41
|
-
readonly ignores: Readonly<Record<"*" | "svelte" | "mocha" | "jsonc" | "yml" | "ts" | "html" | "
|
40
|
+
readonly name: `linted/${S}`;
|
41
|
+
readonly files: Readonly<Record<"*" | "svelte" | "mocha" | "jsonc" | "yml" | "ts" | "html" | "json" | "js", string[]>>[S];
|
42
|
+
readonly ignores: Readonly<Record<"*" | "svelte" | "mocha" | "jsonc" | "yml" | "ts" | "html" | "json" | "js", string[]>>[S];
|
42
43
|
readonly languageOptions: {
|
43
44
|
parser: unknown;
|
44
45
|
readonly parserOptions?: {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/factory/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/factory/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,KAAK,EAAE,IAAI,IAAI,IAAI,EAAE,MAAM,WAAW,CAAC;AAE9C,qBAAa,OAAO;aAMA,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC;IALtD,SAAgB,MAAM;;;;;;;;;;;;;;;;MAAC;IACvB,SAAgB,MAAM;;;;MAAC;gBAGrB,IAAI,EAAE,OAAO,IAAI,EACD,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,EACpD,EACE,QAAQ,EAAE,eAAe,EACzB,KAAK,EAAE,YAAY,EACnB,OAAO,EAAE,cAAc,EACvB,KAAK,EAAE,YAAY,GACpB,EAAE,KAAK,CAAC,UAAU,CAAC,EACpB,EAAE,GAAG,EAAE,eAAoB,EAAE,GAAG,eAAe,EAAE,GAAE,KAAK,CAAC,YAAY,CAAe;IA2D/E,KAAK,CAAC,CAAC,SAAS,MAAM,OAAO,aAAa,EAAE,KAAK,EAAE,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiD5D"}
|
package/dist/factory/index.js
CHANGED
@@ -3,12 +3,12 @@ export class Factory {
|
|
3
3
|
parsers;
|
4
4
|
common;
|
5
5
|
scopes;
|
6
|
-
constructor(parsers, { settings: defaultSettings, files: defaultFiles, ignores: defaultIgnores, rules: defaultRules, }, { "*": commonExtension = {}, ...scopeExtensions } = {}) {
|
6
|
+
constructor(tree, parsers, { settings: defaultSettings, files: defaultFiles, ignores: defaultIgnores, rules: defaultRules, }, { "*": commonExtension = {}, ...scopeExtensions } = {}) {
|
7
7
|
this.parsers = parsers;
|
8
8
|
const { noInlineConfig = defaultSettings.noInlineConfig, reportUnusedDisableDirectives = defaultSettings.reportUnusedDisableDirectives, sourceType = defaultSettings.sourceType, ecmaVersion = defaultSettings.ecmaVersion, ignores = [], override = false, } = commonExtension;
|
9
9
|
this.common = {
|
10
10
|
settings: {
|
11
|
-
name: "linted
|
11
|
+
name: "linted/*",
|
12
12
|
linterOptions: { noInlineConfig, reportUnusedDisableDirectives },
|
13
13
|
languageOptions: { sourceType, ecmaVersion },
|
14
14
|
},
|
@@ -25,12 +25,18 @@ export class Factory {
|
|
25
25
|
ignores: defaultIgnores,
|
26
26
|
rules: defaultRules,
|
27
27
|
};
|
28
|
-
for (const
|
29
|
-
const { [
|
30
|
-
this.scopes.files[
|
31
|
-
this.scopes.ignores[
|
28
|
+
for (const scope in scopeExtensions) {
|
29
|
+
const { [scope]: { files: moreFiles = [], ignores: moreIgnores = [], rules: moreRules = null, } = {}, } = scopeExtensions;
|
30
|
+
this.scopes.files[scope].push(...moreFiles);
|
31
|
+
this.scopes.ignores[scope].push(...moreIgnores);
|
32
32
|
if (moreRules !== null)
|
33
|
-
this.scopes.rules[
|
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
|
+
});
|
34
40
|
}
|
35
41
|
}
|
36
42
|
scope(scope) {
|
@@ -56,7 +62,7 @@ export class Factory {
|
|
56
62
|
? []
|
57
63
|
: [
|
58
64
|
{
|
59
|
-
name: `linted/${scope}
|
65
|
+
name: `linted/${scope}`,
|
60
66
|
files,
|
61
67
|
ignores,
|
62
68
|
languageOptions: loadedLanguageOptions,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/factory/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/factory/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAI3C,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,EAA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BACjC,CAAC,CAAC;oBACE,aAAa,EAAE;wBACb,GAAG,aAAa,CAAC,aAAa;wBAC9B,GAAG,QAAQ,IAAI,aAAa,CAAC,aAAa;4BACxC,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,aAAa,CAAC,MAAM,CAAC,EAAW;4BACvE,CAAC,CAAC,EAAW;qBACP;iBACF;gBACZ,CAAC,CAAC,EAAW;YACf,GAAG,QAAQ,IAAI,eAAe;gBAC5B,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,MAAM,CAAC,EAAW;gBAC3D,CAAC,CAAC,EAAW;SACP,CAAC;QAEX,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC;YACrB,CAAC,CAAC,EAAW;YACb,CAAC,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC;gBAClB,CAAC,CAAC,EAAW;gBACb,CAAC,CAAC;oBACE;wBACE,IAAI,EAAE,UAAU,KAAK,EAAE;wBACvB,KAAK;wBACL,OAAO;wBACP,eAAe,EAAE,qBAAqB;wBACtC,GAAG,QAAQ,CAAC,SAAS;wBACrB,GAAG,QAAQ,CAAC,QAAQ;qBACZ;oBACV,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;wBACjC,IAAI,EAAE,UAAU,EAAE,EAAE;wBACpB,KAAK;wBACL,OAAO;wBACP,KAAK;qBACI,CAAA,CAAC;iBACb,CAAC;IACV,CAAC;CACF"}
|
package/dist/index.js
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
import { scopes } from "./scopes/index.js";
|
1
|
+
import { scopes, tree } from "./scopes/index.js";
|
2
2
|
import { Factory } from "./factory/index.js";
|
3
3
|
export default function ({ imports: { plugins, parsers }, defaults, extensions, }) {
|
4
4
|
try {
|
5
|
-
const factory = new Factory(parsers, defaults, extensions);
|
5
|
+
const factory = new Factory(tree, parsers, defaults, extensions);
|
6
6
|
return [
|
7
|
-
{ name: `linted/*/plugins`, plugins },
|
8
7
|
factory.common.settings,
|
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,MAAM,UAAU,CAAC;
|
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,kBAAkB,EAAE,OAAO,EAAW;YAC9C,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"}
|
@@ -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;IAAE,QAAQ,CAAC,IAAI,EAAE,
|
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;IAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAA;CAAE,EAC3B,eAAe,GACf,iBAAiB,CACpB,CAAC"}
|
@@ -2,8 +2,8 @@ import type { CommonPlugins, CommonSettings, CommonIgnores } from "./common/inde
|
|
2
2
|
import type { ScopeSettings, ScopeRules } from "./scope/index.js";
|
3
3
|
import type { Plugins, Scopes } from "../../scopes/index.js";
|
4
4
|
export type Output = readonly [
|
5
|
-
CommonPlugins<Plugins>,
|
6
5
|
CommonSettings,
|
6
|
+
CommonPlugins<Plugins>,
|
7
7
|
CommonIgnores,
|
8
8
|
...readonly (ScopeSettings<Scopes> | ScopeRules<Scopes>)[]
|
9
9
|
];
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/interface/output/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,cAAc,EACd,aAAa,EACd,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EACV,aAAa,EACb,UAAU,EACX,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEpD,MAAM,MAAM,MAAM,GAAG,SAAS;IAC5B,aAAa,CAAC,OAAO,CAAC;IACtB,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/interface/output/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,cAAc,EACd,aAAa,EACd,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EACV,aAAa,EACb,UAAU,EACX,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEpD,MAAM,MAAM,MAAM,GAAG,SAAS;IAC5B,cAAc;IACd,aAAa,CAAC,OAAO,CAAC;IACtB,aAAa;IACb,GAAG,SAAS,CAAC,aAAa,CAAC,MAAM,CAAC,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,EAAE;CAC3D,CAAC"}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import type { Config } from "../../shared/index.js";
|
2
2
|
export type ScopeSettings<Scopes extends string> = {
|
3
|
-
readonly name: `linted/${Scopes}
|
3
|
+
readonly name: `linted/${Scopes}`;
|
4
4
|
readonly languageOptions: object;
|
5
5
|
} & Pick<Config, "files" | "ignores" | "processor" | "language" | "settings">;
|
6
6
|
//# 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,MAAM,EAAE,MAAM,cAAc,CAAC;AAE3C,MAAM,MAAM,aAAa,CAAC,MAAM,SAAS,MAAM,IAAI;IACjD,QAAQ,CAAC,IAAI,EAAE,UAAU,MAAM,
|
1
|
+
{"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../../../src/interface/output/scope/settings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAE3C,MAAM,MAAM,aAAa,CAAC,MAAM,SAAS,MAAM,IAAI;IACjD,QAAQ,CAAC,IAAI,EAAE,UAAU,MAAM,EAAE,CAAC;IAClC,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;CAClC,GAAG,IAAI,CAAC,MAAM,EAAE,OAAO,GAAG,SAAS,GAAG,WAAW,GAAG,UAAU,GAAG,UAAU,CAAC,CAAC"}
|
package/dist/scopes/tree.d.ts
CHANGED
@@ -1,11 +1,2 @@
|
|
1
|
-
export declare const tree:
|
2
|
-
readonly js: readonly [];
|
3
|
-
readonly ts: readonly ["js"];
|
4
|
-
readonly svelte: readonly ["ts"];
|
5
|
-
readonly mocha: readonly ["ts"];
|
6
|
-
readonly html: readonly [];
|
7
|
-
readonly json: readonly [];
|
8
|
-
readonly jsonc: readonly ["json"];
|
9
|
-
readonly yml: readonly [];
|
10
|
-
};
|
1
|
+
export declare const tree: readonly [readonly ["jsonc", readonly ["json"]], readonly ["mocha", readonly ["ts"]], readonly ["svelte", readonly ["ts"]], readonly ["ts", readonly ["js"]]];
|
11
2
|
//# sourceMappingURL=tree.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"tree.d.ts","sourceRoot":"","sources":["../../src/scopes/tree.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,IAAI
|
1
|
+
{"version":3,"file":"tree.d.ts","sourceRoot":"","sources":["../../src/scopes/tree.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,IAAI,+JAKP,CAAC"}
|
package/dist/scopes/tree.js
CHANGED
@@ -1,11 +1,7 @@
|
|
1
|
-
export const tree =
|
2
|
-
|
3
|
-
|
4
|
-
svelte
|
5
|
-
|
6
|
-
|
7
|
-
json: [],
|
8
|
-
jsonc: ["json"],
|
9
|
-
yml: [],
|
10
|
-
};
|
1
|
+
export const tree = [
|
2
|
+
["jsonc", ["json"]],
|
3
|
+
["mocha", ["ts"]],
|
4
|
+
["svelte", ["ts"]],
|
5
|
+
["ts", ["js"]],
|
6
|
+
];
|
11
7
|
//# sourceMappingURL=tree.js.map
|
package/dist/scopes/tree.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"tree.js","sourceRoot":"","sources":["../../src/scopes/tree.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,IAAI,GAAG;IAClB,
|
1
|
+
{"version":3,"file":"tree.js","sourceRoot":"","sources":["../../src/scopes/tree.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,IAAI,GAAG;IAClB,CAAC,OAAO,EAAE,CAAC,MAAM,CAAU,CAAU;IACrC,CAAC,OAAO,EAAE,CAAC,IAAI,CAAU,CAAU;IACnC,CAAC,QAAQ,EAAE,CAAC,IAAI,CAAU,CAAU;IACpC,CAAC,IAAI,EAAE,CAAC,IAAI,CAAU,CAAU;CACxB,CAAC"}
|
package/package.json
CHANGED
package/src/factory/index.ts
CHANGED
@@ -1,11 +1,13 @@
|
|
1
1
|
import { ScopeSettings } from "./settings";
|
2
2
|
import type { Input } from "../interface";
|
3
|
+
import type { tree as Tree } from "../scopes";
|
3
4
|
|
4
5
|
export class Factory {
|
5
6
|
public readonly common;
|
6
7
|
public readonly scopes;
|
7
8
|
|
8
9
|
constructor(
|
10
|
+
tree: typeof Tree,
|
9
11
|
public readonly parsers: Input["imports"]["parsers"],
|
10
12
|
{
|
11
13
|
settings: defaultSettings,
|
@@ -26,7 +28,7 @@ export class Factory {
|
|
26
28
|
|
27
29
|
this.common = {
|
28
30
|
settings: {
|
29
|
-
name: "linted
|
31
|
+
name: "linted/*",
|
30
32
|
linterOptions: { noInlineConfig, reportUnusedDisableDirectives } as const,
|
31
33
|
languageOptions: { sourceType, ecmaVersion } as const,
|
32
34
|
} as const,
|
@@ -44,20 +46,31 @@ export class Factory {
|
|
44
46
|
rules: defaultRules,
|
45
47
|
} as const;
|
46
48
|
|
47
|
-
for (const
|
49
|
+
for (const scope in scopeExtensions) {
|
48
50
|
const {
|
49
|
-
[
|
51
|
+
[scope as keyof typeof scopeExtensions]: {
|
50
52
|
files: moreFiles = [],
|
51
53
|
ignores: moreIgnores = [],
|
52
54
|
rules: moreRules = null,
|
53
55
|
} = {} as const,
|
54
56
|
} = scopeExtensions;
|
55
57
|
|
56
|
-
this.scopes.files[
|
57
|
-
this.scopes.ignores[
|
58
|
+
this.scopes.files[scope as keyof typeof scopeExtensions].push(...moreFiles);
|
59
|
+
this.scopes.ignores[scope as keyof typeof scopeExtensions].push(...moreIgnores);
|
58
60
|
|
59
61
|
if (moreRules !== null)
|
60
|
-
this.scopes.rules[
|
62
|
+
this.scopes.rules[scope as keyof typeof scopeExtensions].push([`${scope}:override`, moreRules]);
|
63
|
+
|
64
|
+
tree.forEach(([scope, parents]) => {
|
65
|
+
parents.forEach(parent => {
|
66
|
+
this.scopes.files[parent].push(
|
67
|
+
...this.scopes.files[scope],
|
68
|
+
);
|
69
|
+
this.scopes.ignores[parent].push(
|
70
|
+
...this.scopes.ignores[scope],
|
71
|
+
);
|
72
|
+
});
|
73
|
+
});
|
61
74
|
}
|
62
75
|
}
|
63
76
|
|
@@ -95,7 +108,7 @@ export class Factory {
|
|
95
108
|
? [] as const
|
96
109
|
: [
|
97
110
|
{
|
98
|
-
name: `linted/${scope}
|
111
|
+
name: `linted/${scope}`,
|
99
112
|
files,
|
100
113
|
ignores,
|
101
114
|
languageOptions: loadedLanguageOptions,
|
package/src/index.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import type { Input, Output } from "./interface";
|
2
|
-
import { scopes } from "./scopes";
|
2
|
+
import { scopes, tree } from "./scopes";
|
3
3
|
import { Factory } from "./factory";
|
4
4
|
|
5
5
|
export type * from "./interface";
|
@@ -10,11 +10,11 @@ export default function ({
|
|
10
10
|
extensions,
|
11
11
|
}: Input): Output {
|
12
12
|
try {
|
13
|
-
const factory = new Factory(parsers, defaults, extensions);
|
13
|
+
const factory = new Factory(tree, parsers, defaults, extensions);
|
14
14
|
|
15
15
|
return [
|
16
|
-
{ name: `linted/*/plugins`, plugins } as const,
|
17
16
|
factory.common.settings,
|
17
|
+
{ name: `linted/*/plugins`, plugins } as const,
|
18
18
|
factory.common.ignores,
|
19
19
|
...scopes.flatMap(scope => factory.scope(scope)),
|
20
20
|
] as const;
|
@@ -10,8 +10,8 @@ import type {
|
|
10
10
|
import type { Plugins, Scopes } from "../../scopes";
|
11
11
|
|
12
12
|
export type Output = readonly [
|
13
|
-
CommonPlugins<Plugins>,
|
14
13
|
CommonSettings,
|
14
|
+
CommonPlugins<Plugins>,
|
15
15
|
CommonIgnores,
|
16
16
|
...readonly (ScopeSettings<Scopes> | ScopeRules<Scopes>)[],
|
17
17
|
];
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import type { Config } from "../../shared";
|
2
2
|
|
3
3
|
export type ScopeSettings<Scopes extends string> = {
|
4
|
-
readonly name: `linted/${Scopes}
|
4
|
+
readonly name: `linted/${Scopes}`;
|
5
5
|
readonly languageOptions: object;
|
6
6
|
} & Pick<Config, "files" | "ignores" | "processor" | "language" | "settings">;
|
package/src/scopes/tree.ts
CHANGED
@@ -1,10 +1,6 @@
|
|
1
|
-
export const tree =
|
2
|
-
|
3
|
-
|
4
|
-
svelte
|
5
|
-
|
6
|
-
|
7
|
-
json: [],
|
8
|
-
jsonc: ["json"],
|
9
|
-
yml: [],
|
10
|
-
} as const;
|
1
|
+
export const tree = [
|
2
|
+
["jsonc", ["json"] as const] as const,
|
3
|
+
["mocha", ["ts"] as const] as const,
|
4
|
+
["svelte", ["ts"] as const] as const,
|
5
|
+
["ts", ["js"] as const] as const,
|
6
|
+
] as const;
|