@santi020k/eslint-config-basic 0.8.1 → 1.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.
- package/CHANGELOG.md +87 -4
- package/LICENSE +21 -0
- package/README.md +7 -29
- package/dist/cli.js +11 -18
- package/dist/compose.d.ts +1 -6
- package/dist/compose.js +21 -6
- package/dist/index.js +136 -25
- package/dist/optionals.js +64 -3
- package/dist/resolvers.d.ts +2 -2
- package/dist/resolvers.js +54 -3
- package/package.json +36 -31
- package/dist/chunk-2Z6LYTBS.js +0 -67
- package/dist/chunk-CH2MVUQN.js +0 -213
- package/dist/chunk-SSGAWVVA.js +0 -52
- package/dist/chunk-WGZBHVWD.js +0 -71
package/CHANGELOG.md
CHANGED
|
@@ -1,11 +1,96 @@
|
|
|
1
1
|
# @santi020k/eslint-config-basic
|
|
2
2
|
|
|
3
|
+
## 1.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#70](https://github.com/santi020k/eslint-config-basic/pull/70) [`ef658c1`](https://github.com/santi020k/eslint-config-basic/commit/ef658c170f6eaadce14a7e662eaa2a3762362e82) Thanks [@santi020k](https://github.com/santi020k)! - # 1.1.0 Release
|
|
8
|
+
|
|
9
|
+
## Update Highlights
|
|
10
|
+
|
|
11
|
+
- **ESLint 10 Support**: Harmonized ESLint version to `^10.1.0` across the monorepo and playgrounds.
|
|
12
|
+
- **Security Patches**: Fixed vulnerabilities in `lodash`, `esbuild`, and `path-to-regexp` via root overrides.
|
|
13
|
+
- **Solid Playground Fix**: Resolved `MODULE_NOT_FOUND` error in the Solid playground linting process.
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- Updated dependencies [[`ef658c1`](https://github.com/santi020k/eslint-config-basic/commit/ef658c170f6eaadce14a7e662eaa2a3762362e82)]:
|
|
18
|
+
- @santi020k/eslint-config-core@1.1.0
|
|
19
|
+
- @santi020k/eslint-config-typescript@1.1.0
|
|
20
|
+
- @santi020k/eslint-config-astro@1.1.0
|
|
21
|
+
- @santi020k/eslint-config-vue@1.1.0
|
|
22
|
+
- @santi020k/eslint-config-optionals@1.1.0
|
|
23
|
+
- @santi020k/eslint-config-qwik@1.1.0
|
|
24
|
+
- @santi020k/eslint-config-remix@1.1.0
|
|
25
|
+
- @santi020k/eslint-config-angular@1.1.0
|
|
26
|
+
- @santi020k/eslint-config-expo@1.1.0
|
|
27
|
+
- @santi020k/eslint-config-nest@1.1.0
|
|
28
|
+
- @santi020k/eslint-config-next@1.1.0
|
|
29
|
+
- @santi020k/eslint-config-react@1.1.0
|
|
30
|
+
- @santi020k/eslint-config-solid@1.1.0
|
|
31
|
+
- @santi020k/eslint-config-svelte@1.1.0
|
|
32
|
+
|
|
33
|
+
## 1.0.0
|
|
34
|
+
|
|
35
|
+
### Minor Changes
|
|
36
|
+
|
|
37
|
+
- [#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
|
|
38
|
+
|
|
39
|
+
## Major Changes
|
|
40
|
+
|
|
41
|
+
- **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.
|
|
42
|
+
- **neostandard removal**: Removed `neostandard` dependency to provide more granular control and modularity in core rules.
|
|
43
|
+
- **Stylistic v4 -> v5**: Upgraded to `@stylistic/eslint-plugin` version 5.x for improved formatting rules and TypeScript 5.7+ support.
|
|
44
|
+
- **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.
|
|
45
|
+
- **React 19 Support**: Updated React detection logic and configurations to support React 19.
|
|
46
|
+
|
|
47
|
+
## Framework Updates
|
|
48
|
+
|
|
49
|
+
- **Qwik & Remix Support**: Added comprehensive ESLint configurations and functional playground environments for both Qwik and Remix frameworks.
|
|
50
|
+
- **Dependency Alignment**: Resolved critical `typescript-eslint` dependency issues in Astro, Svelte, and Vue packages to ensure proper rule resolution and type safety.
|
|
51
|
+
- **Consistency Refinements**: Standardized `disable-type-checked` rule blocks across all framework-specific configurations.
|
|
52
|
+
- **Documentation Overhaul**: Major documentation refresh in root `README.md` and VitePress documentation. Added clarity on configuration priority, framework auto-detection, and full-settings examples.
|
|
53
|
+
|
|
54
|
+
## Maintenance
|
|
55
|
+
|
|
56
|
+
- **Corepack Enablement**: Added `corepack` support for automated package manager version management.
|
|
57
|
+
- **Turbo Update**: Bumped Turborepo to v2.9+ for faster builds and improved task caching.
|
|
58
|
+
- **Turbo Optimizations**: Configured Turborepo to output in `errors-only` mode with `errorsOnlyShowHash` enabled, significantly reducing terminal noise during build and lint tasks.
|
|
59
|
+
- **Integration Test Improvements**: Enhanced integration tests to be more robust, including proper `tsconfigRootDir` handling and better React version validation.
|
|
60
|
+
- **Playground Synchronization**: Updated all playground packages to maintain parity with the latest framework rules.
|
|
61
|
+
|
|
62
|
+
- [#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
|
|
63
|
+
|
|
64
|
+
This release introduces a new standard configuration in `@santi020k/eslint-config-core` and addresses several technical issues:
|
|
65
|
+
|
|
66
|
+
- Fixed global typecheck failures across the monorepo.
|
|
67
|
+
- Resolved pre-commit hook issues with cspell.
|
|
68
|
+
- Fixed pre-push hook failures related to publint in the playground package.
|
|
69
|
+
- Added missing test coverage scripts and fixed CI build failures.
|
|
70
|
+
|
|
71
|
+
### Patch Changes
|
|
72
|
+
|
|
73
|
+
- Updated dependencies [[`6f2f473`](https://github.com/santi020k/eslint-config-basic/commit/6f2f4733642087eb9eac22a7b6193b71453f375d), [`d8e4b4a`](https://github.com/santi020k/eslint-config-basic/commit/d8e4b4a61c2739dbffa3c823d8742ea234c5b731)]:
|
|
74
|
+
- @santi020k/eslint-config-angular@1.0.0
|
|
75
|
+
- @santi020k/eslint-config-astro@1.0.0
|
|
76
|
+
- @santi020k/eslint-config-core@1.0.0
|
|
77
|
+
- @santi020k/eslint-config-expo@1.0.0
|
|
78
|
+
- @santi020k/eslint-config-nest@1.0.0
|
|
79
|
+
- @santi020k/eslint-config-next@1.0.0
|
|
80
|
+
- @santi020k/eslint-config-optionals@1.0.0
|
|
81
|
+
- @santi020k/eslint-config-qwik@0.8.2
|
|
82
|
+
- @santi020k/eslint-config-react@1.0.0
|
|
83
|
+
- @santi020k/eslint-config-remix@0.8.2
|
|
84
|
+
- @santi020k/eslint-config-solid@1.0.0
|
|
85
|
+
- @santi020k/eslint-config-svelte@1.0.0
|
|
86
|
+
- @santi020k/eslint-config-typescript@1.0.0
|
|
87
|
+
- @santi020k/eslint-config-vue@1.0.0
|
|
88
|
+
|
|
3
89
|
## 0.8.1
|
|
4
90
|
|
|
5
91
|
### Minor Changes
|
|
6
92
|
|
|
7
93
|
- 13e8e5a: # Release 0.8.0
|
|
8
|
-
|
|
9
94
|
- **Snippet Fixes**: Resolved ESLint parsing errors in virtual TypeScript files within Markdown, Astro, and VitePress code blocks by disabling type-aware rules for those snippets.
|
|
10
95
|
- **Standalone TS Support**: Restored `disableTypeChecked` configuration in the TypeScript package, ensuring it remains fully functional and parsing-error-free when used without the main composer.
|
|
11
96
|
- **Documentation Reorganization**: Significantly expanded and restructured the documentation site, adding new pages for the Inspector, CLI Tooling, Extensions, and better framework-specific guides.
|
|
@@ -14,7 +99,7 @@
|
|
|
14
99
|
|
|
15
100
|
### Patch Changes
|
|
16
101
|
|
|
17
|
-
-
|
|
102
|
+
- CI & Workflow Stabilization
|
|
18
103
|
|
|
19
104
|
- Fixed invalid `actions/setup-node` version from `@v6` to `@v4` in Release and Docs workflows.
|
|
20
105
|
- Improved CLI test performance and reliability by refactoring integration tests into fast in-memory unit tests.
|
|
@@ -131,7 +216,6 @@
|
|
|
131
216
|
### Minor Changes
|
|
132
217
|
|
|
133
218
|
- [#28](https://github.com/santi020k/eslint-config-basic/pull/28) [`162afdb`](https://github.com/santi020k/eslint-config-basic/commit/162afdb2f0a30714487915bdf083234426018ad2) Thanks [@santi020k](https://github.com/santi020k)! - feat: add `regexp` optional config with `eslint-plugin-regexp`
|
|
134
|
-
|
|
135
219
|
- New `OptionalOption.Regexp` to enable regex linting via `eslint-plugin-regexp`
|
|
136
220
|
- Catches common regex mistakes: exponential backtracking, unnecessary escapes, and optimizable character classes
|
|
137
221
|
- Uses recommended rules with selective overrides for smoother adoption
|
|
@@ -156,7 +240,6 @@
|
|
|
156
240
|
### Minor Changes
|
|
157
241
|
|
|
158
242
|
- feat: add Nest.js, Vue, and Expo ESLint configs with optionals package
|
|
159
|
-
|
|
160
243
|
- Added `@santi020k/eslint-config-nest` with NestJS-specific linting rules
|
|
161
244
|
- Added `@santi020k/eslint-config-vue` with Vue 3 linting rules
|
|
162
245
|
- Added `@santi020k/eslint-config-expo` with Expo/React Native linting rules
|
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,27 @@
|
|
|
3
3
|
[](https://github.com/santi020k/eslint-config-basic/actions/workflows/build.yml)
|
|
4
4
|
[](https://www.npmjs.com/package/@santi020k/eslint-config-basic)
|
|
5
5
|
[](https://www.npmjs.com/package/@santi020k/eslint-config-basic)
|
|
6
|
-
[](https://santi020k.github.io/eslint-config-basic/)
|
|
7
6
|
[](https://github.com/santi020k/eslint-config-basic/blob/main/LICENSE)
|
|
8
7
|
|
|
9
|
-
Composable ESLint 10+ flat-config
|
|
8
|
+
Composable ESLint 10+ flat-config for JavaScript, TypeScript, and all major frameworks.
|
|
10
9
|
|
|
11
|
-
|
|
10
|
+
This is the main entry point of the [`@santi020k/eslint-config-basic`](https://github.com/santi020k/eslint-config-basic) monorepo.
|
|
12
11
|
|
|
13
|
-
- Docs
|
|
14
|
-
- Repository: [
|
|
12
|
+
- Docs: [eslint.santi020k.me](https://eslint.santi020k.me/)
|
|
13
|
+
- Repository: [santi020k/eslint-config-basic](https://github.com/santi020k/eslint-config-basic)
|
|
15
14
|
- Author: [santi020k](https://santi020k.me)
|
|
16
15
|
|
|
17
|
-
|
|
18
|
-
> The docs site is built with VitePress. The planned production hostname is `eslint.santi020k.me`.
|
|
19
|
-
|
|
20
|
-
## Quick Start
|
|
16
|
+
## Quick start
|
|
21
17
|
|
|
22
18
|
```bash
|
|
23
19
|
npm install -D eslint @santi020k/eslint-config-basic
|
|
24
20
|
```
|
|
25
21
|
|
|
26
22
|
```js
|
|
23
|
+
// eslint.config.js
|
|
27
24
|
import { eslintConfig } from '@santi020k/eslint-config-basic'
|
|
28
25
|
|
|
29
26
|
export default eslintConfig()
|
|
30
27
|
```
|
|
31
28
|
|
|
32
|
-
|
|
33
|
-
|
|
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)
|
|
44
|
-
|
|
45
|
-
## Development
|
|
46
|
-
|
|
47
|
-
```bash
|
|
48
|
-
npm run docs:dev
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
That command regenerates the API markdown and starts the VitePress site from [`packages/docs`](/Users/smith/Projects/santi020k/eslint-config-basic/packages/docs).
|
|
29
|
+
Auto-detects TypeScript, frameworks, and common tools from your `package.json`. See the [full docs](https://eslint.santi020k.me/) for all options.
|
package/dist/cli.js
CHANGED
|
@@ -1,16 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
} from "
|
|
5
|
-
import "./
|
|
6
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
8
|
+
export { applyStrictMode };
|
package/dist/compose.js
CHANGED
|
@@ -1,8 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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,42 @@
|
|
|
1
|
+
import { applyStrictMode } from "./compose.js";
|
|
2
|
+
import { getOptionalConfigs, getPrettierConfig } from "./optionals.js";
|
|
3
|
+
import { resolveFramework, resolvePreset } from "./resolvers.js";
|
|
1
4
|
import {
|
|
5
|
+
coreConfig,
|
|
6
|
+
createCoreConfig,
|
|
7
|
+
detectProjectOptions,
|
|
8
|
+
gitignore,
|
|
9
|
+
NextMode,
|
|
10
|
+
Runtime,
|
|
11
|
+
Setting
|
|
12
|
+
} from "@santi020k/eslint-config-core";
|
|
13
|
+
import { createTypescriptConfig } from "@santi020k/eslint-config-typescript";
|
|
14
|
+
import {
|
|
15
|
+
coreConfig as coreConfig2,
|
|
16
|
+
createCoreConfig as createCoreConfig2,
|
|
17
|
+
detectProjectOptions as detectProjectOptions2,
|
|
2
18
|
Extension,
|
|
3
19
|
Format,
|
|
20
|
+
getGlobalsForRuntime,
|
|
21
|
+
gitignore as gitignore2,
|
|
22
|
+
hasReactConfig,
|
|
23
|
+
jsConfig,
|
|
4
24
|
Library,
|
|
5
|
-
NextMode,
|
|
25
|
+
NextMode as NextMode2,
|
|
6
26
|
Preset,
|
|
7
27
|
ReactConfigKeys,
|
|
8
|
-
Runtime,
|
|
9
|
-
Setting,
|
|
28
|
+
Runtime as Runtime2,
|
|
29
|
+
Setting as Setting2,
|
|
10
30
|
Testing,
|
|
11
|
-
Tool
|
|
12
|
-
|
|
13
|
-
|
|
31
|
+
Tool
|
|
32
|
+
} from "@santi020k/eslint-config-core";
|
|
33
|
+
import { tsConfig, typescriptConfig } from "@santi020k/eslint-config-typescript";
|
|
34
|
+
import {
|
|
14
35
|
cspell,
|
|
15
36
|
cypress,
|
|
16
|
-
detectProjectOptions,
|
|
17
|
-
eslintConfig,
|
|
18
|
-
getGlobalsForRuntime,
|
|
19
|
-
gitignore,
|
|
20
37
|
graphql,
|
|
21
|
-
hasReactConfig,
|
|
22
38
|
i18next,
|
|
23
39
|
jest,
|
|
24
|
-
jsConfig,
|
|
25
40
|
jsdoc,
|
|
26
41
|
jsonc,
|
|
27
42
|
markdown,
|
|
@@ -40,34 +55,130 @@ import {
|
|
|
40
55
|
tanstackRouter,
|
|
41
56
|
testingLibrary,
|
|
42
57
|
toml,
|
|
43
|
-
tsConfig,
|
|
44
|
-
typescriptConfig,
|
|
45
58
|
unicorn,
|
|
46
59
|
vitest,
|
|
47
60
|
yaml
|
|
48
|
-
} from "
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
61
|
+
} from "@santi020k/eslint-config-optionals";
|
|
62
|
+
const eslintConfig = (options) => {
|
|
63
|
+
const detected = detectProjectOptions();
|
|
64
|
+
const preset = options?.preset ?? detected.preset;
|
|
65
|
+
const presetDefaults = preset ? resolvePreset(preset) : {};
|
|
66
|
+
const {
|
|
67
|
+
typescript = presetDefaults.typescript ?? detected.typescript ?? false,
|
|
68
|
+
libraries = presetDefaults.libraries ?? detected.libraries ?? [],
|
|
69
|
+
testing = presetDefaults.testing ?? detected.testing ?? [],
|
|
70
|
+
formats = presetDefaults.formats ?? detected.formats ?? [],
|
|
71
|
+
tools = presetDefaults.tools ?? detected.tools ?? [],
|
|
72
|
+
extensions = presetDefaults.extensions ?? detected.extensions ?? [],
|
|
73
|
+
settings = options?.settings ?? detected.settings ?? [],
|
|
74
|
+
strict = options?.strict ?? false,
|
|
75
|
+
runtime = presetDefaults.runtime ?? detected.runtime ?? Runtime.Universal,
|
|
76
|
+
tsconfigRootDir = options?.tsconfigRootDir,
|
|
77
|
+
nextMode = presetDefaults.nextMode ?? detected.nextMode ?? NextMode.Pages,
|
|
78
|
+
frameworks = { ...presetDefaults.frameworks, ...options?.frameworks }
|
|
79
|
+
} = options ?? {};
|
|
80
|
+
const uniqueLibraries = [...new Set(libraries)];
|
|
81
|
+
const uniqueTesting = [...new Set(testing)];
|
|
82
|
+
const uniqueFormats = [...new Set(formats)];
|
|
83
|
+
const uniqueTools = [...new Set(tools)];
|
|
84
|
+
const uniqueExtensions = [...new Set(extensions)];
|
|
85
|
+
const uniqueSettings = [...new Set(settings)];
|
|
86
|
+
if ((frameworks.next || frameworks.expo) && !frameworks.react) {
|
|
87
|
+
throw new TypeError(
|
|
88
|
+
"Next and Expo configurations require frameworks.react. Import @santi020k/eslint-config-react and pass it via frameworks.react."
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
const hasReact = !!frameworks.react;
|
|
92
|
+
const hasVue = !!frameworks.vue;
|
|
93
|
+
const hasSvelte = !!frameworks.svelte;
|
|
94
|
+
const hasSolid = !!frameworks.solid;
|
|
95
|
+
const useGitignore = !uniqueSettings.includes(Setting.NoGitignore);
|
|
96
|
+
const reactParam = resolveFramework("react", frameworks.react);
|
|
97
|
+
const nextParam = resolveFramework("next", frameworks.next);
|
|
98
|
+
const astroParam = resolveFramework("astro", frameworks.astro, {
|
|
99
|
+
hasReact,
|
|
100
|
+
hasVue,
|
|
101
|
+
hasSvelte,
|
|
102
|
+
hasSolid
|
|
103
|
+
});
|
|
104
|
+
const expoParam = resolveFramework("expo", frameworks.expo);
|
|
105
|
+
const nestParam = resolveFramework("nest", frameworks.nest);
|
|
106
|
+
const vueParam = resolveFramework("vue", frameworks.vue);
|
|
107
|
+
const svelteParam = resolveFramework("svelte", frameworks.svelte);
|
|
108
|
+
const solidParam = resolveFramework("solid", frameworks.solid);
|
|
109
|
+
const angularParam = resolveFramework("angular", frameworks.angular);
|
|
110
|
+
const qwikParam = resolveFramework("qwik", frameworks.qwik);
|
|
111
|
+
const remixParam = resolveFramework("remix", frameworks.remix);
|
|
112
|
+
const runtimeCoreConfig = runtime !== Runtime.Universal ? createCoreConfig(runtime) : coreConfig;
|
|
113
|
+
const configs = [
|
|
114
|
+
// Settings
|
|
115
|
+
...useGitignore ? gitignore : [],
|
|
116
|
+
// Global TSConfig Root Dir fix
|
|
117
|
+
...tsconfigRootDir ? [{
|
|
118
|
+
name: "eslint-config-basic/tsconfig-root-dir",
|
|
119
|
+
languageOptions: {
|
|
120
|
+
parserOptions: {
|
|
121
|
+
tsconfigRootDir
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}] : [],
|
|
125
|
+
// Core JS config with runtime-aware globals
|
|
126
|
+
...runtimeCoreConfig,
|
|
127
|
+
// React config (included if any React-based framework is used/passed)
|
|
128
|
+
...hasReact ? reactParam : [],
|
|
129
|
+
...nextParam,
|
|
130
|
+
...astroParam,
|
|
131
|
+
...expoParam,
|
|
132
|
+
...nestParam,
|
|
133
|
+
...vueParam,
|
|
134
|
+
...svelteParam,
|
|
135
|
+
...solidParam,
|
|
136
|
+
...angularParam,
|
|
137
|
+
...qwikParam,
|
|
138
|
+
...remixParam,
|
|
139
|
+
...typescript ? createTypescriptConfig({ tsconfigRootDir }) : [],
|
|
140
|
+
// Next.js App Router overrides (#12)
|
|
141
|
+
...frameworks.next && nextMode === NextMode.AppRouter ? [
|
|
142
|
+
{
|
|
143
|
+
name: "eslint-config-next/app-router-overrides",
|
|
144
|
+
files: ["app/**/*.{ts,tsx}"],
|
|
145
|
+
rules: {
|
|
146
|
+
"@next/next/no-html-link-for-pages": "off"
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
] : [],
|
|
150
|
+
// Optionals
|
|
151
|
+
...getOptionalConfigs(
|
|
152
|
+
uniqueLibraries,
|
|
153
|
+
uniqueTools,
|
|
154
|
+
uniqueTesting,
|
|
155
|
+
uniqueFormats,
|
|
156
|
+
uniqueExtensions
|
|
157
|
+
),
|
|
158
|
+
// Prettier always last
|
|
159
|
+
...getPrettierConfig(uniqueTools)
|
|
160
|
+
];
|
|
161
|
+
return applyStrictMode(configs, strict);
|
|
162
|
+
};
|
|
52
163
|
export {
|
|
53
164
|
Extension,
|
|
54
165
|
Format,
|
|
55
166
|
Library,
|
|
56
|
-
NextMode,
|
|
167
|
+
NextMode2 as NextMode,
|
|
57
168
|
Preset,
|
|
58
169
|
ReactConfigKeys,
|
|
59
|
-
Runtime,
|
|
60
|
-
Setting,
|
|
170
|
+
Runtime2 as Runtime,
|
|
171
|
+
Setting2 as Setting,
|
|
61
172
|
Testing,
|
|
62
173
|
Tool,
|
|
63
|
-
coreConfig,
|
|
64
|
-
createCoreConfig,
|
|
174
|
+
coreConfig2 as coreConfig,
|
|
175
|
+
createCoreConfig2 as createCoreConfig,
|
|
65
176
|
cspell,
|
|
66
177
|
cypress,
|
|
67
|
-
detectProjectOptions,
|
|
178
|
+
detectProjectOptions2 as detectProjectOptions,
|
|
68
179
|
eslintConfig,
|
|
69
180
|
getGlobalsForRuntime,
|
|
70
|
-
gitignore,
|
|
181
|
+
gitignore2 as gitignore,
|
|
71
182
|
graphql,
|
|
72
183
|
hasReactConfig,
|
|
73
184
|
i18next,
|
package/dist/optionals.js
CHANGED
|
@@ -1,7 +1,68 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ImportedFramework, FlatConfigArray, Preset, EslintConfigOptions } from '@santi020k/eslint-config-core';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Resolves an imported framework (either array
|
|
4
|
+
* Resolves an imported framework (either array, object with default, or factory function) into a config array.
|
|
5
5
|
*/
|
|
6
|
-
declare const resolveFramework: (frameworkName: string, framework?: ImportedFramework) => FlatConfigArray;
|
|
6
|
+
declare const resolveFramework: (frameworkName: string, framework?: ImportedFramework, options?: Record<string, unknown>) => FlatConfigArray;
|
|
7
7
|
/**
|
|
8
8
|
* Resolves a preset into options
|
|
9
9
|
*/
|
package/dist/resolvers.js
CHANGED
|
@@ -1,7 +1,58 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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, options) => {
|
|
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
|
+
if (typeof framework === "function") {
|
|
18
|
+
return framework(options);
|
|
19
|
+
}
|
|
20
|
+
if (typeof framework === "object" && "default" in framework) {
|
|
21
|
+
if (typeof framework.default === "function") {
|
|
22
|
+
return framework.default(options);
|
|
23
|
+
}
|
|
24
|
+
return framework.default;
|
|
25
|
+
}
|
|
26
|
+
return Array.isArray(framework) ? framework : [];
|
|
27
|
+
};
|
|
28
|
+
const resolvePreset = (preset) => {
|
|
29
|
+
switch (preset) {
|
|
30
|
+
case Preset.Basic:
|
|
31
|
+
return { runtime: Runtime.Universal };
|
|
32
|
+
case Preset.Node:
|
|
33
|
+
return {
|
|
34
|
+
typescript: true,
|
|
35
|
+
runtime: Runtime.Node
|
|
36
|
+
};
|
|
37
|
+
case Preset.Browser:
|
|
38
|
+
return {
|
|
39
|
+
typescript: true,
|
|
40
|
+
runtime: Runtime.Browser
|
|
41
|
+
};
|
|
42
|
+
case Preset.All:
|
|
43
|
+
return {
|
|
44
|
+
typescript: true,
|
|
45
|
+
libraries: Object.values(Library),
|
|
46
|
+
tools: Object.values(Tool),
|
|
47
|
+
testing: Object.values(Testing),
|
|
48
|
+
formats: Object.values(Format),
|
|
49
|
+
extensions: Object.values(Extension),
|
|
50
|
+
runtime: Runtime.Universal
|
|
51
|
+
};
|
|
52
|
+
default:
|
|
53
|
+
return {};
|
|
54
|
+
}
|
|
55
|
+
};
|
|
5
56
|
export {
|
|
6
57
|
resolveFramework,
|
|
7
58
|
resolvePreset
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@santi020k/eslint-config-basic",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "A
|
|
3
|
+
"version": "1.1.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
|
-
"
|
|
35
|
-
"@
|
|
36
|
-
"@santi020k/eslint-config-
|
|
37
|
-
"eslint": "^
|
|
38
|
-
"typescript
|
|
24
|
+
"eslint": "^9.0.0 || ^10.0.0",
|
|
25
|
+
"@typescript-eslint/utils": "^8.57.0",
|
|
26
|
+
"@santi020k/eslint-config-core": "^1.1.0",
|
|
27
|
+
"@santi020k/eslint-config-optionals": "^1.1.0",
|
|
28
|
+
"@santi020k/eslint-config-typescript": "^1.1.0"
|
|
39
29
|
},
|
|
40
30
|
"peerDependencies": {
|
|
41
|
-
"@santi020k/eslint-config-angular": "^
|
|
42
|
-
"@santi020k/eslint-config-astro": "^
|
|
43
|
-
"@santi020k/eslint-config-expo": "^
|
|
44
|
-
"@santi020k/eslint-config-nest": "^
|
|
45
|
-
"@santi020k/eslint-config-next": "^
|
|
46
|
-
"@santi020k/eslint-config-react": "^
|
|
47
|
-
"@santi020k/eslint-config-solid": "^
|
|
48
|
-
"@santi020k/eslint-config-svelte": "^
|
|
49
|
-
"@santi020k/eslint-config-vue": "^
|
|
50
|
-
"eslint": "^
|
|
31
|
+
"@santi020k/eslint-config-angular": "^1.1.0",
|
|
32
|
+
"@santi020k/eslint-config-astro": "^1.1.0",
|
|
33
|
+
"@santi020k/eslint-config-expo": "^1.1.0",
|
|
34
|
+
"@santi020k/eslint-config-nest": "^1.1.0",
|
|
35
|
+
"@santi020k/eslint-config-next": "^1.1.0",
|
|
36
|
+
"@santi020k/eslint-config-react": "^1.1.0",
|
|
37
|
+
"@santi020k/eslint-config-solid": "^1.1.0",
|
|
38
|
+
"@santi020k/eslint-config-svelte": "^1.1.0",
|
|
39
|
+
"@santi020k/eslint-config-vue": "^1.1.0",
|
|
40
|
+
"@santi020k/eslint-config-qwik": "^1.1.0",
|
|
41
|
+
"@santi020k/eslint-config-remix": "^1.1.0"
|
|
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": ">=
|
|
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
|
+
}
|
package/dist/chunk-2Z6LYTBS.js
DELETED
|
@@ -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
|
-
};
|
package/dist/chunk-CH2MVUQN.js
DELETED
|
@@ -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
|
-
};
|
package/dist/chunk-SSGAWVVA.js
DELETED
|
@@ -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
|
-
};
|
package/dist/chunk-WGZBHVWD.js
DELETED
|
@@ -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
|
-
};
|