@santi020k/eslint-config-lite 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,12 @@
1
+ import { Library, Tool, Testing, Format, Extension, FlatConfigArray } from '@santi020k/eslint-config-core';
2
+
3
+ /**
4
+ * Gets integration configs from the optional integrations package.
5
+ */
6
+ declare const getIntegrationConfigs: (libraries: Library[], tools: Tool[], testing: Testing[], formats: Format[], extensions: Extension[]) => Promise<FlatConfigArray>;
7
+ /**
8
+ * Returns the Prettier configuration if selected.
9
+ */
10
+ declare const getPrettierConfig: (tools: Tool[]) => Promise<FlatConfigArray>;
11
+
12
+ export { getIntegrationConfigs, getPrettierConfig };
@@ -0,0 +1,41 @@
1
+ import {
2
+ Tool
3
+ } from "@santi020k/eslint-config-core";
4
+ import { loadModule } from "./lazy.js";
5
+ const hasRequestedIntegrations = (libraries, tools, testing, formats, extensions) => libraries.length > 0 || tools.length > 0 || testing.length > 0 || formats.length > 0 || extensions.length > 0;
6
+ let integrationsModule;
7
+ const loadIntegrations = async () => {
8
+ integrationsModule ?? (integrationsModule = loadModule("@santi020k/eslint-config-integrations"));
9
+ try {
10
+ return await integrationsModule;
11
+ } catch (error) {
12
+ throw new Error(
13
+ 'Unable to load optional package "@santi020k/eslint-config-integrations". Install it when using lite package integrations, or remove the selected integrations from your eslintConfig options.',
14
+ { cause: error }
15
+ );
16
+ }
17
+ };
18
+ const getIntegrationConfigs = async (libraries, tools, testing, formats, extensions) => {
19
+ if (!hasRequestedIntegrations(libraries, tools, testing, formats, extensions)) return [];
20
+ const module = await loadIntegrations();
21
+ if (!module.getIntegrationConfigs) {
22
+ throw new Error(
23
+ 'Installed "@santi020k/eslint-config-integrations" does not export getIntegrationConfigs. Update it to a compatible version.'
24
+ );
25
+ }
26
+ return module.getIntegrationConfigs(libraries, tools, testing, formats, extensions);
27
+ };
28
+ const getPrettierConfig = async (tools) => {
29
+ if (!tools.includes(Tool.Prettier)) return [];
30
+ const module = await loadIntegrations();
31
+ if (!module.getPrettierConfig) {
32
+ throw new Error(
33
+ 'Installed "@santi020k/eslint-config-integrations" does not export getPrettierConfig. Update it to a compatible version.'
34
+ );
35
+ }
36
+ return module.getPrettierConfig(tools);
37
+ };
38
+ export {
39
+ getIntegrationConfigs,
40
+ getPrettierConfig
41
+ };
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,9 @@
1
+ const isVitest = typeof process !== "undefined" && process.env.VITEST;
2
+ const dynamicImport = isVitest ? (specifier) => import(
3
+ /* @vite-ignore */
4
+ specifier
5
+ ) : Reflect.construct(Function, ["specifier", "return import(specifier)"]);
6
+ const loadModule = async (specifier) => await dynamicImport(specifier);
7
+ export {
8
+ loadModule
9
+ };
@@ -0,0 +1,15 @@
1
+ import { DetectedFrameworkName, ImportedFramework, FlatConfigArray, Preset, EslintConfigOptions } from '@santi020k/eslint-config-core';
2
+ import { FrameworkOptions } from './frameworks.js';
3
+
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.
8
+ */
9
+ declare const resolveFramework: (frameworkName: DetectedFrameworkName, framework?: ImportedFramework, options?: FrameworkOptions) => Promise<FlatConfigArray>;
10
+ /**
11
+ * Resolves a preset into options
12
+ */
13
+ declare const resolvePreset: (preset: Preset) => Partial<EslintConfigOptions>;
14
+
15
+ export { resolveFramework, resolvePreset };
@@ -0,0 +1,96 @@
1
+ import {
2
+ Extension,
3
+ Format,
4
+ Library,
5
+ Preset,
6
+ Runtime,
7
+ Testing,
8
+ Tool
9
+ } from "@santi020k/eslint-config-core";
10
+ import { getBundledFrameworkConfig } from "./frameworks.js";
11
+ const resolveFramework = async (frameworkName, framework, options) => {
12
+ if (!framework) return [];
13
+ if (framework === true) {
14
+ return getBundledFrameworkConfig(frameworkName, options);
15
+ }
16
+ if (typeof framework === "function") {
17
+ return framework(options);
18
+ }
19
+ if (typeof framework === "object" && "default" in framework) {
20
+ if (typeof framework.default === "function") {
21
+ return framework.default(options);
22
+ }
23
+ return framework.default;
24
+ }
25
+ if (Array.isArray(framework)) return framework;
26
+ throw new TypeError(
27
+ `[ESLint Config Lite] Invalid framework config for "${frameworkName}". Use true to enable the bundled config, or pass a config array/factory/default export.`
28
+ );
29
+ };
30
+ const resolvePreset = (preset) => {
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
+ };
49
+ case Preset.Basic:
50
+ return { runtime: Runtime.Universal };
51
+ case Preset.Browser:
52
+ return {
53
+ runtime: Runtime.Browser,
54
+ typescript: true
55
+ };
56
+ case Preset.CI:
57
+ return {
58
+ extensions: [Extension.BestPractices],
59
+ runtime: Runtime.Universal,
60
+ strict: "ci",
61
+ tools: [Tool.Prettier],
62
+ typescript: true
63
+ };
64
+ case Preset.Library:
65
+ return {
66
+ extensions: [Extension.BestPractices],
67
+ runtime: Runtime.Node,
68
+ tools: [Tool.Prettier],
69
+ typescript: true
70
+ };
71
+ case Preset.Monorepo:
72
+ return {
73
+ extensions: [Extension.BestPractices],
74
+ runtime: Runtime.Universal,
75
+ tools: [Tool.Prettier],
76
+ typescript: true
77
+ };
78
+ case Preset.Node:
79
+ return {
80
+ runtime: Runtime.Node,
81
+ typescript: true
82
+ };
83
+ case Preset.Worker:
84
+ return {
85
+ runtime: Runtime.Worker,
86
+ typescript: true
87
+ };
88
+ // v8 ignore next 2 -- TypeScript exhausts all Preset values; default is unreachable
89
+ default:
90
+ return {};
91
+ }
92
+ };
93
+ export {
94
+ resolveFramework,
95
+ resolvePreset
96
+ };
package/package.json ADDED
@@ -0,0 +1,167 @@
1
+ {
2
+ "name": "@santi020k/eslint-config-lite",
3
+ "version": "2.0.0-beta.0",
4
+ "publishConfig": {
5
+ "access": "public"
6
+ },
7
+ "description": "Lite ESLint flat-config composer with manual framework and integration package installs.",
8
+ "type": "module",
9
+ "main": "./dist/index.js",
10
+ "module": "./dist/index.js",
11
+ "types": "./dist/index.d.ts",
12
+ "sideEffects": false,
13
+ "exports": {
14
+ ".": {
15
+ "types": "./dist/index.d.ts",
16
+ "import": "./dist/index.js"
17
+ }
18
+ },
19
+ "files": [
20
+ "dist",
21
+ "README.md",
22
+ "CHANGELOG.md"
23
+ ],
24
+ "dependencies": {
25
+ "@typescript-eslint/utils": "^8.61.1",
26
+ "@santi020k/eslint-config-core": "^2.0.0-beta.0",
27
+ "@santi020k/eslint-config-typescript": "^2.0.0-beta.0"
28
+ },
29
+ "devDependencies": {
30
+ "publint": "^0.3.21",
31
+ "tsup": "^8.5.1",
32
+ "typescript": "^6.0.3",
33
+ "@santi020k/eslint-config-angular": "^2.0.0-beta.0",
34
+ "@santi020k/eslint-config-astro": "^2.0.0-beta.0",
35
+ "@santi020k/eslint-config-expo": "^2.0.0-beta.0",
36
+ "@santi020k/eslint-config-hono": "^2.0.0-beta.0",
37
+ "@santi020k/eslint-config-integrations": "^2.0.0-beta.0",
38
+ "@santi020k/eslint-config-lit": "^2.0.0-beta.0",
39
+ "@santi020k/eslint-config-nest": "^2.0.0-beta.0",
40
+ "@santi020k/eslint-config-next": "^2.0.0-beta.0",
41
+ "@santi020k/eslint-config-nuxt": "^2.0.0-beta.0",
42
+ "@santi020k/eslint-config-preact": "^2.0.0-beta.0",
43
+ "@santi020k/eslint-config-qwik": "^2.0.0-beta.0",
44
+ "@santi020k/eslint-config-react": "^2.0.0-beta.0",
45
+ "@santi020k/eslint-config-react-router": "^2.0.0-beta.0",
46
+ "@santi020k/eslint-config-remix": "^2.0.0-beta.0",
47
+ "@santi020k/eslint-config-slidev": "^2.0.0-beta.0",
48
+ "@santi020k/eslint-config-solid": "^2.0.0-beta.0",
49
+ "@santi020k/eslint-config-svelte": "^2.0.0-beta.0",
50
+ "@santi020k/eslint-config-tanstack-start": "^2.0.0-beta.0",
51
+ "@santi020k/eslint-config-vite": "^2.0.0-beta.0",
52
+ "@santi020k/eslint-config-vue": "^2.0.0-beta.0"
53
+ },
54
+ "peerDependencies": {
55
+ "eslint": "^10.0.0",
56
+ "typescript": ">=5.0.0",
57
+ "@santi020k/eslint-config-angular": "^2.0.0-beta.0",
58
+ "@santi020k/eslint-config-astro": "^2.0.0-beta.0",
59
+ "@santi020k/eslint-config-expo": "^2.0.0-beta.0",
60
+ "@santi020k/eslint-config-hono": "^2.0.0-beta.0",
61
+ "@santi020k/eslint-config-integrations": "^2.0.0-beta.0",
62
+ "@santi020k/eslint-config-lit": "^2.0.0-beta.0",
63
+ "@santi020k/eslint-config-nest": "^2.0.0-beta.0",
64
+ "@santi020k/eslint-config-next": "^2.0.0-beta.0",
65
+ "@santi020k/eslint-config-nuxt": "^2.0.0-beta.0",
66
+ "@santi020k/eslint-config-preact": "^2.0.0-beta.0",
67
+ "@santi020k/eslint-config-qwik": "^2.0.0-beta.0",
68
+ "@santi020k/eslint-config-react": "^2.0.0-beta.0",
69
+ "@santi020k/eslint-config-react-router": "^2.0.0-beta.0",
70
+ "@santi020k/eslint-config-remix": "^2.0.0-beta.0",
71
+ "@santi020k/eslint-config-slidev": "^2.0.0-beta.0",
72
+ "@santi020k/eslint-config-solid": "^2.0.0-beta.0",
73
+ "@santi020k/eslint-config-svelte": "^2.0.0-beta.0",
74
+ "@santi020k/eslint-config-tanstack-start": "^2.0.0-beta.0",
75
+ "@santi020k/eslint-config-vite": "^2.0.0-beta.0",
76
+ "@santi020k/eslint-config-vue": "^2.0.0-beta.0"
77
+ },
78
+ "peerDependenciesMeta": {
79
+ "@santi020k/eslint-config-angular": {
80
+ "optional": true
81
+ },
82
+ "@santi020k/eslint-config-astro": {
83
+ "optional": true
84
+ },
85
+ "@santi020k/eslint-config-expo": {
86
+ "optional": true
87
+ },
88
+ "@santi020k/eslint-config-hono": {
89
+ "optional": true
90
+ },
91
+ "@santi020k/eslint-config-integrations": {
92
+ "optional": true
93
+ },
94
+ "@santi020k/eslint-config-lit": {
95
+ "optional": true
96
+ },
97
+ "@santi020k/eslint-config-nest": {
98
+ "optional": true
99
+ },
100
+ "@santi020k/eslint-config-next": {
101
+ "optional": true
102
+ },
103
+ "@santi020k/eslint-config-nuxt": {
104
+ "optional": true
105
+ },
106
+ "@santi020k/eslint-config-preact": {
107
+ "optional": true
108
+ },
109
+ "@santi020k/eslint-config-qwik": {
110
+ "optional": true
111
+ },
112
+ "@santi020k/eslint-config-react": {
113
+ "optional": true
114
+ },
115
+ "@santi020k/eslint-config-react-router": {
116
+ "optional": true
117
+ },
118
+ "@santi020k/eslint-config-remix": {
119
+ "optional": true
120
+ },
121
+ "@santi020k/eslint-config-slidev": {
122
+ "optional": true
123
+ },
124
+ "@santi020k/eslint-config-solid": {
125
+ "optional": true
126
+ },
127
+ "@santi020k/eslint-config-svelte": {
128
+ "optional": true
129
+ },
130
+ "@santi020k/eslint-config-tanstack-start": {
131
+ "optional": true
132
+ },
133
+ "@santi020k/eslint-config-vite": {
134
+ "optional": true
135
+ },
136
+ "@santi020k/eslint-config-vue": {
137
+ "optional": true
138
+ },
139
+ "typescript": {
140
+ "optional": true
141
+ }
142
+ },
143
+ "engines": {
144
+ "node": ">=22.18.0"
145
+ },
146
+ "repository": {
147
+ "type": "git",
148
+ "url": "git+https://github.com/santi020k/eslint-config-basic.git",
149
+ "directory": "packages/lite"
150
+ },
151
+ "homepage": "https://eslint.santi020k.com/packages/lite.html",
152
+ "bugs": {
153
+ "url": "https://github.com/santi020k/eslint-config-basic/issues"
154
+ },
155
+ "author": "santi020k",
156
+ "license": "MIT",
157
+ "scripts": {
158
+ "build": "tsup",
159
+ "build:pack": "npm pack",
160
+ "dev": "tsup --watch",
161
+ "clean": "rm -rf dist",
162
+ "check:exports": "publint",
163
+ "typecheck": "tsc --noEmit",
164
+ "lint": "eslint . --no-warn-ignored --pass-on-no-patterns",
165
+ "lint:fix": "eslint . --fix --no-warn-ignored --pass-on-no-patterns"
166
+ }
167
+ }