@santi020k/eslint-config-basic 0.8.1 → 1.0.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/CHANGELOG.md CHANGED
@@ -1,5 +1,61 @@
1
1
  # @santi020k/eslint-config-basic
2
2
 
3
+ ## 1.0.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#66](https://github.com/santi020k/eslint-config-basic/pull/66) [`6f2f473`](https://github.com/santi020k/eslint-config-basic/commit/6f2f4733642087eb9eac22a7b6193b71453f375d) Thanks [@santi020k](https://github.com/santi020k)! - # v0.10.0 Release
8
+
9
+ ## Major Changes
10
+
11
+ - **Migration to pnpm**: Full migration of the monorepo from npm to pnpm workspaces (pnpm v10+). This includes better performance, stricter dependency management, and corepack integration.
12
+ - **neostandard removal**: Removed `neostandard` dependency to provide more granular control and modularity in core rules.
13
+ - **Stylistic v4 -> v5**: Upgraded to `@stylistic/eslint-plugin` version 5.x for improved formatting rules and TypeScript 5.7+ support.
14
+ - **GraphQL Integration**: Added comprehensive support for GraphQL schemas and operations. This includes automated project detection for GraphQL files and specialized linting rules for both schema definitions and operation documents.
15
+ - **React 19 Support**: Updated React detection logic and configurations to support React 19.
16
+
17
+ ## Framework Updates
18
+
19
+ - **Qwik & Remix Support**: Added comprehensive ESLint configurations and functional playground environments for both Qwik and Remix frameworks.
20
+ - **Dependency Alignment**: Resolved critical `typescript-eslint` dependency issues in Astro, Svelte, and Vue packages to ensure proper rule resolution and type safety.
21
+ - **Consistency Refinements**: Standardized `disable-type-checked` rule blocks across all framework-specific configurations.
22
+ - **Documentation Overhaul**: Major documentation refresh in root `README.md` and VitePress documentation. Added clarity on configuration priority, framework auto-detection, and full-settings examples.
23
+
24
+ ## Maintenance
25
+
26
+ - **Corepack Enablement**: Added `corepack` support for automated package manager version management.
27
+ - **Turbo Update**: Bumped Turborepo to v2.9+ for faster builds and improved task caching.
28
+ - **Turbo Optimizations**: Configured Turborepo to output in `errors-only` mode with `errorsOnlyShowHash` enabled, significantly reducing terminal noise during build and lint tasks.
29
+ - **Integration Test Improvements**: Enhanced integration tests to be more robust, including proper `tsconfigRootDir` handling and better React version validation.
30
+ - **Playground Synchronization**: Updated all playground packages to maintain parity with the latest framework rules.
31
+
32
+ - [#55](https://github.com/santi020k/eslint-config-basic/pull/55) [`d8e4b4a`](https://github.com/santi020k/eslint-config-basic/commit/d8e4b4a61c2739dbffa3c823d8742ea234c5b731) Thanks [@santi020k](https://github.com/santi020k)! - feat: add standard ESLint configuration and resolve typecheck/hook failures
33
+
34
+ This release introduces a new standard configuration in `@santi020k/eslint-config-core` and addresses several technical issues:
35
+
36
+ - Fixed global typecheck failures across the monorepo.
37
+ - Resolved pre-commit hook issues with cspell.
38
+ - Fixed pre-push hook failures related to publint in the playground package.
39
+ - Added missing test coverage scripts and fixed CI build failures.
40
+
41
+ ### Patch Changes
42
+
43
+ - Updated dependencies [[`6f2f473`](https://github.com/santi020k/eslint-config-basic/commit/6f2f4733642087eb9eac22a7b6193b71453f375d), [`d8e4b4a`](https://github.com/santi020k/eslint-config-basic/commit/d8e4b4a61c2739dbffa3c823d8742ea234c5b731)]:
44
+ - @santi020k/eslint-config-angular@1.0.0
45
+ - @santi020k/eslint-config-astro@1.0.0
46
+ - @santi020k/eslint-config-core@1.0.0
47
+ - @santi020k/eslint-config-expo@1.0.0
48
+ - @santi020k/eslint-config-nest@1.0.0
49
+ - @santi020k/eslint-config-next@1.0.0
50
+ - @santi020k/eslint-config-optionals@1.0.0
51
+ - @santi020k/eslint-config-qwik@0.8.2
52
+ - @santi020k/eslint-config-react@1.0.0
53
+ - @santi020k/eslint-config-remix@0.8.2
54
+ - @santi020k/eslint-config-solid@1.0.0
55
+ - @santi020k/eslint-config-svelte@1.0.0
56
+ - @santi020k/eslint-config-typescript@1.0.0
57
+ - @santi020k/eslint-config-vue@1.0.0
58
+
3
59
  ## 0.8.1
4
60
 
5
61
  ### Minor Changes
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 santi020k
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -3,49 +3,101 @@
3
3
  [![CI](https://github.com/santi020k/eslint-config-basic/actions/workflows/build.yml/badge.svg)](https://github.com/santi020k/eslint-config-basic/actions/workflows/build.yml)
4
4
  [![npm version](https://img.shields.io/npm/v/@santi020k/eslint-config-basic.svg)](https://www.npmjs.com/package/@santi020k/eslint-config-basic)
5
5
  [![npm downloads](https://img.shields.io/npm/dm/@santi020k/eslint-config-basic.svg)](https://www.npmjs.com/package/@santi020k/eslint-config-basic)
6
- [![Docs](https://img.shields.io/badge/docs-VitePress-114d66.svg)](https://santi020k.github.io/eslint-config-basic/)
6
+ [![Docs](https://img.shields.io/badge/docs-VitePress-114d66.svg)](https://eslint.santi020k.me/)
7
7
  [![license](https://img.shields.io/npm/l/@santi020k/eslint-config-basic.svg)](https://github.com/santi020k/eslint-config-basic/blob/main/LICENSE)
8
8
 
9
- Composable ESLint 10+ flat-config tooling for JavaScript and TypeScript projects, with optional framework packages for React, Next.js, Astro, Vue, Svelte, Solid, Angular, NestJS, and Expo.
9
+ Composable ESLint 10+ flat-config tooling for JavaScript and TypeScript projects, with optional framework packages for React, Next.js, Astro, Vue, Svelte, Solid, Angular, NestJS, Expo, Qwik, and Remix.
10
10
 
11
11
  ## Canonical Docs
12
12
 
13
- - Docs site: [santi020k.github.io/eslint-config-basic](https://santi020k.github.io/eslint-config-basic/)
13
+ - Docs site: [eslint.santi020k.me](https://eslint.santi020k.me/)
14
14
  - Repository: [github.com/santi020k/eslint-config-basic](https://github.com/santi020k/eslint-config-basic)
15
15
  - Author: [santi020k](https://santi020k.me)
16
16
 
17
- > [!NOTE]
18
- > The docs site is built with VitePress. The planned production hostname is `eslint.santi020k.me`.
17
+ ## ✨ Key Features
19
18
 
20
- ## Quick Start
19
+ - **🎯 Composable & Modular**: Mix and match configurations for different frameworks and tools using a clean, options-based API.
20
+ - **🔍 Deep Auto-Detection**: Automatically detects your project's frameworks, libraries, and tools. Core features like TypeScript and runtime presets are enabled by default if detected.
21
+ - **⚡ Lazy Loading**: Framework-specific configurations are loaded only when needed, ensuring maximum performance and avoiding unnecessary peer dependency conflicts.
22
+ - **🛡️ Strict Mode**: Opt-in `strict: true` to promote all warnings to errors, perfect for CI/CD and maintaining high code standards.
23
+ - **🌐 Smart Runtime Support**: Built-in support for Node.js, Browser, or Universal runtimes with appropriate globals and rules.
24
+ - **💅 Prettier Integrated**: Seamlessly integrated with Prettier out of the box for consistent code formatting.
25
+ - **🧩 Extensive Plugin Support**: Tailored rules for Tailwind CSS, Vitest, Testing Library, Storybook, TanStack (Query/Router), and more.
26
+
27
+ ## 🚀 Quick Start
28
+
29
+ ### Installation
21
30
 
22
31
  ```bash
23
32
  npm install -D eslint @santi020k/eslint-config-basic
24
33
  ```
25
34
 
35
+ ### Usage
36
+
37
+ Create an `eslint.config.js` in your project root. By default, it will detect your project settings:
38
+
26
39
  ```js
27
40
  import { eslintConfig } from '@santi020k/eslint-config-basic'
28
41
 
29
42
  export default eslintConfig()
30
43
  ```
31
44
 
45
+ ### Comprehensive Example
46
+
47
+ Here is an example with many features activated. Note that many of these are automatically detected if the corresponding packages are in your `package.json`.
48
+
49
+ ```js
50
+ import { eslintConfig, Extension, Format, Library, Testing, Tool } from '@santi020k/eslint-config-basic'
51
+ import next from '@santi020k/eslint-config-next'
52
+ import react from '@santi020k/eslint-config-react'
53
+
54
+ export default eslintConfig({
55
+ // Explicitly enable TypeScript (auto-detected if tsconfig.json exists)
56
+ typescript: true,
57
+
58
+ // Strict mode: warnings become errors
59
+ strict: true,
60
+
61
+ // Frameworks (imports are lazy-loaded)
62
+ frameworks: {
63
+ react,
64
+ next
65
+ },
66
+
67
+ // Optional integrations
68
+ libraries: [Library.Tailwind, Library.TanstackQuery],
69
+ testing: [Testing.Vitest, Testing.Playwright, Testing.TestingLibrary],
70
+ formats: [Format.Mdx, Format.Jsonc, Format.Graphql],
71
+ tools: [Tool.Prettier, Tool.Cspell],
72
+ extensions: [Extension.Unicorn, Extension.Sonarjs, Extension.Perfectionist]
73
+ })
74
+ ```
75
+
32
76
  ## Framework packages
33
77
 
34
- - TypeScript: [`@santi020k/eslint-config-typescript`](https://santi020k.github.io/eslint-config-basic/frameworks/typescript.html)
35
- - React: [`@santi020k/eslint-config-react`](https://santi020k.github.io/eslint-config-basic/frameworks/react.html)
36
- - Next.js: [`@santi020k/eslint-config-next`](https://santi020k.github.io/eslint-config-basic/frameworks/next.html)
37
- - Astro: [`@santi020k/eslint-config-astro`](https://santi020k.github.io/eslint-config-basic/frameworks/astro.html)
38
- - Vue: [`@santi020k/eslint-config-vue`](https://santi020k.github.io/eslint-config-basic/frameworks/vue.html)
39
- - Svelte: [`@santi020k/eslint-config-svelte`](https://santi020k.github.io/eslint-config-basic/frameworks/svelte.html)
40
- - Solid: [`@santi020k/eslint-config-solid`](https://santi020k.github.io/eslint-config-basic/frameworks/solid.html)
41
- - Angular: [`@santi020k/eslint-config-angular`](https://santi020k.github.io/eslint-config-basic/frameworks/angular.html)
42
- - NestJS: [`@santi020k/eslint-config-nest`](https://santi020k.github.io/eslint-config-basic/frameworks/nest.html)
43
- - Expo: [`@santi020k/eslint-config-expo`](https://santi020k.github.io/eslint-config-basic/frameworks/expo.html)
78
+ - TypeScript: [`@santi020k/eslint-config-typescript`](https://eslint.santi020k.me/frameworks/typescript.html)
79
+ - React: [`@santi020k/eslint-config-react`](https://eslint.santi020k.me/frameworks/react.html)
80
+ - Next.js: [`@santi020k/eslint-config-next`](https://eslint.santi020k.me/frameworks/next.html)
81
+ - Astro: [`@santi020k/eslint-config-astro`](https://eslint.santi020k.me/frameworks/astro.html)
82
+ - Vue: [`@santi020k/eslint-config-vue`](https://eslint.santi020k.me/frameworks/vue.html)
83
+ - Svelte: [`@santi020k/eslint-config-svelte`](https://eslint.santi020k.me/frameworks/svelte.html)
84
+ - Solid: [`@santi020k/eslint-config-solid`](https://eslint.santi020k.me/frameworks/solid.html)
85
+ - Angular: [`@santi020k/eslint-config-angular`](https://eslint.santi020k.me/frameworks/angular.html)
86
+ - NestJS: [`@santi020k/eslint-config-nest`](https://eslint.santi020k.me/frameworks/nest.html)
87
+ - Expo: [`@santi020k/eslint-config-expo`](https://eslint.santi020k.me/frameworks/expo.html)
88
+ - Qwik: [`@santi020k/eslint-config-qwik`](https://eslint.santi020k.me/frameworks/qwik.html)
89
+ - Remix: [`@santi020k/eslint-config-remix`](https://eslint.santi020k.me/frameworks/remix.html)
44
90
 
45
91
  ## Development
46
92
 
47
93
  ```bash
48
- npm run docs:dev
94
+ pnpm install # Install dependencies
95
+ pnpm run build # Build all packages
96
+ pnpm run test # Run integration tests
97
+ pnpm run lint # Run linting checks
98
+ pnpm run ok # Run all checks
49
99
  ```
50
100
 
51
- That command regenerates the API markdown and starts the VitePress site from [`packages/docs`](/Users/smith/Projects/santi020k/eslint-config-basic/packages/docs).
101
+ ---
102
+
103
+ *Authored with ❤️ by [santi020k](https://santi020k.me)*
package/dist/cli.js CHANGED
@@ -1,16 +1,9 @@
1
1
  #!/usr/bin/env node
2
- import {
3
- detectProjectOptions
4
- } from "./chunk-CH2MVUQN.js";
5
- import "./chunk-2Z6LYTBS.js";
6
- import "./chunk-WGZBHVWD.js";
7
- import "./chunk-SSGAWVVA.js";
8
-
9
- // src/cli.ts
10
- import { existsSync, readFileSync, writeFileSync } from "fs";
11
- import { basename, join } from "path";
12
- import { fileURLToPath } from "url";
13
- var getDefaultConfigFilename = (cwd) => {
2
+ import { existsSync, readFileSync, writeFileSync } from "node:fs";
3
+ import { basename, join } from "node:path";
4
+ import { fileURLToPath } from "node:url";
5
+ import { detectProjectOptions } from "./index.js";
6
+ const getDefaultConfigFilename = (cwd) => {
14
7
  const packageJsonPath = join(cwd, "package.json");
15
8
  if (!existsSync(packageJsonPath)) return "eslint.config.mjs";
16
9
  try {
@@ -20,21 +13,21 @@ var getDefaultConfigFilename = (cwd) => {
20
13
  return "eslint.config.mjs";
21
14
  }
22
15
  };
23
- var resolveConfigPath = (cwd) => {
16
+ const resolveConfigPath = (cwd) => {
24
17
  const existingConfigPath = [
25
18
  "eslint.config.js",
26
19
  "eslint.config.mjs"
27
20
  ].map((filename) => join(cwd, filename)).find(existsSync);
28
21
  return existingConfigPath ?? join(cwd, getDefaultConfigFilename(cwd));
29
22
  };
30
- var getFrameworkKeys = (frameworks) => {
23
+ const getFrameworkKeys = (frameworks) => {
31
24
  const frameworkKeys = new Set(Object.keys(frameworks ?? {}));
32
25
  if (frameworkKeys.has("next") || frameworkKeys.has("expo")) {
33
26
  frameworkKeys.add("react");
34
27
  }
35
28
  return [...frameworkKeys];
36
29
  };
37
- var createConfigContent = (cwd) => {
30
+ const createConfigContent = (cwd) => {
38
31
  const options = detectProjectOptions(cwd);
39
32
  const frameworkKeys = getFrameworkKeys(options.frameworks);
40
33
  const imports = ["import { eslintConfig } from '@santi020k/eslint-config-basic'"];
@@ -62,7 +55,7 @@ export default eslintConfig({
62
55
  configContent
63
56
  };
64
57
  };
65
- var handleInit = (cwd = process.cwd()) => {
58
+ const handleInit = (cwd = process.cwd()) => {
66
59
  const configPath = resolveConfigPath(cwd);
67
60
  if (existsSync(configPath)) {
68
61
  console.warn(`\u26A0\uFE0F ${basename(configPath)} already exists. Skipping...`);
@@ -74,14 +67,14 @@ var handleInit = (cwd = process.cwd()) => {
74
67
  console.log(`\u2705 Created ${basename(configPath)} with auto-detected settings!`);
75
68
  console.log("\u{1F680} Ready to lint!");
76
69
  };
77
- var handleUpdate = (cwd = process.cwd()) => {
70
+ const handleUpdate = (cwd = process.cwd()) => {
78
71
  console.log("\u{1F50D} Detecting project settings...");
79
72
  const { configPath, configContent } = createConfigContent(cwd);
80
73
  writeFileSync(configPath, configContent);
81
74
  console.log(`\u2705 Updated ${basename(configPath)} with auto-detected settings!`);
82
75
  console.log("\u{1F680} Ready to lint!");
83
76
  };
84
- var run = () => {
77
+ const run = () => {
85
78
  const command = process.argv[2];
86
79
  if (command === "init") {
87
80
  handleInit();
package/dist/compose.d.ts CHANGED
@@ -1,13 +1,8 @@
1
1
  import { FlatConfigArray } from '@santi020k/eslint-config-core';
2
- import { TSESLint } from '@typescript-eslint/utils';
3
2
 
4
3
  /**
5
4
  * Applies strict mode by promoting all 'warn' rules to 'error'.
6
5
  */
7
6
  declare const applyStrictMode: (configs: FlatConfigArray, strict: boolean) => FlatConfigArray;
8
- /**
9
- * Returns global overrides for non-TS files to prevent typed rules errors (#15).
10
- */
11
- declare const getTypedRulesOverrides: () => TSESLint.FlatConfig.Config;
12
7
 
13
- export { applyStrictMode, getTypedRulesOverrides };
8
+ export { applyStrictMode };
package/dist/compose.js CHANGED
@@ -1,8 +1,23 @@
1
- import {
2
- applyStrictMode,
3
- getTypedRulesOverrides
4
- } from "./chunk-2Z6LYTBS.js";
1
+ const promoteRuleSeverity = (value) => {
2
+ if (value === void 0) return void 0;
3
+ if (value === "warn" || value === 1) return "error";
4
+ if (Array.isArray(value) && (value[0] === "warn" || value[0] === 1)) {
5
+ return ["error", ...value.slice(1)];
6
+ }
7
+ return value;
8
+ };
9
+ const applyStrictMode = (configs, strict) => {
10
+ if (!strict) return configs;
11
+ return configs.map((config) => {
12
+ if (config.rules) {
13
+ const strictRules = Object.fromEntries(
14
+ Object.entries(config.rules).map(([key, value]) => [key, promoteRuleSeverity(value)])
15
+ );
16
+ return { ...config, rules: strictRules };
17
+ }
18
+ return config;
19
+ });
20
+ };
5
21
  export {
6
- applyStrictMode,
7
- getTypedRulesOverrides
22
+ applyStrictMode
8
23
  };
package/dist/index.js CHANGED
@@ -1,27 +1,43 @@
1
+ import { applyStrictMode } from "./compose.js";
2
+ import { getOptionalConfigs, getPrettierConfig } from "./optionals.js";
3
+ import { resolveFramework, resolvePreset } from "./resolvers.js";
1
4
  import {
2
- Extension,
3
- Format,
4
- Library,
5
+ coreConfig,
6
+ createCoreConfig,
7
+ detectProjectOptions,
8
+ gitignore,
9
+ hasReactConfig,
5
10
  NextMode,
6
- Preset,
7
- ReactConfigKeys,
8
11
  Runtime,
9
- Setting,
10
- Testing,
12
+ Setting
13
+ } from "@santi020k/eslint-config-core";
14
+ import { createTypescriptConfig } from "@santi020k/eslint-config-typescript";
15
+ import {
16
+ Library,
11
17
  Tool,
12
- coreConfig,
13
- createCoreConfig,
18
+ Extension,
19
+ Setting as Setting2,
20
+ Runtime as Runtime2,
21
+ Preset,
22
+ Testing,
23
+ Format,
24
+ NextMode as NextMode2,
25
+ ReactConfigKeys,
26
+ hasReactConfig as hasReactConfig2,
27
+ coreConfig as coreConfig2,
28
+ createCoreConfig as createCoreConfig2,
29
+ getGlobalsForRuntime,
30
+ jsConfig,
31
+ gitignore as gitignore2,
32
+ detectProjectOptions as detectProjectOptions2
33
+ } from "@santi020k/eslint-config-core";
34
+ import { typescriptConfig, tsConfig } from "@santi020k/eslint-config-typescript";
35
+ import {
14
36
  cspell,
15
37
  cypress,
16
- detectProjectOptions,
17
- eslintConfig,
18
- getGlobalsForRuntime,
19
- gitignore,
20
38
  graphql,
21
- hasReactConfig,
22
39
  i18next,
23
40
  jest,
24
- jsConfig,
25
41
  jsdoc,
26
42
  jsonc,
27
43
  markdown,
@@ -40,36 +56,125 @@ import {
40
56
  tanstackRouter,
41
57
  testingLibrary,
42
58
  toml,
43
- tsConfig,
44
- typescriptConfig,
45
59
  unicorn,
46
60
  vitest,
47
61
  yaml
48
- } from "./chunk-CH2MVUQN.js";
49
- import "./chunk-2Z6LYTBS.js";
50
- import "./chunk-WGZBHVWD.js";
51
- import "./chunk-SSGAWVVA.js";
62
+ } from "@santi020k/eslint-config-optionals";
63
+ const eslintConfig = (options) => {
64
+ const detected = detectProjectOptions();
65
+ const preset = options?.preset ?? detected.preset;
66
+ const presetDefaults = preset ? resolvePreset(preset) : {};
67
+ const {
68
+ typescript = presetDefaults.typescript ?? detected.typescript ?? false,
69
+ libraries = presetDefaults.libraries ?? detected.libraries ?? [],
70
+ testing = presetDefaults.testing ?? detected.testing ?? [],
71
+ formats = presetDefaults.formats ?? detected.formats ?? [],
72
+ tools = presetDefaults.tools ?? detected.tools ?? [],
73
+ extensions = presetDefaults.extensions ?? detected.extensions ?? [],
74
+ settings = options?.settings ?? detected.settings ?? [],
75
+ strict = options?.strict ?? false,
76
+ runtime = presetDefaults.runtime ?? detected.runtime ?? Runtime.Universal,
77
+ tsconfigRootDir = options?.tsconfigRootDir,
78
+ nextMode = presetDefaults.nextMode ?? detected.nextMode ?? NextMode.Pages,
79
+ frameworks = { ...presetDefaults.frameworks, ...options?.frameworks }
80
+ } = options ?? {};
81
+ const uniqueLibraries = [...new Set(libraries)];
82
+ const uniqueTesting = [...new Set(testing)];
83
+ const uniqueFormats = [...new Set(formats)];
84
+ const uniqueTools = [...new Set(tools)];
85
+ const uniqueExtensions = [...new Set(extensions)];
86
+ const uniqueSettings = [...new Set(settings)];
87
+ if ((frameworks.next || frameworks.expo) && !frameworks.react) {
88
+ throw new TypeError(
89
+ "Next and Expo configurations require frameworks.react. Import @santi020k/eslint-config-react and pass it via frameworks.react."
90
+ );
91
+ }
92
+ const reactParam = resolveFramework("react", frameworks.react);
93
+ const nextParam = resolveFramework("next", frameworks.next);
94
+ const astroParam = resolveFramework("astro", frameworks.astro);
95
+ const expoParam = resolveFramework("expo", frameworks.expo);
96
+ const nestParam = resolveFramework("nest", frameworks.nest);
97
+ const vueParam = resolveFramework("vue", frameworks.vue);
98
+ const svelteParam = resolveFramework("svelte", frameworks.svelte);
99
+ const solidParam = resolveFramework("solid", frameworks.solid);
100
+ const angularParam = resolveFramework("angular", frameworks.angular);
101
+ const qwikParam = resolveFramework("qwik", frameworks.qwik);
102
+ const remixParam = resolveFramework("remix", frameworks.remix);
103
+ const hasReact = hasReactConfig({ frameworks });
104
+ const useGitignore = !uniqueSettings.includes(Setting.NoGitignore);
105
+ const runtimeCoreConfig = runtime !== Runtime.Universal ? createCoreConfig(runtime) : coreConfig;
106
+ const configs = [
107
+ // Settings
108
+ ...useGitignore ? gitignore : [],
109
+ // Global TSConfig Root Dir fix
110
+ ...tsconfigRootDir ? [{
111
+ name: "eslint-config-basic/tsconfig-root-dir",
112
+ languageOptions: {
113
+ parserOptions: {
114
+ tsconfigRootDir
115
+ }
116
+ }
117
+ }] : [],
118
+ // Core JS config with runtime-aware globals
119
+ ...runtimeCoreConfig,
120
+ // React config (included if any React-based framework is used/passed)
121
+ ...hasReact ? reactParam : [],
122
+ // Framework-specific configs (Modularized)
123
+ ...typescript ? createTypescriptConfig({ tsconfigRootDir }) : [],
124
+ ...nextParam,
125
+ // Next.js App Router overrides (#12)
126
+ ...frameworks.next && nextMode === NextMode.AppRouter ? [
127
+ {
128
+ name: "eslint-config-next/app-router-overrides",
129
+ files: ["app/**/*.{ts,tsx}"],
130
+ rules: {
131
+ "@next/next/no-html-link-for-pages": "off"
132
+ }
133
+ }
134
+ ] : [],
135
+ ...astroParam,
136
+ ...expoParam,
137
+ ...nestParam,
138
+ ...vueParam,
139
+ ...svelteParam,
140
+ ...solidParam,
141
+ ...angularParam,
142
+ ...qwikParam,
143
+ ...remixParam,
144
+ // Optionals
145
+ ...getOptionalConfigs(
146
+ uniqueLibraries,
147
+ uniqueTools,
148
+ uniqueTesting,
149
+ uniqueFormats,
150
+ uniqueExtensions
151
+ ),
152
+ // Prettier always last
153
+ ...getPrettierConfig(uniqueTools)
154
+ ];
155
+ return applyStrictMode(configs, strict);
156
+ };
52
157
  export {
53
158
  Extension,
54
159
  Format,
55
160
  Library,
56
- NextMode,
161
+ NextMode2 as NextMode,
57
162
  Preset,
58
163
  ReactConfigKeys,
59
- Runtime,
60
- Setting,
164
+ Runtime2 as Runtime,
165
+ Setting2 as Setting,
61
166
  Testing,
62
167
  Tool,
63
- coreConfig,
64
- createCoreConfig,
168
+ coreConfig2 as coreConfig,
169
+ createCoreConfig2 as createCoreConfig,
65
170
  cspell,
66
171
  cypress,
67
- detectProjectOptions,
172
+ detectProjectOptions2 as detectProjectOptions,
68
173
  eslintConfig,
69
174
  getGlobalsForRuntime,
70
- gitignore,
175
+ gitignore2 as gitignore,
71
176
  graphql,
72
- hasReactConfig,
177
+ hasReactConfig2 as hasReactConfig,
73
178
  i18next,
74
179
  jest,
75
180
  jsConfig,
package/dist/optionals.js CHANGED
@@ -1,7 +1,68 @@
1
1
  import {
2
- getOptionalConfigs,
3
- getPrettierConfig
4
- } from "./chunk-WGZBHVWD.js";
2
+ Extension,
3
+ Format,
4
+ Library,
5
+ Testing,
6
+ Tool
7
+ } from "@santi020k/eslint-config-core";
8
+ import {
9
+ cspell,
10
+ cypress,
11
+ graphql,
12
+ i18next,
13
+ jest,
14
+ jsdoc,
15
+ jsonc,
16
+ markdown,
17
+ mdx,
18
+ perfectionist,
19
+ playwright,
20
+ prettier,
21
+ regexp,
22
+ security,
23
+ sonarjs,
24
+ stencil,
25
+ storybook,
26
+ swagger,
27
+ tailwind,
28
+ tanstackQuery,
29
+ tanstackRouter,
30
+ testingLibrary,
31
+ toml,
32
+ unicorn,
33
+ vitest,
34
+ yaml
35
+ } from "@santi020k/eslint-config-optionals";
36
+ const getOptionalConfigs = (libraries, tools, testing, formats, extensions) => {
37
+ const configs = [];
38
+ if (tools.includes(Tool.Cspell)) configs.push(...cspell);
39
+ if (libraries.includes(Library.Tailwind)) configs.push(...tailwind);
40
+ if (libraries.includes(Library.I18next)) configs.push(...i18next);
41
+ if (libraries.includes(Library.Stencil)) configs.push(...stencil);
42
+ if (libraries.includes(Library.TanstackQuery)) configs.push(...tanstackQuery);
43
+ if (libraries.includes(Library.TanstackRouter)) configs.push(...tanstackRouter);
44
+ if (libraries.includes(Library.Storybook)) configs.push(...storybook);
45
+ if (testing.includes(Testing.Vitest)) configs.push(...vitest);
46
+ if (testing.includes(Testing.Playwright)) configs.push(...playwright);
47
+ if (testing.includes(Testing.Jest)) configs.push(...jest);
48
+ if (testing.includes(Testing.Cypress)) configs.push(...cypress);
49
+ if (testing.includes(Testing.TestingLibrary)) configs.push(...testingLibrary);
50
+ if (formats.includes(Format.Mdx)) configs.push(...mdx);
51
+ if (formats.includes(Format.Markdown)) configs.push(...markdown);
52
+ if (formats.includes(Format.Jsonc)) configs.push(...jsonc);
53
+ if (formats.includes(Format.Yaml)) configs.push(...yaml);
54
+ if (formats.includes(Format.Toml)) configs.push(...toml);
55
+ if (formats.includes(Format.Graphql)) configs.push(...graphql);
56
+ if (extensions.includes(Extension.Regexp)) configs.push(...regexp);
57
+ if (extensions.includes(Extension.Unicorn)) configs.push(...unicorn);
58
+ if (extensions.includes(Extension.Sonarjs)) configs.push(...sonarjs);
59
+ if (extensions.includes(Extension.Security)) configs.push(...security);
60
+ if (extensions.includes(Extension.Perfectionist)) configs.push(...perfectionist);
61
+ if (tools.includes(Tool.Jsdoc)) configs.push(...jsdoc);
62
+ if (tools.includes(Tool.Swagger)) configs.push(...swagger);
63
+ return configs;
64
+ };
65
+ const getPrettierConfig = (tools) => tools.includes(Tool.Prettier) ? prettier : [];
5
66
  export {
6
67
  getOptionalConfigs,
7
68
  getPrettierConfig
package/dist/resolvers.js CHANGED
@@ -1,7 +1,49 @@
1
1
  import {
2
- resolveFramework,
3
- resolvePreset
4
- } from "./chunk-SSGAWVVA.js";
2
+ Extension,
3
+ Format,
4
+ Library,
5
+ Preset,
6
+ Runtime,
7
+ Testing,
8
+ Tool
9
+ } from "@santi020k/eslint-config-core";
10
+ const resolveFramework = (frameworkName, framework) => {
11
+ if (!framework) return [];
12
+ 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
+ );
16
+ }
17
+ return Array.isArray(framework) ? framework : framework.default;
18
+ };
19
+ const resolvePreset = (preset) => {
20
+ switch (preset) {
21
+ case Preset.Basic:
22
+ return { runtime: Runtime.Universal };
23
+ case Preset.Node:
24
+ return {
25
+ typescript: true,
26
+ runtime: Runtime.Node
27
+ };
28
+ case Preset.Browser:
29
+ return {
30
+ typescript: true,
31
+ runtime: Runtime.Browser
32
+ };
33
+ case Preset.All:
34
+ return {
35
+ typescript: true,
36
+ libraries: Object.values(Library),
37
+ tools: Object.values(Tool),
38
+ testing: Object.values(Testing),
39
+ formats: Object.values(Format),
40
+ extensions: Object.values(Extension),
41
+ runtime: Runtime.Universal
42
+ };
43
+ default:
44
+ return {};
45
+ }
46
+ };
5
47
  export {
6
48
  resolveFramework,
7
49
  resolvePreset
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@santi020k/eslint-config-basic",
3
- "version": "0.8.1",
4
- "description": "A comprehensive ESLint configuration package for JavaScript, TypeScript, and React projects.",
3
+ "version": "1.0.0",
4
+ "description": "A composable ESLint 9/10+ Flat Config package for JavaScript, TypeScript, React, Next.js, Vue, Svelte, Solid, Angular, Astro, Expo, NestJS, Qwik, and Remix.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.js",
@@ -17,37 +17,28 @@
17
17
  "README.md",
18
18
  "CHANGELOG.md"
19
19
  ],
20
- "scripts": {
21
- "build": "tsup",
22
- "build:pack": "npm pack",
23
- "dev": "tsup --watch",
24
- "clean": "rm -rf dist",
25
- "check:exports": "publint",
26
- "prepack": "rm -f README.md && cp ../../README.md ./README.md",
27
- "postpack": "rm -f README.md && ln -s ../../README.md ./README.md",
28
- "typecheck": "tsc --noEmit"
29
- },
30
20
  "bin": {
31
21
  "basic-eslint": "./dist/cli.js"
32
22
  },
33
23
  "dependencies": {
34
- "@santi020k/eslint-config-core": "^0.8.1",
35
- "@santi020k/eslint-config-optionals": "^0.8.1",
36
- "@santi020k/eslint-config-typescript": "^0.8.1",
37
- "eslint": "^10.1.0",
38
- "typescript-eslint": "^8.57.1"
24
+ "@typescript-eslint/utils": "^8.57.0",
25
+ "@santi020k/eslint-config-core": "^1.0.0",
26
+ "@santi020k/eslint-config-optionals": "^1.0.0",
27
+ "@santi020k/eslint-config-typescript": "^1.0.0"
39
28
  },
40
29
  "peerDependencies": {
41
- "@santi020k/eslint-config-angular": "^0.8.1",
42
- "@santi020k/eslint-config-astro": "^0.8.1",
43
- "@santi020k/eslint-config-expo": "^0.8.1",
44
- "@santi020k/eslint-config-nest": "^0.8.1",
45
- "@santi020k/eslint-config-next": "^0.8.1",
46
- "@santi020k/eslint-config-react": "^0.8.1",
47
- "@santi020k/eslint-config-solid": "^0.8.1",
48
- "@santi020k/eslint-config-svelte": "^0.8.1",
49
- "@santi020k/eslint-config-vue": "^0.8.1",
50
- "eslint": "^10.1.0"
30
+ "eslint": "^9.0.0 || ^10.0.0",
31
+ "@santi020k/eslint-config-angular": "^1.0.0",
32
+ "@santi020k/eslint-config-astro": "^1.0.0",
33
+ "@santi020k/eslint-config-expo": "^1.0.0",
34
+ "@santi020k/eslint-config-nest": "^1.0.0",
35
+ "@santi020k/eslint-config-next": "^1.0.0",
36
+ "@santi020k/eslint-config-react": "^1.0.0",
37
+ "@santi020k/eslint-config-solid": "^1.0.0",
38
+ "@santi020k/eslint-config-svelte": "^1.0.0",
39
+ "@santi020k/eslint-config-vue": "^1.0.0",
40
+ "@santi020k/eslint-config-qwik": "^0.8.2",
41
+ "@santi020k/eslint-config-remix": "^0.8.2"
51
42
  },
52
43
  "peerDependenciesMeta": {
53
44
  "@santi020k/eslint-config-angular": {
@@ -76,18 +67,24 @@
76
67
  },
77
68
  "@santi020k/eslint-config-vue": {
78
69
  "optional": true
70
+ },
71
+ "@santi020k/eslint-config-qwik": {
72
+ "optional": true
73
+ },
74
+ "@santi020k/eslint-config-remix": {
75
+ "optional": true
79
76
  }
80
77
  },
81
78
  "devDependencies": {
79
+ "publint": "^0.3.18",
82
80
  "tsup": "^8.5.1",
83
- "typescript": "^5.9.3",
84
- "@typescript-eslint/utils": "^8.57.0"
81
+ "typescript": "^5.9.3"
85
82
  },
86
83
  "publishConfig": {
87
84
  "access": "public"
88
85
  },
89
86
  "engines": {
90
- "node": ">=18.18.0"
87
+ "node": ">=22.12.0"
91
88
  },
92
89
  "license": "MIT",
93
90
  "author": "santi020k",
@@ -95,5 +92,13 @@
95
92
  "type": "git",
96
93
  "url": "git+https://github.com/santi020k/eslint-config-basic.git",
97
94
  "directory": "packages/basic"
95
+ },
96
+ "scripts": {
97
+ "build": "tsup",
98
+ "build:pack": "npm pack",
99
+ "dev": "tsup --watch",
100
+ "clean": "rm -rf dist",
101
+ "check:exports": "publint",
102
+ "typecheck": "tsc --noEmit"
98
103
  }
99
- }
104
+ }
@@ -1,67 +0,0 @@
1
- // src/compose.ts
2
- import tsEslint from "typescript-eslint";
3
- var promoteRuleSeverity = (value) => {
4
- if (value === void 0) return void 0;
5
- if (value === "warn" || value === 1) return "error";
6
- if (Array.isArray(value) && (value[0] === "warn" || value[0] === 1)) {
7
- return ["error", ...value.slice(1)];
8
- }
9
- return value;
10
- };
11
- var applyStrictMode = (configs, strict) => {
12
- if (!strict) return configs;
13
- return configs.map((config) => {
14
- if (config.rules) {
15
- const strictRules = Object.fromEntries(
16
- Object.entries(config.rules).map(([key, value]) => [key, promoteRuleSeverity(value)])
17
- );
18
- return { ...config, rules: strictRules };
19
- }
20
- return config;
21
- });
22
- };
23
- var getTypedRulesOverrides = () => ({
24
- name: "eslint-config-basic/typed-rules-overrides",
25
- files: [
26
- "**/*.js",
27
- "**/*.jsx",
28
- "**/*.mjs",
29
- "**/*.cjs",
30
- "**/*.md",
31
- "**/*.mdx",
32
- "**/*.md/*.ts",
33
- "**/*.md/*.tsx",
34
- "**/*.mdx/*.ts",
35
- "**/*.mdx/*.tsx",
36
- "**/*.astro/*.js",
37
- "**/*.astro/*.ts",
38
- "**/*.vue/*.ts",
39
- "**/*.vue/*.tsx",
40
- "**/*.svelte/*.ts",
41
- "**/*.svelte/*.tsx",
42
- "**/.vitepress/**/*.ts",
43
- "**/.vitepress/**/*.mts",
44
- "**/.vitepress/**/*.tsx",
45
- "**/.vitepress/**/*.js",
46
- "**/.vitepress/**/*.mjs",
47
- "**/.vitepress/**/*.jsx"
48
- ],
49
- languageOptions: {
50
- parserOptions: {
51
- project: null,
52
- program: null,
53
- projectService: false,
54
- allowDefaultProject: true
55
- }
56
- },
57
- rules: {
58
- ...tsEslint.configs.disableTypeChecked.rules,
59
- "no-unused-expressions": "off",
60
- "@typescript-eslint/no-unused-expressions": "off"
61
- }
62
- });
63
-
64
- export {
65
- applyStrictMode,
66
- getTypedRulesOverrides
67
- };
@@ -1,213 +0,0 @@
1
- import {
2
- applyStrictMode,
3
- getTypedRulesOverrides
4
- } from "./chunk-2Z6LYTBS.js";
5
- import {
6
- getOptionalConfigs,
7
- getPrettierConfig
8
- } from "./chunk-WGZBHVWD.js";
9
- import {
10
- resolveFramework,
11
- resolvePreset
12
- } from "./chunk-SSGAWVVA.js";
13
-
14
- // src/index.ts
15
- import {
16
- coreConfig,
17
- createCoreConfig,
18
- detectProjectOptions,
19
- gitignore,
20
- hasReactConfig,
21
- NextMode,
22
- Runtime,
23
- Setting
24
- } from "@santi020k/eslint-config-core";
25
- import { createTypescriptConfig } from "@santi020k/eslint-config-typescript";
26
- import {
27
- Library,
28
- Tool,
29
- Extension,
30
- Setting as Setting2,
31
- Runtime as Runtime2,
32
- Preset,
33
- Testing,
34
- Format,
35
- NextMode as NextMode2,
36
- ReactConfigKeys,
37
- hasReactConfig as hasReactConfig2,
38
- coreConfig as coreConfig2,
39
- createCoreConfig as createCoreConfig2,
40
- getGlobalsForRuntime,
41
- jsConfig,
42
- gitignore as gitignore2,
43
- detectProjectOptions as detectProjectOptions2
44
- } from "@santi020k/eslint-config-core";
45
- import { typescriptConfig, tsConfig } from "@santi020k/eslint-config-typescript";
46
- import {
47
- cspell,
48
- cypress,
49
- graphql,
50
- i18next,
51
- jest,
52
- jsdoc,
53
- jsonc,
54
- markdown,
55
- mdx,
56
- perfectionist,
57
- playwright,
58
- prettier,
59
- regexp,
60
- security,
61
- sonarjs,
62
- stencil,
63
- storybook,
64
- swagger,
65
- tailwind,
66
- tanstackQuery,
67
- tanstackRouter,
68
- testingLibrary,
69
- toml,
70
- unicorn,
71
- vitest,
72
- yaml
73
- } from "@santi020k/eslint-config-optionals";
74
- var eslintConfig = (options) => {
75
- const detected = options === void 0 ? detectProjectOptions() : {};
76
- const presetDefaults = options?.preset ? resolvePreset(options.preset) : {};
77
- const {
78
- typescript = presetDefaults.typescript ?? detected.typescript ?? false,
79
- libraries = presetDefaults.libraries ?? detected.libraries ?? [],
80
- testing = presetDefaults.testing ?? detected.testing ?? [],
81
- formats = presetDefaults.formats ?? detected.formats ?? [],
82
- tools = presetDefaults.tools ?? detected.tools ?? [],
83
- extensions = presetDefaults.extensions ?? detected.extensions ?? [],
84
- settings = detected.settings ?? [],
85
- strict = options?.strict ?? false,
86
- runtime = presetDefaults.runtime ?? detected.runtime ?? Runtime.Universal,
87
- tsconfigRootDir = options?.tsconfigRootDir,
88
- nextMode = presetDefaults.nextMode ?? detected.nextMode ?? NextMode.Pages,
89
- frameworks = { ...presetDefaults.frameworks, ...options?.frameworks }
90
- } = options ?? {};
91
- const uniqueLibraries = [...new Set(libraries)];
92
- const uniqueTesting = [...new Set(testing)];
93
- const uniqueFormats = [...new Set(formats)];
94
- const uniqueTools = [...new Set(tools)];
95
- const uniqueExtensions = [...new Set(extensions)];
96
- const uniqueSettings = [...new Set(settings)];
97
- if ((frameworks.next || frameworks.expo) && !frameworks.react) {
98
- throw new TypeError(
99
- "Next and Expo configurations require frameworks.react. Import @santi020k/eslint-config-react and pass it via frameworks.react."
100
- );
101
- }
102
- const reactParam = resolveFramework("react", frameworks.react);
103
- const nextParam = resolveFramework("next", frameworks.next);
104
- const astroParam = resolveFramework("astro", frameworks.astro);
105
- const expoParam = resolveFramework("expo", frameworks.expo);
106
- const nestParam = resolveFramework("nest", frameworks.nest);
107
- const vueParam = resolveFramework("vue", frameworks.vue);
108
- const svelteParam = resolveFramework("svelte", frameworks.svelte);
109
- const solidParam = resolveFramework("solid", frameworks.solid);
110
- const angularParam = resolveFramework("angular", frameworks.angular);
111
- const hasReact = hasReactConfig({ frameworks });
112
- const useGitignore = !uniqueSettings.includes(Setting.NoGitignore);
113
- const runtimeCoreConfig = runtime !== Runtime.Universal ? createCoreConfig(runtime) : coreConfig;
114
- const configs = [
115
- // Settings
116
- ...useGitignore ? gitignore : [],
117
- // Global TSConfig Root Dir fix
118
- ...tsconfigRootDir ? [{
119
- name: "eslint-config-basic/tsconfig-root-dir",
120
- languageOptions: {
121
- parserOptions: {
122
- tsconfigRootDir
123
- }
124
- }
125
- }] : [],
126
- // Core JS config with runtime-aware globals
127
- ...runtimeCoreConfig,
128
- // React config (included if any React-based framework is used/passed)
129
- ...hasReact ? reactParam : [],
130
- // Framework-specific configs (Modularized)
131
- ...typescript ? createTypescriptConfig({ tsconfigRootDir }) : [],
132
- ...nextParam,
133
- // Next.js App Router overrides (#12)
134
- ...frameworks.next && nextMode === NextMode.AppRouter ? [
135
- {
136
- name: "eslint-config-next/app-router-overrides",
137
- files: ["app/**/*.{ts,tsx}"],
138
- rules: {
139
- "@next/next/no-html-link-for-pages": "off"
140
- }
141
- }
142
- ] : [],
143
- ...astroParam,
144
- ...expoParam,
145
- ...nestParam,
146
- ...vueParam,
147
- ...svelteParam,
148
- ...solidParam,
149
- ...angularParam,
150
- // Optionals
151
- ...getOptionalConfigs(
152
- uniqueLibraries,
153
- uniqueTools,
154
- uniqueTesting,
155
- uniqueFormats,
156
- uniqueExtensions
157
- ),
158
- // Global overrides for non-TS files
159
- getTypedRulesOverrides(),
160
- // Prettier always last
161
- ...getPrettierConfig(uniqueTools)
162
- ];
163
- return applyStrictMode(configs, strict);
164
- };
165
-
166
- export {
167
- eslintConfig,
168
- Library,
169
- Tool,
170
- Extension,
171
- Setting2 as Setting,
172
- Runtime2 as Runtime,
173
- Preset,
174
- Testing,
175
- Format,
176
- NextMode2 as NextMode,
177
- ReactConfigKeys,
178
- hasReactConfig2 as hasReactConfig,
179
- coreConfig2 as coreConfig,
180
- createCoreConfig2 as createCoreConfig,
181
- getGlobalsForRuntime,
182
- jsConfig,
183
- gitignore2 as gitignore,
184
- detectProjectOptions2 as detectProjectOptions,
185
- typescriptConfig,
186
- tsConfig,
187
- cspell,
188
- cypress,
189
- graphql,
190
- i18next,
191
- jest,
192
- jsdoc,
193
- jsonc,
194
- markdown,
195
- mdx,
196
- perfectionist,
197
- playwright,
198
- prettier,
199
- regexp,
200
- security,
201
- sonarjs,
202
- stencil,
203
- storybook,
204
- swagger,
205
- tailwind,
206
- tanstackQuery,
207
- tanstackRouter,
208
- testingLibrary,
209
- toml,
210
- unicorn,
211
- vitest,
212
- yaml
213
- };
@@ -1,52 +0,0 @@
1
- // src/resolvers.ts
2
- import {
3
- Extension,
4
- Format,
5
- Library,
6
- Preset,
7
- Runtime,
8
- Testing,
9
- Tool
10
- } from "@santi020k/eslint-config-core";
11
- var resolveFramework = (frameworkName, framework) => {
12
- if (!framework) return [];
13
- if (framework === true) {
14
- throw new TypeError(
15
- `Framework "${frameworkName}" requires an imported config. Install @santi020k/eslint-config-${frameworkName} and pass it via frameworks.${frameworkName}.`
16
- );
17
- }
18
- return Array.isArray(framework) ? framework : framework.default;
19
- };
20
- var resolvePreset = (preset) => {
21
- switch (preset) {
22
- case Preset.Basic:
23
- return { runtime: Runtime.Universal };
24
- case Preset.Node:
25
- return {
26
- typescript: true,
27
- runtime: Runtime.Node
28
- };
29
- case Preset.Browser:
30
- return {
31
- typescript: true,
32
- runtime: Runtime.Browser
33
- };
34
- case Preset.All:
35
- return {
36
- typescript: true,
37
- libraries: Object.values(Library),
38
- tools: Object.values(Tool),
39
- testing: Object.values(Testing),
40
- formats: Object.values(Format),
41
- extensions: Object.values(Extension),
42
- runtime: Runtime.Universal
43
- };
44
- default:
45
- return {};
46
- }
47
- };
48
-
49
- export {
50
- resolveFramework,
51
- resolvePreset
52
- };
@@ -1,71 +0,0 @@
1
- // src/optionals.ts
2
- import {
3
- Extension,
4
- Format,
5
- Library,
6
- Testing,
7
- Tool
8
- } from "@santi020k/eslint-config-core";
9
- import {
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
- var 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.Regexp)) configs.push(...regexp);
58
- if (extensions.includes(Extension.Unicorn)) configs.push(...unicorn);
59
- if (extensions.includes(Extension.Sonarjs)) configs.push(...sonarjs);
60
- if (extensions.includes(Extension.Security)) configs.push(...security);
61
- if (extensions.includes(Extension.Perfectionist)) configs.push(...perfectionist);
62
- if (tools.includes(Tool.Jsdoc)) configs.push(...jsdoc);
63
- if (tools.includes(Tool.Swagger)) configs.push(...swagger);
64
- return configs;
65
- };
66
- var getPrettierConfig = (tools) => tools.includes(Tool.Prettier) ? prettier : [];
67
-
68
- export {
69
- getOptionalConfigs,
70
- getPrettierConfig
71
- };