@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.
package/dist/compose.d.ts CHANGED
@@ -1,8 +1,10 @@
1
1
  import { FlatConfigArray } from '@santi020k/eslint-config-core';
2
2
 
3
+ type NormalizedStrictMode = 'ci' | 'pedantic' | 'recommended';
4
+ declare const normalizeStrictMode: (strict: boolean | NormalizedStrictMode | undefined) => NormalizedStrictMode;
3
5
  /**
4
6
  * Applies strict mode by promoting all 'warn' rules to 'error'.
5
7
  */
6
- declare const applyStrictMode: (configs: FlatConfigArray, strict: boolean) => FlatConfigArray;
8
+ declare const applyStrictMode: (configs: FlatConfigArray, strict: boolean | NormalizedStrictMode | undefined) => FlatConfigArray;
7
9
 
8
- export { applyStrictMode };
10
+ export { type NormalizedStrictMode, applyStrictMode, normalizeStrictMode };
package/dist/compose.js CHANGED
@@ -1,3 +1,8 @@
1
+ const normalizeStrictMode = (strict) => {
2
+ if (strict === true) return "ci";
3
+ if (strict === "ci" || strict === "pedantic") return strict;
4
+ return "recommended";
5
+ };
1
6
  const promoteRuleSeverity = (value) => {
2
7
  if (value === void 0) return void 0;
3
8
  if (value === "warn" || value === 1) return "error";
@@ -7,17 +12,23 @@ const promoteRuleSeverity = (value) => {
7
12
  return value;
8
13
  };
9
14
  const applyStrictMode = (configs, strict) => {
10
- if (!strict) return configs;
11
- return configs.map((config) => {
12
- if (config.rules) {
15
+ const strictMode = normalizeStrictMode(strict);
16
+ if (strictMode === "recommended") return configs;
17
+ const recurse = (item) => {
18
+ if (Array.isArray(item)) {
19
+ return item.map((config) => recurse(config));
20
+ }
21
+ if (item.rules) {
13
22
  const strictRules = Object.fromEntries(
14
- Object.entries(config.rules).map(([key, value]) => [key, promoteRuleSeverity(value)])
23
+ Object.entries(item.rules).map(([key, value]) => [key, promoteRuleSeverity(value)])
15
24
  );
16
- return { ...config, rules: strictRules };
25
+ return { ...item, rules: strictRules };
17
26
  }
18
- return config;
19
- });
27
+ return item;
28
+ };
29
+ return recurse(configs);
20
30
  };
21
31
  export {
22
- applyStrictMode
32
+ applyStrictMode,
33
+ normalizeStrictMode
23
34
  };
@@ -0,0 +1,58 @@
1
+ import { DetectedFrameworkName, Runtime, FlatConfigArray } from '@santi020k/eslint-config-core';
2
+
3
+ type FrameworkFlags = Partial<Record<FrameworkName, true>>;
4
+ type FrameworkName = DetectedFrameworkName;
5
+ interface FrameworkOptions {
6
+ [key: string]: unknown;
7
+ hasReact?: boolean;
8
+ hasSolid?: boolean;
9
+ hasSvelte?: boolean;
10
+ hasVue?: boolean;
11
+ runtime?: Runtime;
12
+ }
13
+ declare const createDetectedFrameworkFlags: (detectedFrameworks?: DetectedFrameworkName[]) => FrameworkFlags;
14
+ declare const getBundledFrameworkConfig: (frameworkName: FrameworkName, options?: FrameworkOptions) => Promise<FlatConfigArray>;
15
+ declare const angular: (options?: FrameworkOptions) => Promise<FlatConfigArray>;
16
+ declare const astro: (options?: FrameworkOptions) => Promise<FlatConfigArray>;
17
+ declare const expo: (options?: FrameworkOptions) => Promise<FlatConfigArray>;
18
+ declare const hono: (options?: FrameworkOptions) => Promise<FlatConfigArray>;
19
+ declare const lit: (options?: FrameworkOptions) => Promise<FlatConfigArray>;
20
+ declare const nest: (options?: FrameworkOptions) => Promise<FlatConfigArray>;
21
+ declare const next: (options?: FrameworkOptions) => Promise<FlatConfigArray>;
22
+ declare const nuxt: (options?: FrameworkOptions) => Promise<FlatConfigArray>;
23
+ declare const preact: (options?: FrameworkOptions) => Promise<FlatConfigArray>;
24
+ declare const qwik: (options?: FrameworkOptions) => Promise<FlatConfigArray>;
25
+ declare const react: (options?: FrameworkOptions) => Promise<FlatConfigArray>;
26
+ declare const reactRouter: (options?: FrameworkOptions) => Promise<FlatConfigArray>;
27
+ declare const slidev: (options?: FrameworkOptions) => Promise<FlatConfigArray>;
28
+ declare const solid: (options?: FrameworkOptions) => Promise<FlatConfigArray>;
29
+ declare const svelte: (options?: FrameworkOptions) => Promise<FlatConfigArray>;
30
+ declare const tanstackStart: (options?: FrameworkOptions) => Promise<FlatConfigArray>;
31
+ declare const vite: (options?: FrameworkOptions) => Promise<FlatConfigArray>;
32
+ declare const vue: (options?: FrameworkOptions) => Promise<FlatConfigArray>;
33
+ /**
34
+ * @deprecated Remix merged into React Router v7. Use `reactRouter` (the
35
+ * `react-router` framework key) instead. This alias loads the legacy Remix
36
+ * config and will be removed in the next major version.
37
+ */
38
+ declare const remix: (options?: FrameworkOptions) => Promise<FlatConfigArray>;
39
+ /** @deprecated Use `angular` instead. */
40
+ declare const angularConfig: (options?: FrameworkOptions) => Promise<FlatConfigArray>;
41
+ /** @deprecated Use `expo` instead. */
42
+ declare const expoConfig: (options?: FrameworkOptions) => Promise<FlatConfigArray>;
43
+ /** @deprecated Use `nest` instead. */
44
+ declare const nestConfig: (options?: FrameworkOptions) => Promise<FlatConfigArray>;
45
+ /** @deprecated Use `next` instead. */
46
+ declare const nextConfig: (options?: FrameworkOptions) => Promise<FlatConfigArray>;
47
+ /** @deprecated Use `preact` instead. */
48
+ declare const preactConfig: (options?: FrameworkOptions) => Promise<FlatConfigArray>;
49
+ /** @deprecated Use `react` instead. */
50
+ declare const reactConfig: (options?: FrameworkOptions) => Promise<FlatConfigArray>;
51
+ /** @deprecated Use `solid` instead. */
52
+ declare const solidConfig: (options?: FrameworkOptions) => Promise<FlatConfigArray>;
53
+ /** @deprecated Use `svelte` instead. */
54
+ declare const svelteConfig: (options?: FrameworkOptions) => Promise<FlatConfigArray>;
55
+ /** @deprecated Use `vue` instead. */
56
+ declare const vueConfig: (options?: FrameworkOptions) => Promise<FlatConfigArray>;
57
+
58
+ export { type FrameworkFlags, type FrameworkName, type FrameworkOptions, angular, angularConfig, astro, createDetectedFrameworkFlags, expo, expoConfig, getBundledFrameworkConfig, hono, lit, nest, nestConfig, next, nextConfig, nuxt, preact, preactConfig, qwik, react, reactConfig, reactRouter, remix, slidev, solid, solidConfig, svelte, svelteConfig, tanstackStart, vite, vue, vueConfig };
@@ -0,0 +1,106 @@
1
+ import { loadModule } from "./lazy.js";
2
+ const createDetectedFrameworkFlags = (detectedFrameworks = []) => Object.fromEntries(
3
+ detectedFrameworks.map((framework) => [framework, true])
4
+ );
5
+ const frameworkLoaders = /* @__PURE__ */ new Map([
6
+ ["angular", async () => (await loadModule("@santi020k/eslint-config-angular")).angularConfig],
7
+ ["astro", async () => (await loadModule("@santi020k/eslint-config-astro")).default],
8
+ ["expo", async () => (await loadModule("@santi020k/eslint-config-expo")).expoConfig],
9
+ ["hono", async () => (await loadModule("@santi020k/eslint-config-hono")).hono],
10
+ ["lit", async () => (await loadModule("@santi020k/eslint-config-lit")).lit],
11
+ ["nest", async () => (await loadModule("@santi020k/eslint-config-nest")).nestConfig],
12
+ ["next", async () => (await loadModule("@santi020k/eslint-config-next")).nextConfig],
13
+ ["nuxt", async () => (await loadModule("@santi020k/eslint-config-nuxt")).nuxt],
14
+ ["preact", async () => (await loadModule("@santi020k/eslint-config-preact")).preactConfig],
15
+ ["qwik", async () => (await loadModule("@santi020k/eslint-config-qwik")).qwik],
16
+ ["react", async () => (await loadModule("@santi020k/eslint-config-react")).reactConfig],
17
+ ["react-router", async () => (await loadModule("@santi020k/eslint-config-react-router")).reactRouter],
18
+ ["remix", async () => (await loadModule("@santi020k/eslint-config-remix")).default],
19
+ ["slidev", async () => (await loadModule("@santi020k/eslint-config-slidev")).slidev],
20
+ ["solid", async () => (await loadModule("@santi020k/eslint-config-solid")).solidConfig],
21
+ ["svelte", async () => (await loadModule("@santi020k/eslint-config-svelte")).svelteConfig],
22
+ ["tanstack-start", async () => (await loadModule("@santi020k/eslint-config-tanstack-start")).tanstackStart],
23
+ ["vite", async () => (await loadModule("@santi020k/eslint-config-vite")).vite],
24
+ ["vue", async () => (await loadModule("@santi020k/eslint-config-vue")).vueConfig]
25
+ ]);
26
+ const frameworkConfigCache = /* @__PURE__ */ new Map();
27
+ const loadFrameworkConfigInput = (frameworkName) => {
28
+ const cached = frameworkConfigCache.get(frameworkName);
29
+ if (cached) return cached;
30
+ const loader = frameworkLoaders.get(frameworkName);
31
+ if (!loader) return Promise.resolve([]);
32
+ const pending = loader().catch((error) => {
33
+ frameworkConfigCache.delete(frameworkName);
34
+ throw new Error(
35
+ `Unable to load optional framework config "${frameworkName}". Install "@santi020k/eslint-config-${frameworkName}" or remove that framework from your eslintConfig options.`,
36
+ { cause: error }
37
+ );
38
+ });
39
+ frameworkConfigCache.set(frameworkName, pending);
40
+ return pending;
41
+ };
42
+ const getBundledFrameworkConfig = async (frameworkName, options) => {
43
+ const input = await loadFrameworkConfigInput(frameworkName);
44
+ return typeof input === "function" ? input(options) : input;
45
+ };
46
+ const createBundledFramework = (frameworkName) => async (options) => getBundledFrameworkConfig(frameworkName, options);
47
+ const angular = createBundledFramework("angular");
48
+ const astro = createBundledFramework("astro");
49
+ const expo = createBundledFramework("expo");
50
+ const hono = createBundledFramework("hono");
51
+ const lit = createBundledFramework("lit");
52
+ const nest = createBundledFramework("nest");
53
+ const next = createBundledFramework("next");
54
+ const nuxt = createBundledFramework("nuxt");
55
+ const preact = createBundledFramework("preact");
56
+ const qwik = createBundledFramework("qwik");
57
+ const react = createBundledFramework("react");
58
+ const reactRouter = createBundledFramework("react-router");
59
+ const slidev = createBundledFramework("slidev");
60
+ const solid = createBundledFramework("solid");
61
+ const svelte = createBundledFramework("svelte");
62
+ const tanstackStart = createBundledFramework("tanstack-start");
63
+ const vite = createBundledFramework("vite");
64
+ const vue = createBundledFramework("vue");
65
+ const remix = createBundledFramework("remix");
66
+ const angularConfig = angular;
67
+ const expoConfig = expo;
68
+ const nestConfig = nest;
69
+ const nextConfig = next;
70
+ const preactConfig = preact;
71
+ const reactConfig = react;
72
+ const solidConfig = solid;
73
+ const svelteConfig = svelte;
74
+ const vueConfig = vue;
75
+ export {
76
+ angular,
77
+ angularConfig,
78
+ astro,
79
+ createDetectedFrameworkFlags,
80
+ expo,
81
+ expoConfig,
82
+ getBundledFrameworkConfig,
83
+ hono,
84
+ lit,
85
+ nest,
86
+ nestConfig,
87
+ next,
88
+ nextConfig,
89
+ nuxt,
90
+ preact,
91
+ preactConfig,
92
+ qwik,
93
+ react,
94
+ reactConfig,
95
+ reactRouter,
96
+ remix,
97
+ slidev,
98
+ solid,
99
+ solidConfig,
100
+ svelte,
101
+ svelteConfig,
102
+ tanstackStart,
103
+ vite,
104
+ vue,
105
+ vueConfig
106
+ };
package/dist/index.d.ts CHANGED
@@ -1,16 +1,21 @@
1
1
  import { EslintConfigOptions, FlatConfigArray } from '@santi020k/eslint-config-core';
2
- export { DetectedFrameworkName, EslintConfigOptions, Extension, FlatConfigArray, Format, ImportedFramework, Library, NextMode, Preset, ReactConfigKeys, Runtime, Setting, Testing, Tool, coreConfig, createCoreConfig, detectProjectOptions, getGlobalsForRuntime, gitignore, hasReactConfig, jsConfig } from '@santi020k/eslint-config-core';
2
+ export { DetectedFrameworkName, DetectionOptions, EslintConfigOptions, Extension, ExtensionName, ExtensionOption, FlatConfigArray, Format, FormatName, FormatOption, ImportGroupOptions, ImportedFramework, Library, LibraryName, LibraryOption, NextMode, NextModeName, NextModeOption, OptionalConfigMap, OptionalConfigName, Preset, PresetName, PresetOption, ReactConfigKeys, Runtime, RuntimeName, RuntimeOption, Setting, SettingName, SettingOption, StrictMode, Testing, TestingName, TestingOption, Tool, ToolName, ToolOption, TypeScriptMode, TypeScriptOptions, coreConfig, createCoreConfig, createImportGroups, detectProjectOptions, getGlobalsForRuntime, gitignore, groups, hasReactConfig, jsConfig } from '@santi020k/eslint-config-core';
3
3
  export { AGENT_TARGETS, AgentTarget, GenerateSkillOptions, GenerateSkillResult, generateAgentSkills, generateSkillContent } from './agent-skill-generator.js';
4
+ export { angular, angularConfig, astro, expo, expoConfig, hono, lit, nest, nestConfig, next, nextConfig, nuxt, preact, preactConfig, qwik, react, reactConfig, reactRouter, remix, slidev, solid, solidConfig, svelte, svelteConfig, tanstackStart, vite, vue, vueConfig } from './frameworks.js';
5
+ export { a11y, aiSdk, autogen, bestPractices, biome, command, compat, cspell, css, cypress, deMorgan, depend, docker, drizzle, githubActions, googleGenAi, graphql, html, i18next, jest, jestDom, jsdoc, jsonc, langchain, llamaIndex, markdown, mastra, mcp, mdx, mikroOrm, noOnlyTests, node, nx, openAiAgents, oxlint, packageJson, perfectionist, playwright, pnpm, prettier, prisma, regexp, security, sequelize, sonarjs, stencil, storybook, swagger, tailwind, tanstackQuery, tanstackRouter, testingLibrary, toml, turbo, typeorm, unicorn, vitest, yaml, zod } from '@santi020k/eslint-config-integrations';
4
6
  export { tsConfig, typescriptConfig } from '@santi020k/eslint-config-typescript';
5
- export { bestPractices, cspell, cypress, graphql, i18next, jest, jsdoc, jsonc, markdown, mdx, perfectionist, playwright, prettier, regexp, security, sonarjs, stencil, storybook, swagger, tailwind, tanstackQuery, tanstackRouter, testingLibrary, toml, unicorn, vitest, yaml } from '@santi020k/eslint-config-optionals';
6
7
 
7
8
  /**
8
9
  * Generates the ESLint configuration array, applying configurations
9
- * and optional settings based on the input configuration.
10
+ * and integration settings based on the input configuration.
10
11
  *
11
- * @param {EslintConfigOptions} options - Configuration and optional settings
12
+ * @param {EslintConfigOptions} options - Configuration and integration settings
12
13
  * @returns {FlatConfigArray} The final ESLint configuration array
13
14
  */
14
- declare const eslintConfig: (options?: EslintConfigOptions) => FlatConfigArray;
15
+ declare const eslintConfig: (options?: EslintConfigOptions) => Promise<FlatConfigArray>;
16
+ /**
17
+ * Alias for `eslintConfig()` that reads naturally in `eslint.config.*` files.
18
+ */
19
+ declare const defineConfig: (options?: EslintConfigOptions) => Promise<FlatConfigArray>;
15
20
 
16
- export { eslintConfig };
21
+ export { defineConfig, eslintConfig };