@eslinted/core 13.4.0-rc.0 → 13.4.0-rc.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,6 @@
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: {
@@ -20,16 +21,16 @@ export declare class Factory {
20
21
  };
21
22
  };
22
23
  readonly scopes: {
23
- readonly files: Readonly<Record<"*" | "svelte" | "mocha" | "jsonc" | "yml" | "ts" | "html" | "js" | "json", string[]>>;
24
- readonly ignores: Readonly<Record<"*" | "svelte" | "mocha" | "jsonc" | "yml" | "ts" | "html" | "js" | "json", string[]>>;
25
- readonly rules: Readonly<Record<"svelte" | "mocha" | "jsonc" | "yml" | "ts" | "html" | "js" | "json", import("../interface/shared/config/rule/index.js").NamedBag[]>>;
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" | "js" | "json", string[]>>[S];
32
- readonly ignores: Readonly<Record<"*" | "svelte" | "mocha" | "jsonc" | "yml" | "ts" | "html" | "js" | "json", string[]>>[S];
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[]
@@ -37,8 +38,8 @@ export declare class Factory {
37
38
  } | {
38
39
  readonly processor?: "svelte/svelte";
39
40
  readonly name: `linted/${S}/settings`;
40
- readonly files: Readonly<Record<"*" | "svelte" | "mocha" | "jsonc" | "yml" | "ts" | "html" | "js" | "json", string[]>>[S];
41
- readonly ignores: Readonly<Record<"*" | "svelte" | "mocha" | "jsonc" | "yml" | "ts" | "html" | "js" | "json", string[]>>[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;AAE1C,qBAAa,OAAO;aAKA,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC;IAJtD,SAAgB,MAAM;;;;;;;;;;;;;;;;MAAC;IACvB,SAAgB,MAAM;;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AAE,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"}
@@ -3,7 +3,7 @@ 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 = {
@@ -25,12 +25,18 @@ export class Factory {
25
25
  ignores: defaultIgnores,
26
26
  rules: defaultRules,
27
27
  };
28
- for (const s in scopeExtensions) {
29
- const { [s]: { files: moreFiles = [], ignores: moreIgnores = [], rules: moreRules = null, } = {}, } = scopeExtensions;
30
- this.scopes.files[s].push(...moreFiles);
31
- this.scopes.ignores[s].push(...moreIgnores);
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[s].push([`${s}:override`, moreRules]);
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) {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/factory/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAG3C,MAAM,OAAO,OAAO;IAKA;IAJF,MAAM,CAAC;IACP,MAAM,CAAC;IAEvB,YACkB,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,EACvC,WAAW,GAAG,eAAe,CAAC,WAAW,EACzC,OAAO,GAAG,EAAW,EACrB,QAAQ,GAAG,KAAK,GACjB,GAAG,eAAe,CAAC;QAEpB,IAAI,CAAC,MAAM,GAAG;YACZ,QAAQ,EAAE;gBACR,IAAI,EAAE,mBAAmB;gBACzB,aAAa,EAAE,EAAE,cAAc,EAAE,6BAA6B,EAAW;gBACzE,eAAe,EAAE,EAAE,UAAU,EAAE,WAAW,EAAW;aAC7C;YACV,OAAO,EAAE;gBACP,IAAI,EAAE,kBAAkB;gBACxB,OAAO,EAAE;oBACP,GAAG,QAAQ,CAAC,CAAC,CAAC,EAAW,CAAC,CAAC,CAAC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AAC;iBACb,CAAC;IACV,CAAC;CACF"}
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
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
7
  { name: `linted/*/plugins`, plugins },
8
8
  factory.common.settings,
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;AAClC,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,OAAO,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;QAE3D,OAAO;YACL,EAAE,IAAI,EAAE,kBAAkB,EAAE,OAAO,EAAW;YAC9C,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"}
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,EAAE,IAAI,EAAE,kBAAkB,EAAE,OAAO,EAAW;YAC9C,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"}
@@ -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;;;;;;;;;CASP,CAAC"}
1
+ {"version":3,"file":"tree.d.ts","sourceRoot":"","sources":["../../src/scopes/tree.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,IAAI,+JAKP,CAAC"}
@@ -1,11 +1,7 @@
1
- export const tree = {
2
- js: [],
3
- ts: ["js"],
4
- svelte: ["ts"],
5
- mocha: ["ts"],
6
- html: [],
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
@@ -1 +1 @@
1
- {"version":3,"file":"tree.js","sourceRoot":"","sources":["../../src/scopes/tree.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,IAAI,GAAG;IAClB,EAAE,EAAE,EAAE;IACN,EAAE,EAAE,CAAC,IAAI,CAAC;IACV,MAAM,EAAE,CAAC,IAAI,CAAC;IACd,KAAK,EAAE,CAAC,IAAI,CAAC;IACb,IAAI,EAAE,EAAE;IACR,IAAI,EAAE,EAAE;IACR,KAAK,EAAE,CAAC,MAAM,CAAC;IACf,GAAG,EAAE,EAAE;CACC,CAAC"}
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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "_schemaVersion": "22.11.0",
3
3
  "name": "@eslinted/core",
4
- "version": "13.4.0-rc.0",
4
+ "version": "13.4.0-rc.1",
5
5
  "description": "Core ESLint flat config factory npm package `linted`.",
6
6
  "keywords": [],
7
7
  "repository": "github:jimmy-zhening-luo/linted-core",
@@ -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,
@@ -44,20 +46,31 @@ export class Factory {
44
46
  rules: defaultRules,
45
47
  } as const;
46
48
 
47
- for (const s in scopeExtensions) {
49
+ for (const scope in scopeExtensions) {
48
50
  const {
49
- [s as keyof typeof scopeExtensions]: {
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[s as keyof typeof scopeExtensions].push(...moreFiles);
57
- this.scopes.ignores[s as keyof typeof scopeExtensions].push(...moreIgnores);
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[s as keyof typeof scopeExtensions].push([`${s}:override`, moreRules]);
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
 
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,7 +10,7 @@ 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
16
  { name: `linted/*/plugins`, plugins } as const,
@@ -1,10 +1,6 @@
1
- export const tree = {
2
- js: [],
3
- ts: ["js"],
4
- svelte: ["ts"],
5
- mocha: ["ts"],
6
- html: [],
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;