@santi020k/eslint-config-basic 1.6.0 → 2.0.0-beta.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.
@@ -0,0 +1 @@
1
+ export { getIntegrationConfigs, getPrettierConfig } from '@santi020k/eslint-config-integrations';
@@ -0,0 +1,5 @@
1
+ import { getIntegrationConfigs, getPrettierConfig } from "@santi020k/eslint-config-integrations";
2
+ export {
3
+ getIntegrationConfigs,
4
+ getPrettierConfig
5
+ };
package/dist/lazy.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ declare const loadModule: <T = unknown>(specifier: string) => Promise<T>;
2
+
3
+ export { loadModule };
package/dist/lazy.js ADDED
@@ -0,0 +1,19 @@
1
+ import { createRequire } from "node:module";
2
+ import { pathToFileURL } from "node:url";
3
+ const isVitest = typeof process !== "undefined" && process.env.VITEST;
4
+ const dynamicImport = isVitest ? (specifier) => import(
5
+ /* @vite-ignore */
6
+ specifier
7
+ ) : Reflect.construct(Function, ["specifier", "return import(specifier)"]);
8
+ const req = createRequire(import.meta.url);
9
+ const loadModule = async (specifier) => {
10
+ let resolved = specifier;
11
+ try {
12
+ resolved = pathToFileURL(req.resolve(specifier)).href;
13
+ } catch {
14
+ }
15
+ return await dynamicImport(resolved);
16
+ };
17
+ export {
18
+ loadModule
19
+ };
@@ -1,9 +1,12 @@
1
- import { ImportedFramework, FlatConfigArray, Preset, EslintConfigOptions } from '@santi020k/eslint-config-core';
1
+ import { DetectedFrameworkName, ImportedFramework, FlatConfigArray, Preset, EslintConfigOptions } from '@santi020k/eslint-config-core';
2
+ import { FrameworkOptions } from './frameworks.js';
2
3
 
3
4
  /**
4
5
  * Resolves an imported framework (either array, object with default, or factory function) into a config array.
6
+ * Bundled configs (`true`) and async factories are loaded lazily, so framework
7
+ * packages are only imported when actually enabled.
5
8
  */
6
- declare const resolveFramework: (frameworkName: string, framework?: ImportedFramework, options?: Record<string, unknown>) => FlatConfigArray;
9
+ declare const resolveFramework: (frameworkName: DetectedFrameworkName, framework?: ImportedFramework, options?: FrameworkOptions) => Promise<FlatConfigArray>;
7
10
  /**
8
11
  * Resolves a preset into options
9
12
  */
package/dist/resolvers.js CHANGED
@@ -7,12 +7,11 @@ import {
7
7
  Testing,
8
8
  Tool
9
9
  } from "@santi020k/eslint-config-core";
