@azat-io/eslint-config 2.0.0 → 2.1.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.
@@ -1,19 +1,40 @@
1
1
  "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (let key of __getOwnPropNames(from))
11
+ if (!__hasOwnProp.call(to, key) && key !== except)
12
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
+ }
14
+ return to;
15
+ };
16
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
18
+ mod
19
+ ));
2
20
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const typescriptEslint = require("typescript-eslint");
4
- const astroParser = require("astro-eslint-parser");
5
- const astroPlugin = require("eslint-plugin-astro");
6
21
  const path = require("node:path");
7
- let astro = (config) => {
22
+ const utils = require("../utils.cjs");
23
+ let astro = async (config) => {
8
24
  if (!config.astro) {
9
25
  return {};
10
26
  }
27
+ let [astroPlugin, astroParser] = await Promise.all([
28
+ utils.interopDefault(import("eslint-plugin-astro")),
29
+ utils.interopDefault(import("astro-eslint-parser"))
30
+ ]);
11
31
  let files = ["**/*.astro"];
12
32
  let additionalParserOptions = {};
13
33
  if (config.typescript) {
34
+ let typescriptParser = await utils.interopDefault(import("typescript-eslint"));
14
35
  additionalParserOptions = {
15
36
  ...additionalParserOptions,
16
- parser: typescriptEslint.parser,
37
+ parser: typescriptParser,
17
38
  project: path.join(process.cwd(), "tsconfig.json"),
18
39
  projectService: false,
19
40
  tsconfigRootDir: process.cwd()
@@ -1,17 +1,20 @@
1
- import { parser } from "typescript-eslint";
2
- import astroParser from "astro-eslint-parser";
3
- import astroPlugin from "eslint-plugin-astro";
4
1
  import path from "node:path";
5
- let astro = (config) => {
2
+ import { interopDefault } from "../utils.mjs";
3
+ let astro = async (config) => {
6
4
  if (!config.astro) {
7
5
  return {};
8
6
  }
7
+ let [astroPlugin, astroParser] = await Promise.all([
8
+ interopDefault(import("eslint-plugin-astro")),
9
+ interopDefault(import("astro-eslint-parser"))
10
+ ]);
9
11
  let files = ["**/*.astro"];
10
12
  let additionalParserOptions = {};
11
13
  if (config.typescript) {
14
+ let typescriptParser = await interopDefault(import("typescript-eslint"));
12
15
  additionalParserOptions = {
13
16
  ...additionalParserOptions,
14
- parser,
17
+ parser: typescriptParser,
15
18
  project: path.join(process.cwd(), "tsconfig.json"),
16
19
  projectService: false,
17
20
  tsconfigRootDir: process.cwd()
@@ -312,11 +312,8 @@ let core = (config) => {
312
312
  "@eslint-community/eslint-comments/no-unused-disable": "error",
313
313
  "@eslint-community/eslint-comments/no-unused-enable": "error",
314
314
  "import-x/consistent-type-specifier-style": ["error", "prefer-top-level"],
315
- "import-x/default": "error",
316
315
  "import-x/export": "error",
317
316
  "import-x/first": "error",
318
- "import-x/named": "error",
319
- "import-x/namespace": "error",
320
317
  "import-x/newline-after-import": "error",
321
318
  "import-x/no-absolute-path": "error",
322
319
  "import-x/no-amd": "error",
@@ -330,15 +327,8 @@ let core = (config) => {
330
327
  }
331
328
  ],
332
329
  "import-x/no-import-module-exports": "error",
333
- "import-x/no-named-as-default-member": "error",
334
330
  "import-x/no-named-default": "error",
335
331
  "import-x/no-self-import": "error",
336
- "import-x/no-unresolved": [
337
- "error",
338
- config.astro ? {
339
- ignore: ["^astro:(assets|content|transitions)"]
340
- } : {}
341
- ],
342
332
  "import-x/no-useless-path-segments": "error",
343
333
  "import-x/no-webpack-loader-syntax": "error",
344
334
  "jsdoc/check-access": "error",
@@ -618,10 +608,6 @@ let core = (config) => {
618
608
  "unicorn/throw-new-error": "error"
619
609
  },
620
610
  settings: {
621
- "import-x/resolver": {
622
- node: true,
623
- typescript: config.typescript
624
- },
625
611
  jsdoc: {
626
612
  mode: "jsdoc"
627
613
  }
@@ -310,11 +310,8 @@ let core = (config) => {
310
310
  "@eslint-community/eslint-comments/no-unused-disable": "error",
311
311
  "@eslint-community/eslint-comments/no-unused-enable": "error",
312
312
  "import-x/consistent-type-specifier-style": ["error", "prefer-top-level"],
313
- "import-x/default": "error",
314
313
  "import-x/export": "error",
315
314
  "import-x/first": "error",
316
- "import-x/named": "error",
317
- "import-x/namespace": "error",
318
315
  "import-x/newline-after-import": "error",
319
316
  "import-x/no-absolute-path": "error",
320
317
  "import-x/no-amd": "error",
@@ -328,15 +325,8 @@ let core = (config) => {
328
325
  }
329
326
  ],
330
327
  "import-x/no-import-module-exports": "error",
331
- "import-x/no-named-as-default-member": "error",
332
328
  "import-x/no-named-default": "error",
333
329
  "import-x/no-self-import": "error",
334
- "import-x/no-unresolved": [
335
- "error",
336
- config.astro ? {
337
- ignore: ["^astro:(assets|content|transitions)"]
338
- } : {}
339
- ],
340
330
  "import-x/no-useless-path-segments": "error",
341
331
  "import-x/no-webpack-loader-syntax": "error",
342
332
  "jsdoc/check-access": "error",
@@ -616,10 +606,6 @@ let core = (config) => {
616
606
  "unicorn/throw-new-error": "error"
617
607
  },
618
608
  settings: {
619
- "import-x/resolver": {
620
- node: true,
621
- typescript: config.typescript
622
- },
623
609
  jsdoc: {
624
610
  mode: "jsdoc"
625
611
  }
package/dist/index.cjs CHANGED
@@ -4,12 +4,12 @@ const index$b = require("./package-json/index.cjs");
4
4
  const index$5 = require("./typescript/index.cjs");
5
5
  const index$8 = require("./svelte/index.cjs");
6
6
  const index$6 = require("./vitest/index.cjs");
7
- const index$4 = require("./react/index.cjs");
7
+ const index$3 = require("./react/index.cjs");
8
8
  const index$7 = require("./astro/index.cjs");
9
9
  const index$9 = require("./qwik/index.cjs");
10
- const index$3 = require("./a11y/index.cjs");
10
+ const index$2 = require("./a11y/index.cjs");
11
11
  const index$1 = require("./core/index.cjs");
12
- const index$2 = require("./node/index.cjs");
12
+ const index$4 = require("./node/index.cjs");
13
13
  const index$a = require("./vue/index.cjs");
14
14
  const CONFIG_OPTIONS = [
15
15
  "perfectionist",
@@ -22,7 +22,7 @@ const CONFIG_OPTIONS = [
22
22
  "node",
23
23
  "vue"
24
24
  ];
25
- const index = ({
25
+ const index = async ({
26
26
  extends: customExtends = {},
27
27
  ...rawConfig
28
28
  } = {}) => {
@@ -30,6 +30,23 @@ const index = ({
30
30
  for (let configName of CONFIG_OPTIONS) {
31
31
  config[configName] = rawConfig[configName] ?? false;
32
32
  }
33
+ let configFunctions = [
34
+ index$1.core,
35
+ index$2.a11y,
36
+ index$3.react,
37
+ index$4.node,
38
+ index$5.typescript,
39
+ index$6.vitest,
40
+ index$7.astro,
41
+ index$8.svelte,
42
+ index$9.qwik,
43
+ index$a.vue,
44
+ index$b.packageJson,
45
+ index$c.perfectionist
46
+ ];
47
+ let configs = await Promise.all(
48
+ configFunctions.map((createConfigFunction) => createConfigFunction(config))
49
+ );
33
50
  return [
34
51
  {
35
52
  ignores: [
@@ -56,20 +73,7 @@ const index = ({
56
73
  "**/tmp/**"
57
74
  ]
58
75
  },
59
- ...[
60
- index$1.core,
61
- index$2.node,
62
- index$3.a11y,
63
- index$4.react,
64
- index$5.typescript,
65
- index$6.vitest,
66
- index$7.astro,
67
- index$8.svelte,
68
- index$9.qwik,
69
- index$a.vue,
70
- index$b.packageJson,
71
- index$c.perfectionist
72
- ].map((createConfigFunction) => createConfigFunction(config)),
76
+ ...configs,
73
77
  ...Array.isArray(customExtends) ? customExtends : [customExtends]
74
78
  ];
75
79
  };
package/dist/index.d.ts CHANGED
@@ -6,5 +6,5 @@ type RawConfigOptions = {
6
6
  extends?: Linter.Config[] | Linter.Config;
7
7
  } & Partial<ConfigOptionFlags>;
8
8
  export type ConfigOptions = Required<ConfigOptionFlags>;
9
- declare const _default: ({ extends: customExtends, ...rawConfig }?: RawConfigOptions) => Linter.Config[];
9
+ declare const _default: ({ extends: customExtends, ...rawConfig }?: RawConfigOptions) => Promise<Linter.Config[]>;
10
10
  export default _default;
package/dist/index.mjs CHANGED
@@ -21,7 +21,7 @@ const CONFIG_OPTIONS = [
21
21
  "node",
22
22
  "vue"
23
23
  ];
24
- const index = ({
24
+ const index = async ({
25
25
  extends: customExtends = {},
26
26
  ...rawConfig
27
27
  } = {}) => {
@@ -29,6 +29,23 @@ const index = ({
29
29
  for (let configName of CONFIG_OPTIONS) {
30
30
  config[configName] = rawConfig[configName] ?? false;
31
31
  }
32
+ let configFunctions = [
33
+ core,
34
+ a11y,
35
+ react,
36
+ node,
37
+ typescript,
38
+ vitest,
39
+ astro,
40
+ svelte,
41
+ qwik,
42
+ vue,
43
+ packageJson,
44
+ perfectionist
45
+ ];
46
+ let configs = await Promise.all(
47
+ configFunctions.map((createConfigFunction) => createConfigFunction(config))
48
+ );
32
49
  return [
33
50
  {
34
51
  ignores: [
@@ -55,20 +72,7 @@ const index = ({
55
72
  "**/tmp/**"
56
73
  ]
57
74
  },
58
- ...[
59
- core,
60
- node,
61
- a11y,
62
- react,
63
- typescript,
64
- vitest,
65
- astro,
66
- svelte,
67
- qwik,
68
- vue,
69
- packageJson,
70
- perfectionist
71
- ].map((createConfigFunction) => createConfigFunction(config)),
75
+ ...configs,
72
76
  ...Array.isArray(customExtends) ? customExtends : [customExtends]
73
77
  ];
74
78
  };
@@ -1,10 +1,29 @@
1
1
  "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (let key of __getOwnPropNames(from))
11
+ if (!__hasOwnProp.call(to, key) && key !== except)
12
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
+ }
14
+ return to;
15
+ };
16
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
18
+ mod
19
+ ));
2
20
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const nPlugin = require("eslint-plugin-n");
4
- let node = (config) => {
21
+ const utils = require("../utils.cjs");
22
+ let node = async (config) => {
5
23
  if (!config.node) {
6
24
  return {};
7
25
  }
26
+ let nPlugin = await utils.interopDefault(import("eslint-plugin-n"));
8
27
  let files = ["**/*.js", "**/*.cjs", "**/*.mjs"];
9
28
  if (config.typescript) {
10
29
  files.push("**/*.ts", "**/*.cts", "**/*.mts");
@@ -1,8 +1,9 @@
1
- import nPlugin from "eslint-plugin-n";
2
- let node = (config) => {
1
+ import { interopDefault } from "../utils.mjs";
2
+ let node = async (config) => {
3
3
  if (!config.node) {
4
4
  return {};
5
5
  }
6
+ let nPlugin = await interopDefault(import("eslint-plugin-n"));
6
7
  let files = ["**/*.js", "**/*.cjs", "**/*.mjs"];
7
8
  if (config.typescript) {
8
9
  files.push("**/*.ts", "**/*.cts", "**/*.mts");
@@ -1,10 +1,31 @@
1
1
  "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (let key of __getOwnPropNames(from))
11
+ if (!__hasOwnProp.call(to, key) && key !== except)
12
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
+ }
14
+ return to;
15
+ };
16
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
18
+ mod
19
+ ));
2
20
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const perfectionistPlugin = require("eslint-plugin-perfectionist");
4
- let perfectionist = (config) => {
21
+ const utils = require("../utils.cjs");
22
+ let perfectionist = async (config) => {
5
23
  if (!config.perfectionist) {
6
24
  return {};
7
25
  }
26
+ let perfectionistPlugin = await utils.interopDefault(
27
+ import("eslint-plugin-perfectionist")
28
+ );
8
29
  let files = ["**/*.js", "**/*.cjs", "**/*.mjs"];
9
30
  if (config.typescript) {
10
31
  files.push("**/*.ts", "**/*.cts", "**/*.mts");
@@ -1,8 +1,11 @@
1
- import perfectionistPlugin from "eslint-plugin-perfectionist";
2
- let perfectionist = (config) => {
1
+ import { interopDefault } from "../utils.mjs";
2
+ let perfectionist = async (config) => {
3
3
  if (!config.perfectionist) {
4
4
  return {};
5
5
  }
6
+ let perfectionistPlugin = await interopDefault(
7
+ import("eslint-plugin-perfectionist")
8
+ );
6
9
  let files = ["**/*.js", "**/*.cjs", "**/*.mjs"];
7
10
  if (config.typescript) {
8
11
  files.push("**/*.ts", "**/*.cts", "**/*.mts");
@@ -1,10 +1,29 @@
1
1
  "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (let key of __getOwnPropNames(from))
11
+ if (!__hasOwnProp.call(to, key) && key !== except)
12
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
+ }
14
+ return to;
15
+ };
16
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
18
+ mod
19
+ ));
2
20
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const qwikPlugin = require("eslint-plugin-qwik");
4
- let qwik = (config) => {
21
+ const utils = require("../utils.cjs");
22
+ let qwik = async (config) => {
5
23
  if (!config.qwik) {
6
24
  return {};
7
25
  }
26
+ let qwikPlugin = await utils.interopDefault(import("eslint-plugin-qwik"));
8
27
  let files = ["**/*.jsx"];
9
28
  if (config.typescript) {
10
29
  files.push("**/*.tsx");
@@ -1,8 +1,9 @@
1
- import qwikPlugin from "eslint-plugin-qwik";
2
- let qwik = (config) => {
1
+ import { interopDefault } from "../utils.mjs";
2
+ let qwik = async (config) => {
3
3
  if (!config.qwik) {
4
4
  return {};
5
5
  }
6
+ let qwikPlugin = await interopDefault(import("eslint-plugin-qwik"));
6
7
  let files = ["**/*.jsx"];
7
8
  if (config.typescript) {
8
9
  files.push("**/*.tsx");
@@ -1,13 +1,34 @@
1
1
  "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (let key of __getOwnPropNames(from))
11
+ if (!__hasOwnProp.call(to, key) && key !== except)
12
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
+ }
14
+ return to;
15
+ };
16
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
18
+ mod
19
+ ));
2
20
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const reactCompilerPlugin = require("eslint-plugin-react-compiler");
4
- const reactHooksPlugin = require("eslint-plugin-react-hooks");
5
- const reactPerfPlugin = require("eslint-plugin-react-perf");
6
- const reactPlugin = require("eslint-plugin-react");
7
- let react = (config) => {
21
+ const utils = require("../utils.cjs");
22
+ let react = async (config) => {
8
23
  if (!config.react) {
9
24
  return {};
10
25
  }
26
+ let [reactCompilerPlugin, reactHooksPlugin, reactPerfPlugin, reactPlugin] = await Promise.all([
27
+ utils.interopDefault(import("eslint-plugin-react-compiler")),
28
+ utils.interopDefault(import("eslint-plugin-react-hooks")),
29
+ utils.interopDefault(import("eslint-plugin-react-perf")),
30
+ utils.interopDefault(import("eslint-plugin-react"))
31
+ ]);
11
32
  let files = ["**/*.jsx"];
12
33
  if (config.typescript) {
13
34
  files.push("**/*.tsx");
@@ -1,11 +1,14 @@
1
- import reactCompilerPlugin from "eslint-plugin-react-compiler";
2
- import reactHooksPlugin from "eslint-plugin-react-hooks";
3
- import reactPerfPlugin from "eslint-plugin-react-perf";
4
- import reactPlugin from "eslint-plugin-react";
5
- let react = (config) => {
1
+ import { interopDefault } from "../utils.mjs";
2
+ let react = async (config) => {
6
3
  if (!config.react) {
7
4
  return {};
8
5
  }
6
+ let [reactCompilerPlugin, reactHooksPlugin, reactPerfPlugin, reactPlugin] = await Promise.all([
7
+ interopDefault(import("eslint-plugin-react-compiler")),
8
+ interopDefault(import("eslint-plugin-react-hooks")),
9
+ interopDefault(import("eslint-plugin-react-perf")),
10
+ interopDefault(import("eslint-plugin-react"))
11
+ ]);
9
12
  let files = ["**/*.jsx"];
10
13
  if (config.typescript) {
11
14
  files.push("**/*.tsx");
@@ -1,18 +1,39 @@
1
1
  "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (let key of __getOwnPropNames(from))
11
+ if (!__hasOwnProp.call(to, key) && key !== except)
12
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
+ }
14
+ return to;
15
+ };
16
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
18
+ mod
19
+ ));
2
20
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const typescriptEslint = require("typescript-eslint");
4
- const svelteParser = require("svelte-eslint-parser");
5
- const sveltePlugin = require("eslint-plugin-svelte");
6
- let svelte = (config) => {
21
+ const utils = require("../utils.cjs");
22
+ let svelte = async (config) => {
7
23
  if (!config.svelte) {
8
24
  return {};
9
25
  }
10
26
  let files = ["**/*.svelte"];
27
+ let [sveltePlugin, svelteParser] = await Promise.all([
28
+ utils.interopDefault(import("eslint-plugin-svelte")),
29
+ utils.interopDefault(import("svelte-eslint-parser"))
30
+ ]);
11
31
  let additionalParserOptions = {};
12
32
  if (config.typescript) {
33
+ let typescriptParser = await utils.interopDefault(import("typescript-eslint"));
13
34
  additionalParserOptions = {
14
35
  ...additionalParserOptions,
15
- parser: typescriptEslint.parser,
36
+ parser: typescriptParser,
16
37
  projectService: true,
17
38
  tsconfigRootDir: process.cwd()
18
39
  };
@@ -1,16 +1,19 @@
1
- import { parser } from "typescript-eslint";
2
- import svelteParser from "svelte-eslint-parser";
3
- import sveltePlugin from "eslint-plugin-svelte";
4
- let svelte = (config) => {
1
+ import { interopDefault } from "../utils.mjs";
2
+ let svelte = async (config) => {
5
3
  if (!config.svelte) {
6
4
  return {};
7
5
  }
8
6
  let files = ["**/*.svelte"];
7
+ let [sveltePlugin, svelteParser] = await Promise.all([
8
+ interopDefault(import("eslint-plugin-svelte")),
9
+ interopDefault(import("svelte-eslint-parser"))
10
+ ]);
9
11
  let additionalParserOptions = {};
10
12
  if (config.typescript) {
13
+ let typescriptParser = await interopDefault(import("typescript-eslint"));
11
14
  additionalParserOptions = {
12
15
  ...additionalParserOptions,
13
- parser,
16
+ parser: typescriptParser,
14
17
  projectService: true,
15
18
  tsconfigRootDir: process.cwd()
16
19
  };
@@ -1,10 +1,29 @@
1
1
  "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (let key of __getOwnPropNames(from))
11
+ if (!__hasOwnProp.call(to, key) && key !== except)
12
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
+ }
14
+ return to;
15
+ };
16
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
18
+ mod
19
+ ));
2
20
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const typescriptEslint = require("typescript-eslint");
4
- let typescript = (config) => {
21
+ const utils = require("../utils.cjs");
22
+ let typescript = async (config) => {
5
23
  if (!config.typescript) {
6
24
  return {};
7
25
  }
26
+ let { parser: typescriptParser, plugin: typescriptPlugin } = await utils.interopDefault(import("typescript-eslint"));
8
27
  let files = ["**/*.ts", "**/*.cts", "**/*.mts"];
9
28
  if (config.react || config.qwik) {
10
29
  files.push("**/*.tsx");
@@ -21,7 +40,7 @@ let typescript = (config) => {
21
40
  return {
22
41
  files,
23
42
  languageOptions: {
24
- parser: typescriptEslint.parser,
43
+ parser: typescriptParser,
25
44
  parserOptions: {
26
45
  ecmaFeatures: {
27
46
  jsx: config.react || config.qwik
@@ -33,7 +52,7 @@ let typescript = (config) => {
33
52
  }
34
53
  },
35
54
  plugins: {
36
- "@typescript-eslint": typescriptEslint.plugin
55
+ "@typescript-eslint": typescriptPlugin
37
56
  },
38
57
  rules: {
39
58
  "@typescript-eslint/array-type": [
@@ -1,8 +1,9 @@
1
- import { plugin, parser } from "typescript-eslint";
2
- let typescript = (config) => {
1
+ import { interopDefault } from "../utils.mjs";
2
+ let typescript = async (config) => {
3
3
  if (!config.typescript) {
4
4
  return {};
5
5
  }
6
+ let { parser: typescriptParser, plugin: typescriptPlugin } = await interopDefault(import("typescript-eslint"));
6
7
  let files = ["**/*.ts", "**/*.cts", "**/*.mts"];
7
8
  if (config.react || config.qwik) {
8
9
  files.push("**/*.tsx");
@@ -19,7 +20,7 @@ let typescript = (config) => {
19
20
  return {
20
21
  files,
21
22
  languageOptions: {
22
- parser,
23
+ parser: typescriptParser,
23
24
  parserOptions: {
24
25
  ecmaFeatures: {
25
26
  jsx: config.react || config.qwik
@@ -31,7 +32,7 @@ let typescript = (config) => {
31
32
  }
32
33
  },
33
34
  plugins: {
34
- "@typescript-eslint": plugin
35
+ "@typescript-eslint": typescriptPlugin
35
36
  },
36
37
  rules: {
37
38
  "@typescript-eslint/array-type": [
package/dist/utils.cjs ADDED
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ let interopDefault = async (module2) => {
4
+ try {
5
+ let resolved = await module2;
6
+ if (typeof resolved === "object" && resolved !== null) {
7
+ if ("default" in resolved && Object.keys(resolved).length === 1) {
8
+ let defaultExport = resolved.default;
9
+ if (!defaultExport) {
10
+ return defaultExport;
11
+ }
12
+ return defaultExport;
13
+ }
14
+ return resolved;
15
+ }
16
+ return resolved;
17
+ } catch (error) {
18
+ throw new Error(`Cannot import module: ${String(error)}`);
19
+ }
20
+ };
21
+ exports.interopDefault = interopDefault;
package/dist/utils.mjs ADDED
@@ -0,0 +1,21 @@
1
+ let interopDefault = async (module) => {
2
+ try {
3
+ let resolved = await module;
4
+ if (typeof resolved === "object" && resolved !== null) {
5
+ if ("default" in resolved && Object.keys(resolved).length === 1) {
6
+ let defaultExport = resolved.default;
7
+ if (!defaultExport) {
8
+ return defaultExport;
9
+ }
10
+ return defaultExport;
11
+ }
12
+ return resolved;
13
+ }
14
+ return resolved;
15
+ } catch (error) {
16
+ throw new Error(`Cannot import module: ${String(error)}`);
17
+ }
18
+ };
19
+ export {
20
+ interopDefault
21
+ };
@@ -1,10 +1,29 @@
1
1
  "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (let key of __getOwnPropNames(from))
11
+ if (!__hasOwnProp.call(to, key) && key !== except)
12
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
+ }
14
+ return to;
15
+ };
16
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
18
+ mod
19
+ ));
2
20
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const vitestPlugin = require("@vitest/eslint-plugin");
4
- let vitest = (config) => {
21
+ const utils = require("../utils.cjs");
22
+ let vitest = async (config) => {
5
23
  if (!config.vitest) {
6
24
  return {};
7
25
  }
26
+ let vitestPlugin = await utils.interopDefault(import("@vitest/eslint-plugin"));
8
27
  let files = [
9
28
  "**/test/*.js",
10
29
  "**/test/*.cjs",
@@ -1,8 +1,9 @@
1
- import vitestPlugin from "@vitest/eslint-plugin";
2
- let vitest = (config) => {
1
+ import { interopDefault } from "../utils.mjs";
2
+ let vitest = async (config) => {
3
3
  if (!config.vitest) {
4
4
  return {};
5
5
  }
6
+ let vitestPlugin = await interopDefault(import("@vitest/eslint-plugin"));
6
7
  let files = [
7
8
  "**/test/*.js",
8
9
  "**/test/*.cjs",
@@ -1,18 +1,39 @@
1
1
  "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (let key of __getOwnPropNames(from))
11
+ if (!__hasOwnProp.call(to, key) && key !== except)
12
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
+ }
14
+ return to;
15
+ };
16
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
18
+ mod
19
+ ));
2
20
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const typescriptEslint = require("typescript-eslint");
4
- const vuePlugin = require("eslint-plugin-vue");
5
- const vueParser = require("vue-eslint-parser");
6
- let vue = (config) => {
21
+ const utils = require("../utils.cjs");
22
+ let vue = async (config) => {
7
23
  if (!config.vue) {
8
24
  return {};
9
25
  }
26
+ let [vuePlugin, vueParser] = await Promise.all([
27
+ utils.interopDefault(import("eslint-plugin-vue")),
28
+ utils.interopDefault(import("vue-eslint-parser"))
29
+ ]);
10
30
  let files = ["**/*.vue"];
11
31
  let additionalParserOptions = {};
12
32
  if (config.typescript) {
33
+ let typescriptParser = await utils.interopDefault(import("typescript-eslint"));
13
34
  additionalParserOptions = {
14
35
  ...additionalParserOptions,
15
- parser: typescriptEslint.parser,
36
+ parser: typescriptParser,
16
37
  projectService: true,
17
38
  tsconfigRootDir: process.cwd()
18
39
  };
@@ -1,16 +1,19 @@
1
- import { parser } from "typescript-eslint";
2
- import vuePlugin from "eslint-plugin-vue";
3
- import vueParser from "vue-eslint-parser";
4
- let vue = (config) => {
1
+ import { interopDefault } from "../utils.mjs";
2
+ let vue = async (config) => {
5
3
  if (!config.vue) {
6
4
  return {};
7
5
  }
6
+ let [vuePlugin, vueParser] = await Promise.all([
7
+ interopDefault(import("eslint-plugin-vue")),
8
+ interopDefault(import("vue-eslint-parser"))
9
+ ]);
8
10
  let files = ["**/*.vue"];
9
11
  let additionalParserOptions = {};
10
12
  if (config.typescript) {
13
+ let typescriptParser = await interopDefault(import("typescript-eslint"));
11
14
  additionalParserOptions = {
12
15
  ...additionalParserOptions,
13
- parser,
16
+ parser: typescriptParser,
14
17
  projectService: true,
15
18
  tsconfigRootDir: process.cwd()
16
19
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azat-io/eslint-config",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "description": "ESLint shareable config",
5
5
  "keywords": [
6
6
  "eslint",