@eslinted/core 12.0.0-rc.1 → 12.0.0-rc.3
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/factory/files.js +2 -2
- package/dist/factory/files.js.map +1 -1
- package/dist/factory/ignores.d.ts +7 -0
- package/dist/factory/ignores.d.ts.map +1 -0
- package/dist/factory/ignores.js +17 -0
- package/dist/factory/ignores.js.map +1 -0
- package/dist/factory/index.d.ts +7 -4
- package/dist/factory/index.d.ts.map +1 -1
- package/dist/factory/index.js +9 -5
- package/dist/factory/index.js.map +1 -1
- package/dist/factory/options/option/index.d.ts +3 -2
- package/dist/factory/options/option/index.d.ts.map +1 -1
- package/dist/factory/options/option/index.js +7 -5
- package/dist/factory/options/option/index.js.map +1 -1
- package/dist/factory/{rulesets → rules}/index.d.ts +2 -2
- package/dist/factory/rules/index.d.ts.map +1 -0
- package/dist/factory/{rulesets → rules}/index.js +2 -2
- package/dist/factory/rules/index.js.map +1 -0
- package/dist/factory/{rulesets → rules}/ruleset.d.ts +1 -1
- package/dist/factory/rules/ruleset.d.ts.map +1 -0
- package/dist/factory/{rulesets → rules}/ruleset.js +2 -2
- package/dist/factory/rules/ruleset.js.map +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/dist/interface/input/global/index.d.ts +1 -1
- package/dist/interface/input/scoped/ignores/defaults.d.ts +3 -0
- package/dist/interface/input/scoped/ignores/defaults.d.ts.map +1 -0
- package/dist/interface/input/scoped/ignores/defaults.js +2 -0
- package/dist/interface/input/scoped/ignores/defaults.js.map +1 -0
- package/dist/interface/input/scoped/ignores/extend.d.ts +3 -0
- package/dist/interface/input/scoped/ignores/extend.d.ts.map +1 -0
- package/dist/interface/input/scoped/ignores/extend.js +2 -0
- package/dist/interface/input/scoped/ignores/extend.js.map +1 -0
- package/dist/interface/input/scoped/ignores/index.d.ts +8 -0
- package/dist/interface/input/scoped/ignores/index.d.ts.map +1 -0
- package/dist/interface/input/scoped/ignores/index.js +2 -0
- package/dist/interface/input/scoped/ignores/index.js.map +1 -0
- package/dist/interface/input/scoped/index.d.ts +2 -0
- package/dist/interface/input/scoped/index.d.ts.map +1 -1
- package/dist/interface/input/scoped/rules/overrides.d.ts +2 -3
- package/dist/interface/input/scoped/rules/overrides.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/factory/files.ts +3 -3
- package/src/factory/ignores.ts +26 -0
- package/src/factory/index.ts +10 -5
- package/src/factory/options/option/index.ts +7 -5
- package/src/factory/{rulesets → rules}/index.ts +2 -2
- package/src/factory/{rulesets → rules}/ruleset.ts +3 -3
- package/src/index.ts +12 -7
- package/src/interface/input/global/index.ts +1 -1
- package/src/interface/input/scoped/ignores/defaults.ts +6 -0
- package/src/interface/input/scoped/ignores/extend.ts +5 -0
- package/src/interface/input/scoped/ignores/index.ts +9 -0
- package/src/interface/input/scoped/index.ts +2 -0
- package/src/interface/input/scoped/rules/overrides.ts +7 -5
- package/dist/factory/rulesets/index.d.ts.map +0 -1
- package/dist/factory/rulesets/index.js.map +0 -1
- package/dist/factory/rulesets/ruleset.d.ts.map +0 -1
- package/dist/factory/rulesets/ruleset.js.map +0 -1
package/dist/factory/files.js
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
export class Files {
|
2
2
|
_files = new Map();
|
3
3
|
constructor(files) {
|
4
|
-
const { files:
|
4
|
+
const { files: defaults, includes } = files, scopes = Object.keys(defaults);
|
5
5
|
for (const scope of scopes)
|
6
6
|
this._files.set(scope, [
|
7
|
-
...
|
7
|
+
...defaults[scope],
|
8
8
|
...scope in includes ? includes[scope] : [],
|
9
9
|
]);
|
10
10
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"files.js","sourceRoot":"","sources":["../../src/factory/files.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,KAAK;IACC,MAAM,GAAG,IAAI,GAAG,EAAoB,CAAC;IAEtD,YAAY,KAAqB;QAC/B,MAAM,EAAE,KAAK,EAAE,
|
1
|
+
{"version":3,"file":"files.js","sourceRoot":"","sources":["../../src/factory/files.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,KAAK;IACC,MAAM,GAAG,IAAI,GAAG,EAAoB,CAAC;IAEtD,YAAY,KAAqB;QAC/B,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,KAAK,EAC3C,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,CAA8B,CAAC;QAE5D,KAAK,MAAM,KAAK,IAAI,MAAM;YACxB,IAAI,CAAC,MAAM,CAAC,GAAG,CACb,KAAK,EACL;gBACE,GAAG,QAAQ,CAAC,KAAK,CAAC;gBAClB,GAAG,KAAK,IAAI,QAAQ,CAAC,CAAC,CAAE,QAAQ,CAAC,KAAK,CAAc,CAAC,CAAC,CAAC,EAAE;aAC1D,CACF,CAAC;IACN,CAAC;IAEM,KAAK,CAAC,KAAa;QACxB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC;YACzB,MAAM,IAAI,cAAc,CAAC,8BAA8B,KAAK,EAAE,CAAC,CAAC;QAElE,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAa,CAAC;IAC5C,CAAC;CACF"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ignores.d.ts","sourceRoot":"","sources":["../../src/factory/ignores.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,GAAG,CAAC;AAE/B,qBAAa,OAAO;IAClB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA+B;gBAE5C,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC;IAc9B,OAAO,CAAC,KAAK,EAAE,MAAM,GAIS,MAAM,EAAE;CAE9C"}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
export class Ignores {
|
2
|
+
_ignores = new Map();
|
3
|
+
constructor(ignores) {
|
4
|
+
const { ignores: defaults, extend } = ignores, scopes = Object.keys(defaults);
|
5
|
+
for (const scope of scopes)
|
6
|
+
this._ignores.set(scope, [
|
7
|
+
...defaults[scope],
|
8
|
+
...scope in extend ? extend[scope] : [],
|
9
|
+
]);
|
10
|
+
}
|
11
|
+
ignores(scope) {
|
12
|
+
if (!this._ignores.has(scope))
|
13
|
+
throw new ReferenceError(`Files not found for scope: ${scope}`);
|
14
|
+
return this._ignores.get(scope);
|
15
|
+
}
|
16
|
+
}
|
17
|
+
//# sourceMappingURL=ignores.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ignores.js","sourceRoot":"","sources":["../../src/factory/ignores.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,OAAO;IACD,QAAQ,GAAG,IAAI,GAAG,EAAoB,CAAC;IAExD,YAAY,OAAyB;QACnC,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,EAC7C,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,CAA8B,CAAC;QAE5D,KAAK,MAAM,KAAK,IAAI,MAAM;YACxB,IAAI,CAAC,QAAQ,CAAC,GAAG,CACf,KAAK,EACL;gBACE,GAAG,QAAQ,CAAC,KAAK,CAAC;gBAClB,GAAG,KAAK,IAAI,MAAM,CAAC,CAAC,CAAE,MAAM,CAAC,KAAK,CAAc,CAAC,CAAC,CAAC,EAAE;aACtD,CACF,CAAC;IACN,CAAC;IAEM,OAAO,CAAC,KAAa;QAC1B,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC;YAC3B,MAAM,IAAI,cAAc,CAAC,8BAA8B,KAAK,EAAE,CAAC,CAAC;QAElE,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAa,CAAC;IAC9C,CAAC;CACF"}
|
package/dist/factory/index.d.ts
CHANGED
@@ -1,15 +1,18 @@
|
|
1
1
|
export type { Scope, Input, ScopedConfig, RuleEntry, RuleRecord, } from "../index.js";
|
2
2
|
import { Files } from "./files.js";
|
3
|
-
import {
|
3
|
+
import { Ignores } from "./ignores.js";
|
4
|
+
import { Rules } from "./rules/index.js";
|
4
5
|
import Options from "./options/index.js";
|
5
6
|
export { Options };
|
6
7
|
export declare class Factory {
|
7
8
|
readonly files: Files;
|
8
|
-
readonly
|
9
|
-
|
9
|
+
readonly ignores: Ignores;
|
10
|
+
readonly rules: Rules;
|
11
|
+
constructor(files: ConstructorParameters<typeof Files>[0], ignores: ConstructorParameters<typeof Ignores>[0], rules: ConstructorParameters<typeof Rules>[0]);
|
10
12
|
produce(scope: string): readonly [
|
11
13
|
string[],
|
12
|
-
|
14
|
+
string[],
|
15
|
+
import("./rules/ruleset.js").Ruleset
|
13
16
|
];
|
14
17
|
}
|
15
18
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/factory/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,KAAK,EACL,KAAK,EACL,YAAY,EACZ,SAAS,EACT,UAAU,GACX,MAAM,IAAI,CAAC;AAEZ,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/factory/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,KAAK,EACL,KAAK,EACL,YAAY,EACZ,SAAS,EACT,UAAU,GACX,MAAM,IAAI,CAAC;AAEZ,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,OAAO,MAAM,WAAW,CAAC;AAEhC,OAAO,EAAE,OAAO,EAAE,CAAC;AACnB,qBAAa,OAAO;IAClB,SAAgB,KAAK,EAAE,KAAK,CAAC;IAC7B,SAAgB,OAAO,EAAE,OAAO,CAAC;IACjC,SAAgB,KAAK,EAAE,KAAK,CAAC;gBAG3B,KAAK,EAAE,qBAAqB,CAAC,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,EAC7C,OAAO,EAAE,qBAAqB,CAAC,OAAO,OAAO,CAAC,CAAC,CAAC,CAAC,EACjD,KAAK,EAAE,qBAAqB,CAAC,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC;IAOxC,OAAO,CAAC,KAAK,EAAE,MAAM;CAO7B"}
|
package/dist/factory/index.js
CHANGED
@@ -1,18 +1,22 @@
|
|
1
1
|
import { Files } from "./files.js";
|
2
|
-
import {
|
2
|
+
import { Ignores } from "./ignores.js";
|
3
|
+
import { Rules } from "./rules/index.js";
|
3
4
|
import Options from "./options/index.js";
|
4
5
|
export { Options };
|
5
6
|
export class Factory {
|
6
7
|
files;
|
7
|
-
|
8
|
-
|
8
|
+
ignores;
|
9
|
+
rules;
|
10
|
+
constructor(files, ignores, rules) {
|
9
11
|
this.files = new Files(files);
|
10
|
-
this.
|
12
|
+
this.ignores = new Ignores(ignores);
|
13
|
+
this.rules = new Rules(rules);
|
11
14
|
}
|
12
15
|
produce(scope) {
|
13
16
|
return [
|
14
17
|
this.files.files(scope),
|
15
|
-
this.
|
18
|
+
this.ignores.ignores(scope),
|
19
|
+
this.rules.rules(scope),
|
16
20
|
];
|
17
21
|
}
|
18
22
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/factory/index.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/factory/index.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,OAAO,MAAM,WAAW,CAAC;AAEhC,OAAO,EAAE,OAAO,EAAE,CAAC;AACnB,MAAM,OAAO,OAAO;IACF,KAAK,CAAQ;IACb,OAAO,CAAU;IACjB,KAAK,CAAQ;IAE7B,YACE,KAA6C,EAC7C,OAAiD,EACjD,KAA6C;QAE7C,IAAI,CAAC,KAAK,GAAG,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC;QAC9B,IAAI,CAAC,OAAO,GAAG,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;QACpC,IAAI,CAAC,KAAK,GAAG,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC;IAChC,CAAC;IAEM,OAAO,CAAC,KAAa;QAC1B,OAAO;YACL,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC;YACvB,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC;YAC3B,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC;SACf,CAAC;IACb,CAAC;CACF"}
|
@@ -1,14 +1,15 @@
|
|
1
1
|
import type { Scope, ScopedConfig } from "../index.js";
|
2
2
|
import type { LanguageOptions, Globals } from "./template/index.js";
|
3
|
-
import type { Ruleset } from "../../
|
3
|
+
import type { Ruleset } from "../../rules/ruleset.js";
|
4
4
|
export default abstract class Option<S extends Scope, ParserOptions extends object | boolean = false, ParserCount extends 0 | 1 | 2 = 0, Global extends Globals = never, Processor extends object = never, Language extends object = never> {
|
5
5
|
readonly parser: Tuple<ParserCount, unknown>;
|
6
6
|
readonly files: string[];
|
7
|
+
readonly ignores: string[];
|
7
8
|
readonly ruleset: Ruleset;
|
8
9
|
abstract readonly scope: literalful<S>;
|
9
10
|
abstract readonly processor: Interface<Processor> extends never ? object : Interface<Processor> extends Readonly<Record<"processor", string>> ? Interface<Processor> : object;
|
10
11
|
abstract readonly language: Interface<Language> extends never ? object : Interface<Language> extends Readonly<Record<"language", string>> ? Interface<Language> : object;
|
11
|
-
constructor(parser: Tuple<ParserCount, unknown>, files: string[], ruleset: Ruleset);
|
12
|
+
constructor(parser: Tuple<ParserCount, unknown>, files: string[], ignores: string[], ruleset: Ruleset);
|
12
13
|
get configs(): ScopedConfig[];
|
13
14
|
private get option();
|
14
15
|
protected abstract get languageOptions(): LanguageOptions<ParserOptions, Global>;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/factory/options/option/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,KAAK,EACL,YAAY,EACb,MAAM,IAAI,CAAC;AACZ,OAAO,KAAK,EAEV,eAAe,EACf,OAAO,EACR,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/factory/options/option/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,KAAK,EACL,YAAY,EACb,MAAM,IAAI,CAAC;AACZ,OAAO,KAAK,EAEV,eAAe,EACf,OAAO,EACR,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAEnD,MAAM,CAAC,OAAO,CAAC,QAAQ,OAAO,MAAM,CAClC,CAAC,SAAS,KAAK,EACf,aAAa,SACX,MAAM,GACN,OAAO,GAAG,KAAK,EACjB,WAAW,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,EACjC,MAAM,SAAS,OAAO,GAAG,KAAK,EAC9B,SAAS,SAAS,MAAM,GAAG,KAAK,EAChC,QAAQ,SAAS,MAAM,GAAG,KAAK;aAeb,MAAM,EAAE,KAAK,CAAC,WAAW,EAAE,OAAO,CAAC;aACnC,KAAK,EAAE,MAAM,EAAE;aACf,OAAO,EAAE,MAAM,EAAE;aACjB,OAAO,EAAE,OAAO;IAhBlC,kBAAyB,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;IAC9C,kBAAyB,SAAS,EAAE,SAAS,CAAC,S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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAG/B"}
|
@@ -2,24 +2,26 @@ import globals from "globals";
|
|
2
2
|
export default class Option {
|
3
3
|
parser;
|
4
4
|
files;
|
5
|
+
ignores;
|
5
6
|
ruleset;
|
6
|
-
constructor(parser, files, ruleset) {
|
7
|
+
constructor(parser, files, ignores, ruleset) {
|
7
8
|
this.parser = parser;
|
8
9
|
this.files = files;
|
10
|
+
this.ignores = ignores;
|
9
11
|
this.ruleset = ruleset;
|
10
12
|
}
|
11
13
|
get configs() {
|
12
|
-
const { scope,
|
14
|
+
const { scope, files, ignores, ruleset, option, } = this;
|
13
15
|
if (ruleset.scope !== scope)
|
14
16
|
throw new TypeError(`Scope mismatch between option and ruleset`, { cause: { option: scope, ruleset: ruleset.scope } });
|
15
17
|
return files.length < 1
|
16
18
|
? []
|
17
|
-
: ruleset.ruleset.map(({ id,
|
19
|
+
: ruleset.ruleset.map(({ id, rules }) => {
|
18
20
|
return {
|
19
21
|
name: `linted/${id}`,
|
20
22
|
files,
|
21
|
-
ignores
|
22
|
-
rules
|
23
|
+
ignores,
|
24
|
+
rules,
|
23
25
|
...option,
|
24
26
|
};
|
25
27
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/factory/options/option/index.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAY9B,MAAM,CAAC,OAAO,OAAgB,MAAM;IAuBhB;IACA;IACA;
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/factory/options/option/index.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAY9B,MAAM,CAAC,OAAO,OAAgB,MAAM;IAuBhB;IACA;IACA;IACA;IAJlB,YACkB,MAAmC,EACnC,KAAe,EACf,OAAiB,EACjB,OAAgB;QAHhB,WAAM,GAAN,MAAM,CAA6B;QACnC,UAAK,GAAL,KAAK,CAAU;QACf,YAAO,GAAP,OAAO,CAAU;QACjB,YAAO,GAAP,OAAO,CAAS;IAC/B,CAAC;IAEJ,IAAW,OAAO;QAChB,MAAM,EACJ,KAAK,EACL,KAAK,EACL,OAAO,EACP,OAAO,EACP,MAAM,GACP,GAAG,IAAI,CAAC;QAET,IAAI,OAAO,CAAC,KAAK,KAAK,KAAK;YACzB,MAAM,IAAI,SAAS,CAAC,2CAA2C,EAAE,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAEzH,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC;YACrB,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE;gBACtC,OAAO;oBACL,IAAI,EAAE,UAAU,EAAE,EAAE;oBACpB,KAAK;oBACL,OAAO;oBACP,KAAK;oBACL,GAAG,MAAM;iBACV,CAAC;YACJ,CAAC,CAAC,CAAC;IACP,CAAC;IAED,IAAY,MAAM;QAChB,IAAI,CAAC;YACH,MAAM,EACJ,eAAe,EACf,SAAS,EACT,QAAQ,GACT,GAAG,IAAI,CAAC;YAET,OAAO;gBACL,eAAe;gBACf,GAAG,SAAS;gBACZ,GAAG,QAAQ;aAMZ,CAAC;QACJ,CAAC;QACD,OAAO,CAAC,EAAE,CAAC;YAAC,MAAM,IAAI,KAAK,CAAC,+BAA+B,IAAI,CAAC,KAAK,UAAU,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC;QAAC,CAAC;IACnG,CAAC;IAIS,OAAO,CAAC,IAAY;QAC5B,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,CAAC;CACF"}
|
@@ -1,9 +1,9 @@
|
|
1
1
|
export type { RuleEntry, RuleRecord, } from "../index.js";
|
2
2
|
import type { Input } from "../index.js";
|
3
3
|
import { Ruleset } from "./ruleset.js";
|
4
|
-
export declare class
|
4
|
+
export declare class Rules {
|
5
5
|
private readonly rulesets;
|
6
6
|
constructor(rules: Input["rules"]);
|
7
|
-
|
7
|
+
rules(scope: string): Ruleset;
|
8
8
|
}
|
9
9
|
//# sourceMappingURL=index.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/factory/rules/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,SAAS,EACT,UAAU,GACX,MAAM,IAAI,CAAC;AAEZ,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,qBAAa,KAAK;IAChB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA8B;gBAE3C,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC;IAQ1B,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;CAMrC"}
|
@@ -1,12 +1,12 @@
|
|
1
1
|
import { Ruleset } from "./ruleset.js";
|
2
|
-
export class
|
2
|
+
export class Rules {
|
3
3
|
rulesets = new Map();
|
4
4
|
constructor(rules) {
|
5
5
|
const { rules: base, overrides } = rules, scopes = Object.keys(base);
|
6
6
|
for (const scope of scopes)
|
7
7
|
this.rulesets.set(scope, new Ruleset(scope, base[scope], overrides[scope]));
|
8
8
|
}
|
9
|
-
|
9
|
+
rules(scope) {
|
10
10
|
if (!this.rulesets.has(scope))
|
11
11
|
throw new ReferenceError(`Ruleset not found for scope: ${scope}`);
|
12
12
|
return this.rulesets.get(scope);
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/factory/rules/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,MAAM,OAAO,KAAK;IACC,QAAQ,GAAG,IAAI,GAAG,EAAmB,CAAC;IAEvD,YAAY,KAAqB;QAC/B,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,KAAK,EACxC,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAA0B,CAAC;QAEpD,KAAK,MAAM,KAAK,IAAI,MAAM;YACxB,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAChF,CAAC;IAEM,KAAK,CAAC,KAAa;QACxB,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC;YAC3B,MAAM,IAAI,cAAc,CAAC,gCAAgC,KAAK,EAAE,CAAC,CAAC;QAEpE,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAY,CAAC;IAC7C,CAAC;CACF"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ruleset.d.ts","sourceRoot":"","sources":["../../../src/factory/rules/ruleset.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EACT,UAAU,EACX,MAAM,GAAG,CAAC;AAEX,qBAAa,OAAO;aAIA,KAAK,EAAE,MAAM;IAH/B,SAAgB,OAAO,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,UAAU,CAAA;KAAE,EAAE,CAAC;gBAG3C,KAAK,EAAE,MAAM,EAC7B,KAAK,EAAE,SAAS,EAAE,EAClB,QAAQ,CAAC,EAAE,UAAU;CAgBxB"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ruleset.js","sourceRoot":"","sources":["../../../src/factory/rules/ruleset.ts"],"names":[],"mappings":"AAKA,MAAM,OAAO,OAAO;IAIA;IAHF,OAAO,CAAsC;IAE7D,YACkB,KAAa,EAC7B,KAAkB,EAClB,QAAqB;QAFL,UAAK,GAAL,KAAK,CAAQ;QAI7B,MAAM,GAAG,GAAG,CAAC,CAAC,EAAE,EAAE,KAAK,CAAY,EAAE,EAAE;YACrC,OAAO;gBACL,EAAE,EAAE,GAAG,KAAK,IAAI,EAAE,EAAE;gBACpB,KAAK;aACN,CAAC;QACJ,CAAC,CAAC;QAEF,IAAI,CAAC,OAAO,GAAG;YACb,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YAC/B,GAAG,OAAO,QAAQ,KAAK,WAAW;gBAChC,CAAC,CAAC,EAAE;gBACJ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC;SAC3C,CAAC;IACJ,CAAC;CACF"}
|
package/dist/index.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACtC,YAAY,EACV,OAAO,EACP,SAAS,EACT,UAAU,EACV,SAAS,EACT,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,WAAW,CAAC;AAEnB,OAAO,KAAK,EACV,KAAK,EACL,MAAM,EACP,MAAM,aAAa,CAAC;AAErB,YAAY,EACV,KAAK,EACL,MAAM,GACP,CAAC;AAQF,MAAM,CAAC,OAAO,WAAW,KAAK,EAAE,KAAK,GAAG,MAAM,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACtC,YAAY,EACV,OAAO,EACP,SAAS,EACT,UAAU,EACV,SAAS,EACT,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,WAAW,CAAC;AAEnB,OAAO,KAAK,EACV,KAAK,EACL,MAAM,EACP,MAAM,aAAa,CAAC;AAErB,YAAY,EACV,KAAK,EACL,MAAM,GACP,CAAC;AAQF,MAAM,CAAC,OAAO,WAAW,KAAK,EAAE,KAAK,GAAG,MAAM,CAsF7C"}
|
package/dist/index.js
CHANGED
@@ -2,7 +2,7 @@ import { scopes } from "./scopes/index.js";
|
|
2
2
|
import { Factory, Options, } from "./factory/index.js";
|
3
3
|
export default function (input) {
|
4
4
|
try {
|
5
|
-
const { plugins, parsers, settings,
|
5
|
+
const { plugins, parsers, settings, globals, files, ignores, rules, } = input, factory = new Factory(files, ignores, rules), options = {
|
6
6
|
js: new Options
|
7
7
|
.js([], ...factory.produce("js")).configs,
|
8
8
|
ts: new Options
|
@@ -22,13 +22,13 @@ export default function (input) {
|
|
22
22
|
};
|
23
23
|
return [
|
24
24
|
{
|
25
|
-
ignores: typeof
|
26
|
-
?
|
25
|
+
ignores: typeof globals.extend.ignores === "undefined" || globals.extend.ignores.length < 1
|
26
|
+
? globals.ignores.ignores
|
27
27
|
: [
|
28
|
-
...
|
28
|
+
...globals.extend.inherit === false
|
29
29
|
? []
|
30
|
-
:
|
31
|
-
...
|
30
|
+
: globals.ignores.ignores,
|
31
|
+
...globals.extend.ignores,
|
32
32
|
],
|
33
33
|
},
|
34
34
|
{
|
package/dist/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EACL,OAAO,EACP,OAAO,GACR,MAAM,WAAW,CAAC;AAEnB,MAAM,CAAC,OAAO,WAAW,KAAY;IACnC,IAAI,CAAC;QACH,MAAM,EACJ,OAAO,EACP,OAAO,EACP,QAAQ,EACR,OAAO,EACP,KAAK,EACL,KAAK,GACN,GAAG,KAAK,EACT,OAAO,GAAG,IAAI,OAAO,
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EACL,OAAO,EACP,OAAO,GACR,MAAM,WAAW,CAAC;AAEnB,MAAM,CAAC,OAAO,WAAW,KAAY;IACnC,IAAI,CAAC;QACH,MAAM,EACJ,OAAO,EACP,OAAO,EACP,QAAQ,EACR,OAAO,EACP,KAAK,EACL,OAAO,EACP,KAAK,GACN,GAAG,KAAK,EACT,OAAO,GAAG,IAAI,OAAO,CACnB,KAAK,EACL,OAAO,EACP,KAAK,CACN,EACD,OAAO,GAAiF;YACtF,EAAE,EAAE,IAAI,OAAO;iBACZ,EAAE,CACD,EAAE,EACF,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CACzB,CAAC,OAAO;YACX,EAAE,EAAE,IAAI,OAAO;iBACZ,EAAE,CACD,CAAC,OAAO,CAAC,EAAE,CAAC,EACZ,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CACzB,CAAC,OAAO;YACX,MAAM,EAAE,IAAI,OAAO;iB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MAAM,CAAC,OAAO;qBAC1B;aACN;YACD;gBACE,IAAI,EAAE,QAAQ;gBACd,OAAO;gBACP,aAAa,EAAE;oBACb,cAAc,EAAE,QAAQ,CAAC,cAAc;oBACvC,6BAA6B,EAAE,QAAQ,CAAC,6BAA6B;iBACtE;gBACD,eAAe,EAAE;oBACf,UAAU,EAAE,QAAQ,CAAC,UAAU;oBAC/B,WAAW,EAAE,QAAQ,CAAC,WAAW;iBAClC;aACF;YACD,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;SAC3C,CAAC;IACJ,CAAC;IACD,OAAO,CAAC,EAAE,CAAC;QAAC,MAAM,IAAI,KAAK,CAAC,aAAa,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC;IAAC,CAAC;AAC7D,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../../../../src/interface/input/scoped/ignores/defaults.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,GAAG,CAAC;AAE/B,MAAM,MAAM,oBAAoB,GAAG,MAAM,CACvC,KAAK,EACL,MAAM,EAAE,CACT,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"defaults.js","sourceRoot":"","sources":["../../../../../src/interface/input/scoped/ignores/defaults.ts"],"names":[],"mappings":""}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"extend.d.ts","sourceRoot":"","sources":["../../../../../src/interface/input/scoped/ignores/extend.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAEvD,MAAM,MAAM,kBAAkB,GAAG,OAAO,CACtC,oBAAoB,CACrB,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"extend.js","sourceRoot":"","sources":["../../../../../src/interface/input/scoped/ignores/extend.ts"],"names":[],"mappings":""}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
export type { Scope } from "../index.js";
|
2
|
+
import type { ScopedIgnoreDefaults } from "./defaults.js";
|
3
|
+
import type { ScopedIgnoreExtend } from "./extend.js";
|
4
|
+
export interface InputScopedIgnores {
|
5
|
+
ignores: ScopedIgnoreDefaults;
|
6
|
+
extend: ScopedIgnoreExtend;
|
7
|
+
}
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/interface/input/scoped/ignores/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,KAAK,EAAE,MAAM,IAAI,CAAC;AAEhC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AACvD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAEnD,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,oBAAoB,CAAC;IAC9B,MAAM,EAAE,kBAAkB,CAAC;CAC5B"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/interface/input/scoped/ignores/index.ts"],"names":[],"mappings":""}
|
@@ -1,8 +1,10 @@
|
|
1
1
|
export type { Scope, RuleEntry, RuleRecord, } from "../index.js";
|
2
2
|
import type { InputFiles } from "./files/index.js";
|
3
|
+
import type { InputScopedIgnores } from "./ignores/index.js";
|
3
4
|
import type { InputRules } from "./rules/index.js";
|
4
5
|
export interface InputScoped {
|
5
6
|
files: InputFiles;
|
7
|
+
ignores: InputScopedIgnores;
|
6
8
|
rules: InputRules;
|
7
9
|
}
|
8
10
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/interface/input/scoped/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,KAAK,EACL,SAAS,EACT,UAAU,GACX,MAAM,IAAI,CAAC;AAEZ,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,UAAU,CAAC;IAClB,KAAK,EAAE,UAAU,CAAC;CACnB"}
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/interface/input/scoped/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,KAAK,EACL,SAAS,EACT,UAAU,GACX,MAAM,IAAI,CAAC;AAEZ,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,UAAU,CAAC;IAClB,OAAO,EAAE,kBAAkB,CAAC;IAC5B,KAAK,EAAE,UAAU,CAAC;CACnB"}
|
@@ -1,4 +1,3 @@
|
|
1
|
-
import type { RuleRecord } from "./index.js";
|
2
|
-
|
3
|
-
export type RulesOverrides = Partially<keyof RulesDefaults, RuleRecord>;
|
1
|
+
import type { Scope, RuleRecord } from "./index.js";
|
2
|
+
export type RulesOverrides = Partial<Record<Scope, RuleRecord>>;
|
4
3
|
//# sourceMappingURL=overrides.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"overrides.d.ts","sourceRoot":"","sources":["../../../../../src/interface/input/scoped/rules/overrides.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
1
|
+
{"version":3,"file":"overrides.d.ts","sourceRoot":"","sources":["../../../../../src/interface/input/scoped/rules/overrides.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,KAAK,EACL,UAAU,EACX,MAAM,GAAG,CAAC;AAEX,MAAM,MAAM,cAAc,GAAG,OAAO,CAAC,MAAM,CACzC,KAAK,EACL,UAAU,CACX,CAAC,CAAC"}
|
package/package.json
CHANGED
package/src/factory/files.ts
CHANGED
@@ -4,14 +4,14 @@ export class Files {
|
|
4
4
|
private readonly _files = new Map<string, string[]>();
|
5
5
|
|
6
6
|
constructor(files: Input["files"]) {
|
7
|
-
const { files:
|
8
|
-
scopes = Object.keys(
|
7
|
+
const { files: defaults, includes } = files,
|
8
|
+
scopes = Object.keys(defaults) as (keyof typeof defaults)[];
|
9
9
|
|
10
10
|
for (const scope of scopes)
|
11
11
|
this._files.set(
|
12
12
|
scope,
|
13
13
|
[
|
14
|
-
...
|
14
|
+
...defaults[scope],
|
15
15
|
...scope in includes ? (includes[scope] as string[]) : [],
|
16
16
|
],
|
17
17
|
);
|
@@ -0,0 +1,26 @@
|
|
1
|
+
import type { Input } from ".";
|
2
|
+
|
3
|
+
export class Ignores {
|
4
|
+
private readonly _ignores = new Map<string, string[]>();
|
5
|
+
|
6
|
+
constructor(ignores: Input["ignores"]) {
|
7
|
+
const { ignores: defaults, extend } = ignores,
|
8
|
+
scopes = Object.keys(defaults) as (keyof typeof defaults)[];
|
9
|
+
|
10
|
+
for (const scope of scopes)
|
11
|
+
this._ignores.set(
|
12
|
+
scope,
|
13
|
+
[
|
14
|
+
...defaults[scope],
|
15
|
+
...scope in extend ? (extend[scope] as string[]) : [],
|
16
|
+
],
|
17
|
+
);
|
18
|
+
}
|
19
|
+
|
20
|
+
public ignores(scope: string) {
|
21
|
+
if (!this._ignores.has(scope))
|
22
|
+
throw new ReferenceError(`Files not found for scope: ${scope}`);
|
23
|
+
|
24
|
+
return this._ignores.get(scope) as string[];
|
25
|
+
}
|
26
|
+
}
|
package/src/factory/index.ts
CHANGED
@@ -7,26 +7,31 @@ export type {
|
|
7
7
|
} from "..";
|
8
8
|
|
9
9
|
import { Files } from "./files";
|
10
|
-
import {
|
10
|
+
import { Ignores } from "./ignores";
|
11
|
+
import { Rules } from "./rules";
|
11
12
|
import Options from "./options";
|
12
13
|
|
13
14
|
export { Options };
|
14
15
|
export class Factory {
|
15
16
|
public readonly files: Files;
|
16
|
-
public readonly
|
17
|
+
public readonly ignores: Ignores;
|
18
|
+
public readonly rules: Rules;
|
17
19
|
|
18
20
|
constructor(
|
19
21
|
files: ConstructorParameters<typeof Files>[0],
|
20
|
-
|
22
|
+
ignores: ConstructorParameters<typeof Ignores>[0],
|
23
|
+
rules: ConstructorParameters<typeof Rules>[0],
|
21
24
|
) {
|
22
25
|
this.files = new Files(files);
|
23
|
-
this.
|
26
|
+
this.ignores = new Ignores(ignores);
|
27
|
+
this.rules = new Rules(rules);
|
24
28
|
}
|
25
29
|
|
26
30
|
public produce(scope: string) {
|
27
31
|
return [
|
28
32
|
this.files.files(scope),
|
29
|
-
this.
|
33
|
+
this.ignores.ignores(scope),
|
34
|
+
this.rules.rules(scope),
|
30
35
|
] as const;
|
31
36
|
}
|
32
37
|
}
|
@@ -8,7 +8,7 @@ import type {
|
|
8
8
|
LanguageOptions,
|
9
9
|
Globals,
|
10
10
|
} from "./template";
|
11
|
-
import type { Ruleset } from "../../
|
11
|
+
import type { Ruleset } from "../../rules/ruleset";
|
12
12
|
|
13
13
|
export default abstract class Option<
|
14
14
|
S extends Scope,
|
@@ -35,14 +35,16 @@ export default abstract class Option<
|
|
35
35
|
constructor(
|
36
36
|
public readonly parser: Tuple<ParserCount, unknown>,
|
37
37
|
public readonly files: string[],
|
38
|
+
public readonly ignores: string[],
|
38
39
|
public readonly ruleset: Ruleset,
|
39
40
|
) {}
|
40
41
|
|
41
42
|
public get configs(): ScopedConfig[] {
|
42
43
|
const {
|
43
44
|
scope,
|
44
|
-
ruleset,
|
45
45
|
files,
|
46
|
+
ignores,
|
47
|
+
ruleset,
|
46
48
|
option,
|
47
49
|
} = this;
|
48
50
|
|
@@ -51,12 +53,12 @@ export default abstract class Option<
|
|
51
53
|
|
52
54
|
return files.length < 1
|
53
55
|
? []
|
54
|
-
: ruleset.ruleset.map(({ id,
|
56
|
+
: ruleset.ruleset.map(({ id, rules }) => {
|
55
57
|
return {
|
56
58
|
name: `linted/${id}`,
|
57
59
|
files,
|
58
|
-
ignores
|
59
|
-
rules
|
60
|
+
ignores,
|
61
|
+
rules,
|
60
62
|
...option,
|
61
63
|
};
|
62
64
|
});
|
@@ -6,7 +6,7 @@ export type {
|
|
6
6
|
import type { Input } from "..";
|
7
7
|
import { Ruleset } from "./ruleset";
|
8
8
|
|
9
|
-
export class
|
9
|
+
export class Rules {
|
10
10
|
private readonly rulesets = new Map<string, Ruleset>();
|
11
11
|
|
12
12
|
constructor(rules: Input["rules"]) {
|
@@ -17,7 +17,7 @@ export class Rulesets {
|
|
17
17
|
this.rulesets.set(scope, new Ruleset(scope, base[scope], overrides[scope]));
|
18
18
|
}
|
19
19
|
|
20
|
-
public
|
20
|
+
public rules(scope: string): Ruleset {
|
21
21
|
if (!this.rulesets.has(scope))
|
22
22
|
throw new ReferenceError(`Ruleset not found for scope: ${scope}`);
|
23
23
|
|
@@ -4,17 +4,17 @@ import type {
|
|
4
4
|
} from ".";
|
5
5
|
|
6
6
|
export class Ruleset {
|
7
|
-
public readonly ruleset: { id: string;
|
7
|
+
public readonly ruleset: { id: string; rules: RuleRecord }[];
|
8
8
|
|
9
9
|
constructor(
|
10
10
|
public readonly scope: string,
|
11
11
|
rules: RuleEntry[],
|
12
12
|
override?: RuleRecord,
|
13
13
|
) {
|
14
|
-
const map = ([id,
|
14
|
+
const map = ([id, rules]: RuleEntry) => {
|
15
15
|
return {
|
16
16
|
id: `${scope}:${id}`,
|
17
|
-
|
17
|
+
rules,
|
18
18
|
};
|
19
19
|
};
|
20
20
|
|
package/src/index.ts
CHANGED
@@ -31,11 +31,16 @@ export default function (input: Input): Output {
|
|
31
31
|
plugins,
|
32
32
|
parsers,
|
33
33
|
settings,
|
34
|
-
|
34
|
+
globals,
|
35
35
|
files,
|
36
|
+
ignores,
|
36
37
|
rules,
|
37
38
|
} = input,
|
38
|
-
factory = new Factory(
|
39
|
+
factory = new Factory(
|
40
|
+
files,
|
41
|
+
ignores,
|
42
|
+
rules,
|
43
|
+
),
|
39
44
|
options: { [S in typeof scopes[number]]: InstanceType<typeof Options[S]>["configs"] } = {
|
40
45
|
js: new Options
|
41
46
|
.js(
|
@@ -81,13 +86,13 @@ export default function (input: Input): Output {
|
|
81
86
|
|
82
87
|
return [
|
83
88
|
{
|
84
|
-
ignores: typeof
|
85
|
-
?
|
89
|
+
ignores: typeof globals.extend.ignores === "undefined" || globals.extend.ignores.length < 1
|
90
|
+
? globals.ignores.ignores
|
86
91
|
: [
|
87
|
-
...
|
92
|
+
...globals.extend.inherit === false
|
88
93
|
? []
|
89
|
-
:
|
90
|
-
...
|
94
|
+
: globals.ignores.ignores,
|
95
|
+
...globals.extend.ignores,
|
91
96
|
],
|
92
97
|
},
|
93
98
|
{
|
@@ -5,9 +5,11 @@ export type {
|
|
5
5
|
} from "..";
|
6
6
|
|
7
7
|
import type { InputFiles } from "./files";
|
8
|
+
import type { InputScopedIgnores } from "./ignores";
|
8
9
|
import type { InputRules } from "./rules";
|
9
10
|
|
10
11
|
export interface InputScoped {
|
11
12
|
files: InputFiles;
|
13
|
+
ignores: InputScopedIgnores;
|
12
14
|
rules: InputRules;
|
13
15
|
}
|
@@ -1,7 +1,9 @@
|
|
1
|
-
import type {
|
2
|
-
|
1
|
+
import type {
|
2
|
+
Scope,
|
3
|
+
RuleRecord,
|
4
|
+
} from ".";
|
3
5
|
|
4
|
-
export type RulesOverrides =
|
5
|
-
|
6
|
+
export type RulesOverrides = Partial<Record<
|
7
|
+
Scope,
|
6
8
|
RuleRecord
|
7
|
-
|
9
|
+
>>;
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/factory/rulesets/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,SAAS,EACT,UAAU,GACX,MAAM,IAAI,CAAC;AAEZ,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,qBAAa,QAAQ;IACnB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA8B;gBAE3C,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC;IAQ1B,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;CAMvC"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/factory/rulesets/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,MAAM,OAAO,QAAQ;IACF,QAAQ,GAAG,IAAI,GAAG,EAAmB,CAAC;IAEvD,YAAY,KAAqB;QAC/B,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,KAAK,EACxC,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAA0B,CAAC;QAEpD,KAAK,MAAM,KAAK,IAAI,MAAM;YACxB,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAChF,CAAC;IAEM,OAAO,CAAC,KAAa;QAC1B,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC;YAC3B,MAAM,IAAI,cAAc,CAAC,gCAAgC,KAAK,EAAE,CAAC,CAAC;QAEpE,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAY,CAAC;IAC7C,CAAC;CACF"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"ruleset.d.ts","sourceRoot":"","sources":["../../../src/factory/rulesets/ruleset.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EACT,UAAU,EACX,MAAM,GAAG,CAAC;AAEX,qBAAa,OAAO;aAIA,KAAK,EAAE,MAAM;IAH/B,SAAgB,OAAO,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,UAAU,CAAA;KAAE,EAAE,CAAC;gBAG1C,KAAK,EAAE,MAAM,EAC7B,KAAK,EAAE,SAAS,EAAE,EAClB,QAAQ,CAAC,EAAE,UAAU;CAgBxB"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"ruleset.js","sourceRoot":"","sources":["../../../src/factory/rulesets/ruleset.ts"],"names":[],"mappings":"AAKA,MAAM,OAAO,OAAO;IAIA;IAHF,OAAO,CAAqC;IAE5D,YACkB,KAAa,EAC7B,KAAkB,EAClB,QAAqB;QAFL,UAAK,GAAL,KAAK,CAAQ;QAI7B,MAAM,GAAG,GAAG,CAAC,CAAC,EAAE,EAAE,IAAI,CAAuB,EAAE,EAAE;YAC/C,OAAO;gBACL,EAAE,EAAE,GAAG,KAAK,IAAI,EAAE,EAAE;gBACpB,IAAI;aACL,CAAC;QACJ,CAAC,CAAC;QAEF,IAAI,CAAC,OAAO,GAAG;YACb,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YAC/B,GAAG,OAAO,QAAQ,KAAK,WAAW;gBAChC,CAAC,CAAC,EAAE;gBACJ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC;SAC3C,CAAC;IACJ,CAAC;CACF"}
|