10
- const resolveFramework = (frameworkName, framework, options) => {
10
+ import { getBundledFrameworkConfig } from "./frameworks.js";
11
+ const resolveFramework = async (frameworkName, framework, options) => {
11
12
  if (!framework) return [];
12
13
  if (framework === true) {
13
- throw new TypeError(
14
- `Framework "${frameworkName}" requires an imported config. Install @santi020k/eslint-config-${frameworkName} and pass it via frameworks.${frameworkName}.`
15
- );
14
+ return getBundledFrameworkConfig(frameworkName, options);
16
15
  }
17
16
  if (typeof framework === "function") {
18
17
  return framework(options);
@@ -21,39 +20,77 @@ const resolveFramework = (frameworkName, framework, options) => {
21
20
  if (typeof framework.default === "function") {
22
21
  return framework.default(options);
23
22
  }
24
- return framework.default;
23
+ if (Array.isArray(framework.default)) return framework.default;
25
24
  }
26
- return Array.isArray(framework) ? framework : [];
25
+ if (Array.isArray(framework)) return framework;
26
+ throw new TypeError(
27
+ `[ESLint Basic] Invalid framework config for "${frameworkName}". Use true to enable the bundled config, or pass a config array/factory/default export.`
28
+ );
27
29
  };
28
30
  const resolvePreset = (preset) => {
29
31
  switch (preset) {
32
+ case Preset.All:
33
+ return {
34
+ extensions: Object.values(Extension),
35
+ formats: Object.values(Format),
36
+ libraries: Object.values(Library),
37
+ runtime: Runtime.Universal,
38
+ testing: Object.values(Testing),
39
+ tools: Object.values(Tool),
40
+ typescript: true
41
+ };
42
+ case Preset.App:
43
+ return {
44
+ runtime: Runtime.Browser,
45
+ testing: [Testing.Vitest],
46
+ tools: [Tool.Prettier],
47
+ typescript: true
48
+ };
30
49
  case Preset.Basic:
31
- return { runtime: Runtime.Universal };
32
- case Preset.Node:
33
50
  return {
34
- typescript: true,
35
- runtime: Runtime.Node
51
+ extensions: [Extension.Unicorn, Extension.Perfectionist, Extension.Security],
52
+ formats: [Format.Mdx, Format.Markdown, Format.Jsonc, Format.Yaml, Format.Toml],
53
+ runtime: Runtime.Universal,
54
+ tools: [Tool.Prettier]
36
55
  };
37
56
  case Preset.Browser:
38
57
  return {
39
- typescript: true,
40
- runtime: Runtime.Browser
58
+ runtime: Runtime.Browser,
59
+ typescript: true
41
60
  };
42
- case Preset.Worker:
61
+ case Preset.CI:
43
62
  return {
44
- typescript: true,
45
- runtime: Runtime.Worker
63
+ extensions: [Extension.BestPractices],
64
+ runtime: Runtime.Universal,
65
+ strict: "ci",
66
+ tools: [Tool.Prettier],
67
+ typescript: true
46
68
  };
47
- case Preset.All:
69
+ case Preset.Library:
48
70
  return {
49
- typescript: true,
50
- libraries: Object.values(Library),
51
- tools: Object.values(Tool),
52
- testing: Object.values(Testing),
53
- formats: Object.values(Format),
54
- extensions: Object.values(Extension),
55
- runtime: Runtime.Universal
71
+ extensions: [Extension.BestPractices],
72
+ runtime: Runtime.Node,
73
+ tools: [Tool.Prettier],
74
+ typescript: true
75
+ };
76
+ case Preset.Monorepo:
77
+ return {
78
+ extensions: [Extension.BestPractices],
79
+ runtime: Runtime.Universal,
80
+ tools: [Tool.Prettier],
81
+ typescript: true
82
+ };
83
+ case Preset.Node:
84
+ return {
85
+ runtime: Runtime.Node,
86
+ typescript: true
87
+ };
88
+ case Preset.Worker:
89
+ return {
90
+ runtime: Runtime.Worker,
91
+ typescript: true
56
92
  };
93
+ // v8 ignore next 2 -- TypeScript exhausts all Preset values; default is unreachable
57
94
  default:
58
95
  return {};
59
96
  }
package/package.json CHANGED
@@ -1,15 +1,23 @@
1
1
  {
2
2
  "name": "@santi020k/eslint-config-basic",
3
- "version": "1.6.0",
4
- "description": "A composable ESLint 9/10+ Flat Config package for JavaScript, TypeScript, React, Next.js, Vue, Svelte, Solid, Angular, Astro, Expo, NestJS, Hono, Qwik, and Remix.",
3
+ "version": "2.0.0-beta.0",
4
+ "publishConfig": {
5
+ "access": "public"
6
+ },
7
+ "description": "A composable ESLint 10+ Flat Config package for JavaScript, TypeScript, React, Next.js, Vue, Svelte, Solid, Angular, Astro, Expo, NestJS, Hono, Qwik, and Remix.",
5
8
  "type": "module",
6
9
  "main": "./dist/index.js",
7
10
  "module": "./dist/index.js",
8
11
  "types": "./dist/index.d.ts",
12
+ "sideEffects": false,
9
13
  "exports": {
10
14
  ".": {
11
15
  "types": "./dist/index.d.ts",
12
16
  "import": "./dist/index.js"
17
+ },
18
+ "./dist/index.js": {
19
+ "types": "./dist/index.d.ts",
20
+ "import": "./dist/index.js"
13
21
  }
14
22
  },
15
23
  "files": [
@@ -21,77 +29,47 @@
21
29
  "basic-eslint": "./dist/cli.js"
22
30
  },
23
31
  "dependencies": {
24
- "@typescript-eslint/utils": "^8.59.0",
25
- "eslint": "^10.2.1",
26
- "@santi020k/eslint-config-core": "^1.6.0",
27
- "@santi020k/eslint-config-optionals": "^1.6.0",
28
- "@santi020k/eslint-config-typescript": "^1.6.0"
32
+ "@typescript-eslint/utils": "^8.61.1",
33
+ "@santi020k/eslint-config-angular": "^2.0.0-beta.0",
34
+ "@santi020k/eslint-config-astro": "^2.0.0-beta.0",
35
+ "@santi020k/eslint-config-core": "^2.0.0-beta.0",
36
+ "@santi020k/eslint-config-expo": "^2.0.0-beta.0",
37
+ "@santi020k/eslint-config-hono": "^2.0.0-beta.0",
38
+ "@santi020k/eslint-config-integrations": "^2.0.0-beta.0",
39
+ "@santi020k/eslint-config-lit": "^2.0.0-beta.0",
40
+ "@santi020k/eslint-config-nest": "^2.0.0-beta.0",
41
+ "@santi020k/eslint-config-next": "^2.0.0-beta.0",
42
+ "@santi020k/eslint-config-nuxt": "^2.0.0-beta.0",
43
+ "@santi020k/eslint-config-preact": "^2.0.0-beta.0",
44
+ "@santi020k/eslint-config-qwik": "^2.0.0-beta.0",
45
+ "@santi020k/eslint-config-react": "^2.0.0-beta.0",
46
+ "@santi020k/eslint-config-react-router": "^2.0.0-beta.0",
47
+ "@santi020k/eslint-config-remix": "^2.0.0-beta.0",
48
+ "@santi020k/eslint-config-slidev": "^2.0.0-beta.0",
49
+ "@santi020k/eslint-config-solid": "^2.0.0-beta.0",
50
+ "@santi020k/eslint-config-svelte": "^2.0.0-beta.0",
51
+ "@santi020k/eslint-config-tanstack-start": "^2.0.0-beta.0",
52
+ "@santi020k/eslint-config-typescript": "^2.0.0-beta.0",
53
+ "@santi020k/eslint-config-vite": "^2.0.0-beta.0",
54
+ "@santi020k/eslint-config-vue": "^2.0.0-beta.0"
55
+ },
56
+ "devDependencies": {
57
+ "publint": "^0.3.21",
58
+ "tsup": "^8.5.1",
59
+ "typescript": "^6.0.3"
29
60
  },
30
61
  "peerDependencies": {
31
- "@santi020k/eslint-config-angular": "^1.6.0",
32
- "@santi020k/eslint-config-astro": "^1.6.0",
33
- "@santi020k/eslint-config-expo": "^1.6.0",
34
- "@santi020k/eslint-config-hono": "^1.6.0",
35
- "@santi020k/eslint-config-nest": "^1.6.0",
36
- "@santi020k/eslint-config-next": "^1.6.0",
37
- "@santi020k/eslint-config-qwik": "^1.6.0",
38
- "@santi020k/eslint-config-react": "^1.6.0",
39
- "@santi020k/eslint-config-remix": "^1.6.0",
40
- "@santi020k/eslint-config-solid": "^1.6.0",
41
- "@santi020k/eslint-config-svelte": "^1.6.0",
42
- "@santi020k/eslint-config-vue": "^1.6.0"
62
+ "eslint": "^10.0.0",
63
+ "typescript": ">=5.0.0"
43
64
  },
44
65
  "peerDependenciesMeta": {
45
- "@santi020k/eslint-config-angular": {
46
- "optional": true
47
- },
48
- "@santi020k/eslint-config-astro": {
49
- "optional": true
50
- },
51
- "@santi020k/eslint-config-expo": {
52
- "optional": true
53
- },
54
- "@santi020k/eslint-config-hono": {
55
- "optional": true
56
- },
57
- "@santi020k/eslint-config-nest": {
58
- "optional": true
59
- },
60
- "@santi020k/eslint-config-next": {
61
- "optional": true
62
- },
63
- "@santi020k/eslint-config-react": {
64
- "optional": true
65
- },
66
- "@santi020k/eslint-config-solid": {
67
- "optional": true
68
- },
69
- "@santi020k/eslint-config-svelte": {
70
- "optional": true
71
- },
72
- "@santi020k/eslint-config-vue": {
73
- "optional": true
74
- },
75
- "@santi020k/eslint-config-qwik": {
76
- "optional": true
77
- },
78
- "@santi020k/eslint-config-remix": {
66
+ "typescript": {
79
67
  "optional": true
80
68
  }
81
69
  },
82
- "devDependencies": {
83
- "publint": "^0.3.18",
84
- "tsup": "^8.5.1",
85
- "typescript": "^5.9.3"
86
- },
87
- "publishConfig": {
88
- "access": "public"
89
- },
90
70
  "engines": {
91
71
  "node": ">=22.18.0"
92
72
  },
93
- "license": "MIT",
94
- "author": "santi020k",
95
73
  "repository": {
96
74
  "type": "git",
97
75
  "url": "git+https://github.com/santi020k/eslint-config-basic.git",
@@ -101,12 +79,16 @@
101
79
  "bugs": {
102
80
  "url": "https://github.com/santi020k/eslint-config-basic/issues"
103
81
  },
82
+ "author": "santi020k",
83
+ "license": "MIT",
104
84
  "scripts": {
105
85
  "build": "tsup",
106
86
  "build:pack": "npm pack",
107
87
  "dev": "tsup --watch",
108
88
  "clean": "rm -rf dist",
109
89
  "check:exports": "publint",
110
- "typecheck": "tsc --noEmit"
90
+ "typecheck": "tsc --noEmit",
91
+ "lint": "eslint . --no-warn-ignored --pass-on-no-patterns",
92
+ "lint:fix": "eslint . --fix --no-warn-ignored --pass-on-no-patterns"
111
93
  }
112
94
  }
@@ -1,13 +0,0 @@
1
- import { Library, Tool, Testing, Format, Extension, FlatConfigArray } from '@santi020k/eslint-config-core';
2
-
3
- /**
4
- * Gets the optional configurations based on selected options.
5
- * This function maintains the recommended ordering (e.g. Prettier last).
6
- */
7
- declare const getOptionalConfigs: (libraries: Library[], tools: Tool[], testing: Testing[], formats: Format[], extensions: Extension[]) => FlatConfigArray;
8
- /**
9
- * Returns the Prettier configuration if selected.
10
- */
11
- declare const getPrettierConfig: (tools: Tool[]) => FlatConfigArray;
12
-
13
- export { getOptionalConfigs, getPrettierConfig };
package/dist/optionals.js DELETED
@@ -1,71 +0,0 @@
1
- import {
2
- Extension,
3
- Format,
4
- Library,
5
- Testing,
6
- Tool
7
- } from "@santi020k/eslint-config-core";
8
- import {
9
- bestPractices,
10
- cspell,
11
- cypress,
12
- graphql,
13
- i18next,
14
- jest,
15
- jsdoc,
16
- jsonc,
17
- markdown,
18
- mdx,
19
- perfectionist,
20
- playwright,
21
- prettier,
22
- regexp,
23
- security,
24
- sonarjs,
25
- stencil,
26
- storybook,
27
- swagger,
28
- tailwind,
29
- tanstackQuery,
30
- tanstackRouter,
31
- testingLibrary,
32
- toml,
33
- unicorn,
34
- vitest,
35
- yaml
36
- } from "@santi020k/eslint-config-optionals";
37
- const getOptionalConfigs = (libraries, tools, testing, formats, extensions) => {
38
- const configs = [];
39
- if (tools.includes(Tool.Cspell)) configs.push(...cspell);
40
- if (libraries.includes(Library.Tailwind)) configs.push(...tailwind);
41
- if (libraries.includes(Library.I18next)) configs.push(...i18next);
42
- if (libraries.includes(Library.Stencil)) configs.push(...stencil);
43
- if (libraries.includes(Library.TanstackQuery)) configs.push(...tanstackQuery);
44
- if (libraries.includes(Library.TanstackRouter)) configs.push(...tanstackRouter);
45
- if (libraries.includes(Library.Storybook)) configs.push(...storybook);
46
- if (testing.includes(Testing.Vitest)) configs.push(...vitest);
47
- if (testing.includes(Testing.Playwright)) configs.push(...playwright);
48
- if (testing.includes(Testing.Jest)) configs.push(...jest);
49
- if (testing.includes(Testing.Cypress)) configs.push(...cypress);
50
- if (testing.includes(Testing.TestingLibrary)) configs.push(...testingLibrary);
51
- if (formats.includes(Format.Mdx)) configs.push(...mdx);
52
- if (formats.includes(Format.Markdown)) configs.push(...markdown);
53
- if (formats.includes(Format.Jsonc)) configs.push(...jsonc);
54
- if (formats.includes(Format.Yaml)) configs.push(...yaml);
55
- if (formats.includes(Format.Toml)) configs.push(...toml);
56
- if (formats.includes(Format.Graphql)) configs.push(...graphql);
57
- if (extensions.includes(Extension.BestPractices)) configs.push(...bestPractices);
58
- if (extensions.includes(Extension.Regexp)) configs.push(...regexp);
59
- if (extensions.includes(Extension.Unicorn)) configs.push(...unicorn);
60
- if (extensions.includes(Extension.Sonarjs)) configs.push(...sonarjs);
61
- if (extensions.includes(Extension.Security)) configs.push(...security);
62
- if (extensions.includes(Extension.Perfectionist)) configs.push(...perfectionist);
63
- if (tools.includes(Tool.Jsdoc)) configs.push(...jsdoc);
64
- if (tools.includes(Tool.Swagger)) configs.push(...swagger);
65
- return configs;
66
- };
67
- const getPrettierConfig = (tools) => tools.includes(Tool.Prettier) ? prettier : [];
68
- export {
69
- getOptionalConfigs,
70
- getPrettierConfig
71
- };