@santi020k/eslint-config-basic 0.1.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +21 -0
- package/dist/index.js +129 -0
- package/package.json +47 -50
- package/.agent/rules/context.md +0 -78
- package/.agent/rules/guidelines.md +0 -124
- package/.editorconfig +0 -13
- package/.env.example +0 -8
- package/.github/CODEOWNERS +0 -2
- package/.github/DISCUSSION_TEMPLATE/rfcs.yml +0 -21
- package/.github/DISCUSSION_TEMPLATE/technical-discussions.yml +0 -21
- package/.github/FUNDING.yml +0 -2
- package/.github/ISSUE_TEMPLATE/README.md +0 -13
- package/.github/ISSUE_TEMPLATE/bug_report.yml +0 -69
- package/.github/ISSUE_TEMPLATE/config.yml +0 -8
- package/.github/ISSUE_TEMPLATE/feature_request.yml +0 -43
- package/.github/ISSUE_TEMPLATE/question.yml +0 -22
- package/.github/SECURITY.md +0 -12
- package/.github/SPONSORSHIPS.md +0 -27
- package/.github/dependabot.yml +0 -45
- package/.github/labeler.yml +0 -46
- package/.github/pull_request_template.md +0 -56
- package/.github/workflows/assign-issues.yml +0 -18
- package/.github/workflows/audit.yml +0 -22
- package/.github/workflows/build.yml +0 -29
- package/.github/workflows/codeql.yml +0 -40
- package/.github/workflows/docs.yml +0 -49
- package/.github/workflows/labeler.yml +0 -18
- package/.github/workflows/publish.yml +0 -24
- package/.github/workflows/release.yml +0 -35
- package/.github/workflows/size-check.yml +0 -23
- package/.github/workflows/stale.yml +0 -31
- package/.nvmrc +0 -1
- package/.vscode/extensions.json +0 -10
- package/.vscode/settings.json +0 -55
- package/CHANGELOG.md +0 -16
- package/CONTRIBUTING.md +0 -194
- package/DEVELOPMENT.md +0 -4
- package/LICENSE +0 -21
- package/README.md +0 -275
- package/config/.husky/commit-msg +0 -9
- package/config/.husky/pre-commit +0 -1
- package/config/.husky/pre-push +0 -1
- package/config/.husky/prepare-commit-msg +0 -1
- package/cspell.config.yaml +0 -2
- package/eslint.config.js +0 -21
- package/llms.txt +0 -72
- package/packages/astro/README.md +0 -13
- package/packages/astro/package.json +0 -45
- package/packages/astro/src/ambient.d.ts +0 -10
- package/packages/astro/src/index.ts +0 -18
- package/packages/astro/src/rules.ts +0 -29
- package/packages/astro/tsconfig.json +0 -9
- package/packages/astro/tsup.config.ts +0 -11
- package/packages/basic/README.md +0 -33
- package/packages/basic/package.json +0 -55
- package/packages/basic/src/index.ts +0 -110
- package/packages/basic/tsconfig.json +0 -9
- package/packages/basic/tsup.config.ts +0 -18
- package/packages/core/README.md +0 -14
- package/packages/core/index.ts +0 -14
- package/packages/core/package.json +0 -61
- package/packages/core/src/ambient.d.ts +0 -61
- package/packages/core/src/index.ts +0 -75
- package/packages/core/src/rules.ts +0 -157
- package/packages/core/src/settings/gitignore.ts +0 -10
- package/packages/core/src/settings/index.ts +0 -1
- package/packages/core/src/types.ts +0 -57
- package/packages/core/src/utils/index.ts +0 -28
- package/packages/core/tsconfig.json +0 -9
- package/packages/core/tsup.config.ts +0 -10
- package/packages/expo/README.md +0 -13
- package/packages/expo/package.json +0 -48
- package/packages/expo/src/ambient.d.ts +0 -3
- package/packages/expo/src/index.ts +0 -39
- package/packages/expo/tsconfig.json +0 -9
- package/packages/expo/tsup.config.ts +0 -11
- package/packages/nest/package.json +0 -45
- package/packages/nest/src/ambient.d.ts +0 -14
- package/packages/nest/src/index.ts +0 -20
- package/packages/nest/src/rules.ts +0 -15
- package/packages/nest/tsconfig.json +0 -9
- package/packages/nest/tsup.config.ts +0 -11
- package/packages/next/README.md +0 -13
- package/packages/next/package.json +0 -47
- package/packages/next/src/index.ts +0 -31
- package/packages/next/src/rules.ts +0 -16
- package/packages/next/tsconfig.json +0 -9
- package/packages/next/tsup.config.ts +0 -10
- package/packages/optionals/README.md +0 -18
- package/packages/optionals/package.json +0 -55
- package/packages/optionals/src/ambient.d.ts +0 -25
- package/packages/optionals/src/cspell.ts +0 -14
- package/packages/optionals/src/i18next.ts +0 -19
- package/packages/optionals/src/index.ts +0 -8
- package/packages/optionals/src/markdown.ts +0 -66
- package/packages/optionals/src/mdx.ts +0 -40
- package/packages/optionals/src/stencil.ts +0 -48
- package/packages/optionals/src/tailwind.ts +0 -11
- package/packages/optionals/src/vitest.ts +0 -61
- package/packages/optionals/tsconfig.json +0 -9
- package/packages/optionals/tsup.config.ts +0 -11
- package/packages/playground/README.md +0 -14
- package/packages/playground/package.json +0 -17
- package/packages/playground/src/astro/eslint.config.js +0 -4
- package/packages/playground/src/js/eslint.config.js +0 -4
- package/packages/playground/src/js/index.test.js +0 -63
- package/packages/playground/src/mdx/eslint.config.js +0 -4
- package/packages/playground/src/mdx/index.mdx +0 -115
- package/packages/playground/src/react/eslint.config.js +0 -4
- package/packages/playground/src/react/index.test.jsx +0 -130
- package/packages/playground/src/ts/eslint.config.js +0 -4
- package/packages/playground/src/ts/index.test.ts +0 -61
- package/packages/playground/src/ts/tsconfig.json +0 -3
- package/packages/playground/tsconfig.json +0 -9
- package/packages/react/README.md +0 -14
- package/packages/react/index.ts +0 -26
- package/packages/react/package.json +0 -49
- package/packages/react/src/ambient.d.ts +0 -23
- package/packages/react/src/index.ts +0 -52
- package/packages/react/src/rules.ts +0 -47
- package/packages/react/tsconfig.json +0 -9
- package/packages/react/tsup.config.ts +0 -10
- package/packages/tests/README.md +0 -17
- package/packages/tests/package.json +0 -21
- package/packages/tests/src/__snapshots__/snapshots.test.ts.snap +0 -654
- package/packages/tests/src/composition.test.ts +0 -171
- package/packages/tests/src/configs.test.ts +0 -118
- package/packages/tests/src/rules.test.ts +0 -60
- package/packages/tests/src/snapshots.test.ts +0 -126
- package/packages/tests/tsconfig.json +0 -10
- package/packages/tests/vitest.config.ts +0 -8
- package/packages/typescript/README.md +0 -14
- package/packages/typescript/package.json +0 -47
- package/packages/typescript/src/index.ts +0 -32
- package/packages/typescript/src/rules.ts +0 -36
- package/packages/typescript/tsconfig.json +0 -9
- package/packages/typescript/tsup.config.ts +0 -10
- package/tsconfig.base.json +0 -20
- package/tsconfig.docs.json +0 -18
- package/turbo.json +0 -19
- package/typedoc.config.mjs +0 -25
- package/typedoc.markdown.mjs +0 -26
package/CONTRIBUTING.md
DELETED
|
@@ -1,194 +0,0 @@
|
|
|
1
|
-
# Contributing to @santi020k/eslint-config-basic
|
|
2
|
-
|
|
3
|
-
Thank you for your interest in contributing! This guide will help you get started.
|
|
4
|
-
|
|
5
|
-
## Prerequisites
|
|
6
|
-
|
|
7
|
-
- Node.js (version specified in `.nvmrc`)
|
|
8
|
-
- npm
|
|
9
|
-
|
|
10
|
-
## Setup
|
|
11
|
-
|
|
12
|
-
```bash
|
|
13
|
-
# Clone the repository
|
|
14
|
-
git clone https://github.com/santi020k/eslint-config-basic.git
|
|
15
|
-
cd eslint-config-basic
|
|
16
|
-
|
|
17
|
-
# Install dependencies
|
|
18
|
-
npm install
|
|
19
|
-
|
|
20
|
-
# Build all packages
|
|
21
|
-
npm run build
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
## Monorepo Structure
|
|
25
|
-
|
|
26
|
-
This project uses **Turborepo** with **npm Workspaces**. Each ESLint config lives in its own package under `packages/`:
|
|
27
|
-
|
|
28
|
-
| Package | Path | Description |
|
|
29
|
-
|---------|------|-------------|
|
|
30
|
-
| `@santi020k/eslint-config-basic` | `packages/basic` | Main entry point, composes all configs |
|
|
31
|
-
| `@santi020k/eslint-config-core` | `packages/core` | Core JS rules, types, utilities |
|
|
32
|
-
| `@santi020k/eslint-config-typescript` | `packages/typescript` | TypeScript rules |
|
|
33
|
-
| `@santi020k/eslint-config-react` | `packages/react` | React + Hooks rules |
|
|
34
|
-
| `@santi020k/eslint-config-next` | `packages/next` | Next.js rules |
|
|
35
|
-
| `@santi020k/eslint-config-astro` | `packages/astro` | Astro rules |
|
|
36
|
-
| `@santi020k/eslint-config-expo` | `packages/expo` | Expo/React Native rules |
|
|
37
|
-
| `@santi020k/eslint-config-optionals` | `packages/optionals` | Optional configs (Tailwind, Vitest, etc.) |
|
|
38
|
-
|
|
39
|
-
## Adding a New Framework Config
|
|
40
|
-
|
|
41
|
-
1. **Create the package directory:**
|
|
42
|
-
|
|
43
|
-
```bash
|
|
44
|
-
mkdir -p packages/myframework/src
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
2. **Create `packages/myframework/package.json`:**
|
|
48
|
-
|
|
49
|
-
```json
|
|
50
|
-
{
|
|
51
|
-
"name": "@santi020k/eslint-config-myframework",
|
|
52
|
-
"version": "0.0.0",
|
|
53
|
-
"type": "module",
|
|
54
|
-
"main": "./dist/index.js",
|
|
55
|
-
"module": "./dist/index.js",
|
|
56
|
-
"types": "./dist/index.d.ts",
|
|
57
|
-
"exports": {
|
|
58
|
-
".": {
|
|
59
|
-
"import": "./dist/index.js",
|
|
60
|
-
"types": "./dist/index.d.ts"
|
|
61
|
-
}
|
|
62
|
-
},
|
|
63
|
-
"files": ["dist"],
|
|
64
|
-
"scripts": {
|
|
65
|
-
"build": "tsup",
|
|
66
|
-
"dev": "tsup --watch",
|
|
67
|
-
"clean": "rm -rf dist"
|
|
68
|
-
},
|
|
69
|
-
"dependencies": {
|
|
70
|
-
"@santi020k/eslint-config-core": "*"
|
|
71
|
-
},
|
|
72
|
-
"devDependencies": {
|
|
73
|
-
"tsup": "^8.5.1",
|
|
74
|
-
"typescript": "^5.9.3",
|
|
75
|
-
"@typescript-eslint/utils": "^8.54.0"
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
3. **Create `packages/myframework/tsconfig.json`:**
|
|
81
|
-
|
|
82
|
-
```json
|
|
83
|
-
{
|
|
84
|
-
"extends": "../../tsconfig.base.json",
|
|
85
|
-
"compilerOptions": {
|
|
86
|
-
"outDir": "./dist",
|
|
87
|
-
"rootDir": "./src"
|
|
88
|
-
},
|
|
89
|
-
"include": ["src/**/*.ts"],
|
|
90
|
-
"exclude": ["node_modules", "dist"]
|
|
91
|
-
}
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
4. **Create `packages/myframework/tsup.config.ts`** (copy from an existing package).
|
|
95
|
-
|
|
96
|
-
5. **Create `packages/myframework/src/index.ts`:**
|
|
97
|
-
|
|
98
|
-
```typescript
|
|
99
|
-
import type { TSESLint } from '@typescript-eslint/utils'
|
|
100
|
-
|
|
101
|
-
export const myframeworkConfig: TSESLint.FlatConfig.ConfigArray = [
|
|
102
|
-
{
|
|
103
|
-
name: 'eslint-config/myframework',
|
|
104
|
-
rules: {
|
|
105
|
-
// Add your rules here
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
]
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
6. **Add to `ConfigOption` enum** in `packages/core/src/types.ts`.
|
|
112
|
-
|
|
113
|
-
7. **Wire into `eslintConfig()`** in `packages/basic/src/index.ts`.
|
|
114
|
-
|
|
115
|
-
8. **Add tests** in `packages/tests/src/`.
|
|
116
|
-
9. **Update `ConfigOption` enum** in `packages/core/src/types.ts`.
|
|
117
|
-
10. **Wire into `eslintConfig()`** in `packages/basic/src/index.ts`.
|
|
118
|
-
|
|
119
|
-
### Specific Framework Guides
|
|
120
|
-
|
|
121
|
-
#### React, Next.js, Astro, Expo, NestJS
|
|
122
|
-
These are already implemented. See their respective `packages/` for reference.
|
|
123
|
-
|
|
124
|
-
#### Vue (Future)
|
|
125
|
-
1. Create `packages/vue`.
|
|
126
|
-
2. Extend `eslint-plugin-vue` configs.
|
|
127
|
-
3. Ensure TS compatibility.
|
|
128
|
-
|
|
129
|
-
#### Angular (Future)
|
|
130
|
-
1. Create `packages/angular`.
|
|
131
|
-
2. Use `angular-eslint` capabilities.
|
|
132
|
-
3. Note: Angular often requires a specific `builder` context.
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
## Adding a New Optional
|
|
137
|
-
|
|
138
|
-
1. Create `packages/optionals/src/configs/myoptional.ts` with your config.
|
|
139
|
-
2. Export from `packages/optionals/src/index.ts`.
|
|
140
|
-
3. Add to `OptionalOption` enum in `packages/core/src/types.ts`.
|
|
141
|
-
4. Wire into `eslintConfig()` in `packages/basic/src/index.ts`.
|
|
142
|
-
|
|
143
|
-
## Available Commands
|
|
144
|
-
|
|
145
|
-
```bash
|
|
146
|
-
npm run build # Build all packages (Turborepo)
|
|
147
|
-
npm run lint # Lint entire monorepo
|
|
148
|
-
npm run lint:fix # Fix lint issues
|
|
149
|
-
npm run test # Run tests (Vitest)
|
|
150
|
-
npm run dev # Watch mode
|
|
151
|
-
npm run dev # Watch mode
|
|
152
|
-
npm run inspector # Visual ESLint config inspector
|
|
153
|
-
```
|
|
154
|
-
|
|
155
|
-
## Documentation
|
|
156
|
-
|
|
157
|
-
Full API documentation is available at [santi020k.github.io/eslint-config-basic](https://santi020k.github.io/eslint-config-basic/).
|
|
158
|
-
|
|
159
|
-
## Commit Conventions
|
|
160
|
-
|
|
161
|
-
This project uses [Conventional Commits](https://www.conventionalcommits.org/). Use one of the following prefixes:
|
|
162
|
-
|
|
163
|
-
- `feat:` — New feature
|
|
164
|
-
- `fix:` — Bug fix
|
|
165
|
-
- `docs:` — Documentation only
|
|
166
|
-
- `style:` — Formatting, no code change
|
|
167
|
-
- `refactor:` — Code restructuring
|
|
168
|
-
- `perf:` — Performance improvement
|
|
169
|
-
- `test:` — Adding or updating tests
|
|
170
|
-
- `build:` — Build system changes
|
|
171
|
-
- `ci:` — CI/CD changes
|
|
172
|
-
- `chore:` — Maintenance tasks
|
|
173
|
-
- `revert:` — Revert a previous commit
|
|
174
|
-
|
|
175
|
-
You can use the interactive commit helper:
|
|
176
|
-
|
|
177
|
-
```bash
|
|
178
|
-
npx cz
|
|
179
|
-
```
|
|
180
|
-
|
|
181
|
-
## Pull Request Guidelines
|
|
182
|
-
|
|
183
|
-
1. Fork the repository and create your branch from `main`.
|
|
184
|
-
2. Make sure all checks pass:
|
|
185
|
-
```bash
|
|
186
|
-
npm run build && npm run lint && npm run test
|
|
187
|
-
```
|
|
188
|
-
3. Write clear, descriptive commit messages following conventional commits.
|
|
189
|
-
4. Update documentation if you're changing public APIs.
|
|
190
|
-
5. Add tests for new functionality.
|
|
191
|
-
|
|
192
|
-
## Questions?
|
|
193
|
-
|
|
194
|
-
Open an [issue](https://github.com/santi020k/eslint-config/issues) or start a [discussion](https://github.com/santi020k/eslint-config/discussions).
|
package/DEVELOPMENT.md
DELETED
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
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
DELETED
|
@@ -1,275 +0,0 @@
|
|
|
1
|
-
# @santi020k/eslint-config-basic
|
|
2
|
-
|
|
3
|
-
[](https://github.com/santi020k/eslint-config/actions/workflows/build.yml)
|
|
4
|
-
[](https://www.npmjs.com/package/@santi020k/eslint-config-basic)
|
|
5
|
-
[](https://www.npmjs.com/package/@santi020k/eslint-config-basic)
|
|
6
|
-
[](https://santi020k.github.io/eslint-config-basic/)
|
|
7
|
-
[](https://opensource.org/licenses/MIT)
|
|
8
|
-
|
|
9
|
-
Welcome to **@santi020k/eslint-config-basic**, a comprehensive and opinionated ESLint configuration package for JavaScript, TypeScript, React, and other frameworks. Born from a desire to eliminate bad practices and ensure high-quality code, this configuration automates code quality checks and reduces cognitive load during code reviews by enforcing a consistent coding style across your projects.
|
|
10
|
-
|
|
11
|
-
## Why Use This Configuration?
|
|
12
|
-
|
|
13
|
-
- **Consistency:** Enforces a uniform coding style, reducing code discrepancies and easing collaboration.
|
|
14
|
-
- **Quality:** Promotes best practices and helps avoid common pitfalls in JavaScript, TypeScript, Frameworks, Libraries, Tools and more.
|
|
15
|
-
- **Automation:** Catches issues early in the development process, minimizing manual code review effort.
|
|
16
|
-
- **Customization:** While it comes with strong opinions, you can tailor it to suit your project's specific needs.
|
|
17
|
-
|
|
18
|
-
## Installation
|
|
19
|
-
|
|
20
|
-
Before installing, make sure you have ESLint (version 9.0.0 or later) installed:
|
|
21
|
-
|
|
22
|
-
```bash
|
|
23
|
-
npm install eslint --save-dev
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
Then, install the configuration package. **Important:** I recommend using a fixed version (do not use `^` or `~`), as any new functionality or change may introduce new linter errors that require manual updates.
|
|
27
|
-
|
|
28
|
-
```bash
|
|
29
|
-
npm install @santi020k/eslint-config-basic --save-dev
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
## Usage
|
|
33
|
-
|
|
34
|
-
Create an `eslint.config.js` file (or update your existing one) and extend **@santi020k/eslint-config-basic** based on your project type.
|
|
35
|
-
|
|
36
|
-
### Basic Usage
|
|
37
|
-
|
|
38
|
-
For a basic JavaScript/Node.js project:
|
|
39
|
-
|
|
40
|
-
```js
|
|
41
|
-
import { eslintConfig } from '@santi020k/eslint-config-basic'
|
|
42
|
-
|
|
43
|
-
export default [
|
|
44
|
-
...eslintConfig()
|
|
45
|
-
// Your custom config
|
|
46
|
-
]
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
### Advanced Usage
|
|
50
|
-
|
|
51
|
-
For projects that require specific configurations (e.g., TypeScript, React, Next.js, ...Etc), use the appropriate options:
|
|
52
|
-
|
|
53
|
-
```js
|
|
54
|
-
import { ConfigOption, eslintConfig } from '@santi020k/eslint-config-basic'
|
|
55
|
-
|
|
56
|
-
// TypeScript project
|
|
57
|
-
export default [
|
|
58
|
-
...eslintConfig({ config: [ConfigOption.Ts] })
|
|
59
|
-
// Your custom config
|
|
60
|
-
]
|
|
61
|
-
|
|
62
|
-
// React project
|
|
63
|
-
export default [
|
|
64
|
-
...eslintConfig({ config: [ConfigOption.React] })
|
|
65
|
-
// Your custom config
|
|
66
|
-
]
|
|
67
|
-
|
|
68
|
-
// TypeScript and React project
|
|
69
|
-
export default [
|
|
70
|
-
...eslintConfig({ config: [ConfigOption.React, ConfigOption.Ts] })
|
|
71
|
-
// Your custom config
|
|
72
|
-
]
|
|
73
|
-
|
|
74
|
-
// Next.js project
|
|
75
|
-
export default [
|
|
76
|
-
...eslintConfig({ config: [ConfigOption.Next] })
|
|
77
|
-
// Your custom config
|
|
78
|
-
]
|
|
79
|
-
|
|
80
|
-
// Expo project
|
|
81
|
-
export default [
|
|
82
|
-
...eslintConfig({ config: [ConfigOption.Expo] })
|
|
83
|
-
// Your custom config
|
|
84
|
-
]
|
|
85
|
-
|
|
86
|
-
// Astro project (supports Astro with React)
|
|
87
|
-
export default [
|
|
88
|
-
...eslintConfig({ config: [ConfigOption.Astro] })
|
|
89
|
-
// Your custom config
|
|
90
|
-
]
|
|
91
|
-
|
|
92
|
-
// NestJS project
|
|
93
|
-
export default [
|
|
94
|
-
...eslintConfig({ config: [ConfigOption.Nest] })
|
|
95
|
-
// Your custom config
|
|
96
|
-
]
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
### Optional Usage
|
|
100
|
-
|
|
101
|
-
There are additional optional parameters to add support for other front-end/back-end technologies. This enables you to extend support as needed:
|
|
102
|
-
|
|
103
|
-
```js
|
|
104
|
-
import { ConfigOption, eslintConfig, OptionalOption } from '@santi020k/eslint-config-basic'
|
|
105
|
-
|
|
106
|
-
export default [
|
|
107
|
-
...eslintConfig({
|
|
108
|
-
config: [ConfigOption.Next, ConfigOption.Ts],
|
|
109
|
-
optionals: [
|
|
110
|
-
// Spell checker
|
|
111
|
-
OptionalOption.Cspell,
|
|
112
|
-
// TailwindCss
|
|
113
|
-
OptionalOption.Tailwind,
|
|
114
|
-
// Vitest and testing-library
|
|
115
|
-
OptionalOption.Vitest,
|
|
116
|
-
// I18next
|
|
117
|
-
OptionalOption.I18next,
|
|
118
|
-
// Mdx
|
|
119
|
-
OptionalOption.Mdx,
|
|
120
|
-
// Markdown
|
|
121
|
-
OptionalOption.Markdown,
|
|
122
|
-
// Stencil
|
|
123
|
-
OptionalOption.Stencil
|
|
124
|
-
]
|
|
125
|
-
})
|
|
126
|
-
// Your custom config
|
|
127
|
-
]
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
### Settings Usage (Experimental)
|
|
131
|
-
|
|
132
|
-
This experimental option allows ESLint to honor your `.gitignore` file:
|
|
133
|
-
|
|
134
|
-
```js
|
|
135
|
-
import { eslintConfig, SettingOption } from '@santi020k/eslint-config-basic'
|
|
136
|
-
|
|
137
|
-
export default [
|
|
138
|
-
...eslintConfig({
|
|
139
|
-
// ESLint will ignore files specified in .gitignore
|
|
140
|
-
settings: [SettingOption.Gitignore]
|
|
141
|
-
})
|
|
142
|
-
// Your custom config
|
|
143
|
-
]
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
## Monorepo Structure
|
|
147
|
-
|
|
148
|
-
This project is a monorepo managed with **Turbo** and **npm Workspaces**.
|
|
149
|
-
|
|
150
|
-
- `packages/basic`: Main package entry point.
|
|
151
|
-
- `packages/core`: Core logic and shared types.
|
|
152
|
-
- `packages/typescript`: TypeScript specific rules.
|
|
153
|
-
- `packages/react`: React and Hooks rules.
|
|
154
|
-
- `packages/next`: Next.js rules.
|
|
155
|
-
- `packages/astro`: Astro rules.
|
|
156
|
-
- `packages/expo`: Expo/React Native rules.
|
|
157
|
-
- `packages/optionals`: Optional configurations (Tailwind, Vitest, etc.).
|
|
158
|
-
- `packages/tests`: Integration tests.
|
|
159
|
-
- `packages/playground`: Testing playground for local development.
|
|
160
|
-
|
|
161
|
-
## Development
|
|
162
|
-
|
|
163
|
-
If you want to contribute or modify the configurations:
|
|
164
|
-
|
|
165
|
-
### Prerequisites
|
|
166
|
-
- Node.js (version specified in `.nvmrc`)
|
|
167
|
-
- npm
|
|
168
|
-
|
|
169
|
-
### Setup
|
|
170
|
-
```bash
|
|
171
|
-
npm install
|
|
172
|
-
```
|
|
173
|
-
|
|
174
|
-
### Useful Commands
|
|
175
|
-
```bash
|
|
176
|
-
npm run build # Build all packages using Turbo
|
|
177
|
-
npm run lint # Lint all packages
|
|
178
|
-
npm run test # Run integration tests
|
|
179
|
-
npm run dev # Development mode with watch
|
|
180
|
-
npm run inspector # Open ESLint config inspector
|
|
181
|
-
npm run docs # Generate API documentation
|
|
182
|
-
```
|
|
183
|
-
|
|
184
|
-
### ESLint Config Inspector
|
|
185
|
-
|
|
186
|
-
You can visually inspect the generated ESLint configuration using the built-in inspector:
|
|
187
|
-
|
|
188
|
-
```bash
|
|
189
|
-
npm run inspector
|
|
190
|
-
```
|
|
191
|
-
|
|
192
|
-
This opens an interactive UI where you can see all active rules, plugins, and config layers. It's useful for debugging which rules are applied and understanding the final merged configuration.
|
|
193
|
-
|
|
194
|
-
### API Documentation
|
|
195
|
-
|
|
196
|
-
### API Documentation
|
|
197
|
-
|
|
198
|
-
Auto-generated API docs are available online:
|
|
199
|
-
[**https://santi020k.github.io/eslint-config-basic/**](https://santi020k.github.io/eslint-config-basic/)
|
|
200
|
-
|
|
201
|
-
You can also generate them locally:
|
|
202
|
-
|
|
203
|
-
```bash
|
|
204
|
-
npm run docs
|
|
205
|
-
```
|
|
206
|
-
|
|
207
|
-
This outputs markdown documentation to the `docs/` directory.
|
|
208
|
-
|
|
209
|
-
## Opinionated but Flexible
|
|
210
|
-
|
|
211
|
-
This ESLint configuration is based on my personal preferences and practices, and it may evolve over time. **Important:** I recommend using a fixed version to avoid unexpected changes that might introduce new linter errors. To ensure stability, do not use `^` or `~` when specifying the version. If a rule feels too strict, consider changing it from an error to a warning to allow more flexibility during development.
|
|
212
|
-
|
|
213
|
-
## Scripts
|
|
214
|
-
|
|
215
|
-
Add the following useful scripts to your `package.json`:
|
|
216
|
-
|
|
217
|
-
```json
|
|
218
|
-
"scripts": {
|
|
219
|
-
"lint": "eslint . --report-unused-disable-directives",
|
|
220
|
-
"lint:fix": "npm run lint -- --fix"
|
|
221
|
-
}
|
|
222
|
-
```
|
|
223
|
-
|
|
224
|
-
## How to Implement in an Existing Project
|
|
225
|
-
|
|
226
|
-
1. **Install the Dependencies:** Ensure that both ESLint and this configuration package are installed.
|
|
227
|
-
2. **Update Your ESLint Configuration:** Extend **@santi020k/eslint-config-basic** in your ESLint configuration file as shown above.
|
|
228
|
-
3. **Run ESLint:** Lint your project files and automatically fix issues if possible:
|
|
229
|
-
|
|
230
|
-
```bash
|
|
231
|
-
npm run lint
|
|
232
|
-
npm run lint:fix
|
|
233
|
-
```
|
|
234
|
-
|
|
235
|
-
4. **Adjust as Necessary:** Review and modify the linting rules based on your project's needs. Some rules might be too strict or not applicable; feel free to disable or adjust them.
|
|
236
|
-
|
|
237
|
-
## Future Features
|
|
238
|
-
|
|
239
|
-
- [x] Testing
|
|
240
|
-
- [x] Refactored rules structure (Monorepo transition)
|
|
241
|
-
- [x] Astro and Expo support
|
|
242
|
-
- [x] Enhanced documentation
|
|
243
|
-
- [ ] Additional framework support (contributions welcome!):
|
|
244
|
-
- [ ] Vue
|
|
245
|
-
- [ ] Angular
|
|
246
|
-
- [x] NestJS
|
|
247
|
-
|
|
248
|
-
## Contributing
|
|
249
|
-
|
|
250
|
-
Contributions are welcome! Please read the [Contributing Guide](CONTRIBUTING.md) for details on setting up the project, adding new configurations, and submitting pull requests.
|
|
251
|
-
|
|
252
|
-
## Acknowledgements
|
|
253
|
-
|
|
254
|
-
Special thanks to the developers and maintainers of the following libraries, which form the backbone of this ESLint configuration:
|
|
255
|
-
|
|
256
|
-
- eslint-config-standard
|
|
257
|
-
- eslint-plugin-import
|
|
258
|
-
- eslint-plugin-jsx-a11y
|
|
259
|
-
- eslint-plugin-n
|
|
260
|
-
- eslint-plugin-promise
|
|
261
|
-
- eslint-plugin-react
|
|
262
|
-
- eslint-plugin-react-hooks
|
|
263
|
-
- eslint-plugin-simple-import-sort
|
|
264
|
-
- eslint-plugin-sonarjs
|
|
265
|
-
- eslint-plugin-unused-imports
|
|
266
|
-
- @stylistic/eslint-plugin
|
|
267
|
-
- @typescript-eslint
|
|
268
|
-
- @cspell/eslint-plugin
|
|
269
|
-
- eslint-plugin-tailwindcss
|
|
270
|
-
- eslint-plugin-vitest
|
|
271
|
-
- ...and many others
|
|
272
|
-
|
|
273
|
-
Their ongoing contributions help maintain the high standards of code quality we all strive for.
|
|
274
|
-
|
|
275
|
-
Thank you for using **@santi020k/eslint-config-basic**. Together, let's write cleaner, more maintainable code!
|
package/config/.husky/commit-msg
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
#!/bin/sh
|
|
2
|
-
if ! head -1 "$1" | grep -qE "^(feat|fix|chore|docs|test|style|refactor|perf|build|ci|revert)(\(.+?\))?: .{1,}$"; then
|
|
3
|
-
echo "Aborting commit. Your commit message is invalid." >&2
|
|
4
|
-
exit 1
|
|
5
|
-
fi
|
|
6
|
-
if ! head -1 "$1" | grep -qE "^.{1,200}$"; then
|
|
7
|
-
echo "Aborting commit. Your commit message is too long." >&2
|
|
8
|
-
exit 1
|
|
9
|
-
fi
|
package/config/.husky/pre-commit
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
npm run pre-commit
|
package/config/.husky/pre-push
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
npm run pre-push
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
exec < /dev/tty && npx cz --hook || true
|
package/cspell.config.yaml
DELETED
package/eslint.config.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
import { ConfigOption, eslintConfig, OptionalOption } from '@santi020k/eslint-config-basic'
|
|
3
|
-
|
|
4
|
-
export default [
|
|
5
|
-
...eslintConfig({
|
|
6
|
-
config: [ConfigOption.Ts],
|
|
7
|
-
optionals: [OptionalOption.Mdx, OptionalOption.Markdown, OptionalOption.Vitest]
|
|
8
|
-
}),
|
|
9
|
-
{
|
|
10
|
-
name: 'local-config',
|
|
11
|
-
ignores: [
|
|
12
|
-
'dist/*',
|
|
13
|
-
'packages/*/dist/*',
|
|
14
|
-
'**/tsup.config.ts',
|
|
15
|
-
'docs/*',
|
|
16
|
-
'docs-md/*',
|
|
17
|
-
'typedoc.config.mjs',
|
|
18
|
-
'typedoc.markdown.mjs'
|
|
19
|
-
]
|
|
20
|
-
}
|
|
21
|
-
]
|
package/llms.txt
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
# @santi020k/eslint-config-basic
|
|
2
|
-
|
|
3
|
-
> A comprehensive ESLint configuration package for JavaScript, TypeScript, React, Next.js, Astro, and Expo projects.
|
|
4
|
-
|
|
5
|
-
## AI Assistant Context
|
|
6
|
-
**Role**: You are a senior software engineer maintaining this high-quality ESLint config package.
|
|
7
|
-
**Goal**: Ensure code quality, type safety, and seamless developer experience (DX).
|
|
8
|
-
**Style**: Strict but practical. Prefer correctness over brevity.
|
|
9
|
-
|
|
10
|
-
## Quick Start
|
|
11
|
-
|
|
12
|
-
```js
|
|
13
|
-
import { ConfigOption, eslintConfig, OptionalOption } from '@santi020k/eslint-config-basic'
|
|
14
|
-
|
|
15
|
-
export default [
|
|
16
|
-
...eslintConfig({
|
|
17
|
-
config: [ConfigOption.React, ConfigOption.Ts],
|
|
18
|
-
optionals: [OptionalOption.Tailwind, OptionalOption.Vitest]
|
|
19
|
-
})
|
|
20
|
-
]
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
## Architecture
|
|
24
|
-
|
|
25
|
-
This is a monorepo-style ESLint config package using ESLint 9 Flat Config format.
|
|
26
|
-
|
|
27
|
-
### Directory Structure
|
|
28
|
-
|
|
29
|
-
packages/
|
|
30
|
-
├── basic/ # Main entry point (@santi020k/eslint-config-basic)
|
|
31
|
-
│ ├── src/index.ts # Exports eslintConfig()
|
|
32
|
-
│ └── dist/ # Build artifacts
|
|
33
|
-
├── core/ # Core logic and shared types
|
|
34
|
-
├── typescript/ # TypeScript config
|
|
35
|
-
├── react/ # React config
|
|
36
|
-
├── next/ # Next.js config
|
|
37
|
-
├── astro/ # Astro config
|
|
38
|
-
├── expo/ # Expo config
|
|
39
|
-
├── optionals/ # Optional feature configs
|
|
40
|
-
├── playground/ # Internal testing playground
|
|
41
|
-
└── tests/ # Integration tests
|
|
42
|
-
|
|
43
|
-
### Key Enums
|
|
44
|
-
|
|
45
|
-
- **ConfigOption**: `Ts`, `React`, `Next`, `Expo`, `Astro`
|
|
46
|
-
- **OptionalOption**: `Cspell`, `Tailwind`, `Vitest`, `I18next`, `Mdx`, `Markdown`, `Stencil`
|
|
47
|
-
- **SettingOption**: `Gitignore`
|
|
48
|
-
|
|
49
|
-
## Commands
|
|
50
|
-
|
|
51
|
-
```bash
|
|
52
|
-
npm run build # Build with tsup
|
|
53
|
-
npm run lint # Run ESLint
|
|
54
|
-
npm run lint:fix # Fix linting issues
|
|
55
|
-
npm run dev # Watch mode development
|
|
56
|
-
npm run inspector # Open ESLint config inspector
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
## Adding New Configurations
|
|
60
|
-
|
|
61
|
-
1. Create a new package under `packages/` (e.g. `packages/vue`).
|
|
62
|
-
2. Implement the config in `src/index.ts` of that package.
|
|
63
|
-
3. Export it from the package's entry point.
|
|
64
|
-
4. Add to `ConfigOption` enum in `packages/core/src/types.ts`.
|
|
65
|
-
5. Wire up in `packages/basic/src/index.ts`.
|
|
66
|
-
|
|
67
|
-
## Tech Stack
|
|
68
|
-
|
|
69
|
-
- **Build**: tsup, TypeScript
|
|
70
|
-
- **ESLint**: v9+ Flat Config format
|
|
71
|
-
- **Package Manager**: npm/pnpm
|
|
72
|
-
- **Node**: ^18.18.0 || ^20.9.0 || >=21.1.0
|
package/packages/astro/README.md
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
# @santi020k/eslint-config-astro
|
|
2
|
-
|
|
3
|
-
Astro specific ESLint rules and configurations.
|
|
4
|
-
|
|
5
|
-
## Description
|
|
6
|
-
|
|
7
|
-
This package provides:
|
|
8
|
-
- `eslint-plugin-astro` recommended rules.
|
|
9
|
-
- Configuration for linting `.astro` files.
|
|
10
|
-
|
|
11
|
-
## Usage
|
|
12
|
-
|
|
13
|
-
This package is used automatically when `ConfigOption.Astro` is selected in the main configuration.
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@santi020k/eslint-config-astro",
|
|
3
|
-
"version": "0.0.0",
|
|
4
|
-
"description": "Astro ESLint configuration",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"main": "./dist/index.js",
|
|
7
|
-
"module": "./dist/index.js",
|
|
8
|
-
"types": "./dist/index.d.ts",
|
|
9
|
-
"exports": {
|
|
10
|
-
".": {
|
|
11
|
-
"import": "./dist/index.js",
|
|
12
|
-
"types": "./dist/index.d.ts"
|
|
13
|
-
}
|
|
14
|
-
},
|
|
15
|
-
"files": [
|
|
16
|
-
"dist"
|
|
17
|
-
],
|
|
18
|
-
"scripts": {
|
|
19
|
-
"build": "tsup",
|
|
20
|
-
"dev": "tsup --watch",
|
|
21
|
-
"clean": "rm -rf dist"
|
|
22
|
-
},
|
|
23
|
-
"peerDependencies": {
|
|
24
|
-
"eslint": "^9.0.0"
|
|
25
|
-
},
|
|
26
|
-
"dependencies": {
|
|
27
|
-
"@santi020k/eslint-config-core": "*",
|
|
28
|
-
"eslint-plugin-astro": "^1.3.1"
|
|
29
|
-
},
|
|
30
|
-
"devDependencies": {
|
|
31
|
-
"@typescript-eslint/utils": "^8.54.0",
|
|
32
|
-
"tsup": "^8.5.1",
|
|
33
|
-
"typescript": "^5.9.3"
|
|
34
|
-
},
|
|
35
|
-
"publishConfig": {
|
|
36
|
-
"access": "public"
|
|
37
|
-
},
|
|
38
|
-
"license": "MIT",
|
|
39
|
-
"author": "santi020k",
|
|
40
|
-
"repository": {
|
|
41
|
-
"type": "git",
|
|
42
|
-
"url": "git+https://github.com/santi020k/eslint-config.git",
|
|
43
|
-
"directory": "packages/astro"
|
|
44
|
-
}
|
|
45
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
declare module 'eslint-plugin-astro' {
|
|
2
|
-
import type { TSESLint } from '@typescript-eslint/utils'
|
|
3
|
-
const plugin: {
|
|
4
|
-
configs: {
|
|
5
|
-
recommended: TSESLint.FlatConfig.ConfigArray
|
|
6
|
-
'flat/recommended': TSESLint.FlatConfig.ConfigArray
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
export default plugin
|
|
10
|
-
}
|