@santi020k/eslint-config-basic 0.1.0 → 0.3.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/README.md +2 -272
- package/dist/index.d.ts +21 -0
- package/dist/index.js +127 -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/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/README.md
CHANGED
|
@@ -1,275 +1,5 @@
|
|
|
1
1
|
# @santi020k/eslint-config-basic
|
|
2
2
|
|
|
3
|
-
[
|
|
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)
|
|
3
|
+
This package is part of the [`@santi020k/eslint-config-basic`](https://github.com/santi020k/eslint-config-basic) monorepo.
|
|
8
4
|
|
|
9
|
-
|
|
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!
|
|
5
|
+
For full usage instructions, installation guides, and documentation, please see the [Main Repository README](https://github.com/santi020k/eslint-config-basic/blob/main/README.md).
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { EslintConfigOptions, FlatConfigArray } from '@santi020k/eslint-config-core';
|
|
2
|
+
export { ConfigOption, EslintConfigOptions, FlatConfigArray, OptionalOption, ReactConfigs, SettingOption, applyConfigIfOptionPresent, coreConfig, gitignore, hasReactConfig, jsConfig } from '@santi020k/eslint-config-core';
|
|
3
|
+
export { tsConfig, typescriptConfig } from '@santi020k/eslint-config-typescript';
|
|
4
|
+
export { reactConfig } from '@santi020k/eslint-config-react';
|
|
5
|
+
export { nextConfig } from '@santi020k/eslint-config-next';
|
|
6
|
+
export { astroConfig } from '@santi020k/eslint-config-astro';
|
|
7
|
+
export { expoConfig } from '@santi020k/eslint-config-expo';
|
|
8
|
+
export { nestConfig } from '@santi020k/eslint-config-nest';
|
|
9
|
+
export { vueConfig } from '@santi020k/eslint-config-vue';
|
|
10
|
+
export { cspell, i18next, markdown, mdx, prettier, regexp, stencil, tailwind, unicorn, vitest } from '@santi020k/eslint-config-optionals';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Generates the ESLint configuration array, applying configurations
|
|
14
|
+
* and optional settings based on the input configuration.
|
|
15
|
+
*
|
|
16
|
+
* @param {EslintConfigOptions} options - Configuration and optional settings
|
|
17
|
+
* @returns {FlatConfigArray} The final ESLint configuration array
|
|
18
|
+
*/
|
|
19
|
+
declare const eslintConfig: ({ config, optionals, settings }?: EslintConfigOptions) => FlatConfigArray;
|
|
20
|
+
|
|
21
|
+
export { eslintConfig };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
// src/index.ts
|
|
2
|
+
import {
|
|
3
|
+
ConfigOption,
|
|
4
|
+
OptionalOption,
|
|
5
|
+
SettingOption,
|
|
6
|
+
ReactConfigs,
|
|
7
|
+
applyConfigIfOptionPresent,
|
|
8
|
+
hasReactConfig,
|
|
9
|
+
coreConfig,
|
|
10
|
+
jsConfig,
|
|
11
|
+
gitignore
|
|
12
|
+
} from "@santi020k/eslint-config-core";
|
|
13
|
+
import { typescriptConfig, tsConfig } from "@santi020k/eslint-config-typescript";
|
|
14
|
+
import { reactConfig } from "@santi020k/eslint-config-react";
|
|
15
|
+
import { nextConfig } from "@santi020k/eslint-config-next";
|
|
16
|
+
import { astroConfig } from "@santi020k/eslint-config-astro";
|
|
17
|
+
import { expoConfig } from "@santi020k/eslint-config-expo";
|
|
18
|
+
import { nestConfig } from "@santi020k/eslint-config-nest";
|
|
19
|
+
import { vueConfig } from "@santi020k/eslint-config-vue";
|
|
20
|
+
import {
|
|
21
|
+
cspell,
|
|
22
|
+
i18next,
|
|
23
|
+
markdown,
|
|
24
|
+
mdx,
|
|
25
|
+
prettier,
|
|
26
|
+
regexp,
|
|
27
|
+
stencil,
|
|
28
|
+
tailwind,
|
|
29
|
+
unicorn,
|
|
30
|
+
vitest
|
|
31
|
+
} from "@santi020k/eslint-config-optionals";
|
|
32
|
+
import { astroConfig as astroConfig2 } from "@santi020k/eslint-config-astro";
|
|
33
|
+
import {
|
|
34
|
+
applyConfigIfOptionPresent as applyConfigIfOptionPresent2,
|
|
35
|
+
ConfigOption as ConfigOption2,
|
|
36
|
+
coreConfig as coreConfig2,
|
|
37
|
+
gitignore as gitignore2,
|
|
38
|
+
hasReactConfig as hasReactConfig2,
|
|
39
|
+
OptionalOption as OptionalOption2,
|
|
40
|
+
SettingOption as SettingOption2
|
|
41
|
+
} from "@santi020k/eslint-config-core";
|
|
42
|
+
import { expoConfig as expoConfig2 } from "@santi020k/eslint-config-expo";
|
|
43
|
+
import { nestConfig as nestConfig2 } from "@santi020k/eslint-config-nest";
|
|
44
|
+
import { nextConfig as nextConfig2 } from "@santi020k/eslint-config-next";
|
|
45
|
+
import {
|
|
46
|
+
cspell as cspell2,
|
|
47
|
+
i18next as i18next2,
|
|
48
|
+
markdown as markdown2,
|
|
49
|
+
mdx as mdx2,
|
|
50
|
+
prettier as prettier2,
|
|
51
|
+
regexp as regexp2,
|
|
52
|
+
stencil as stencil2,
|
|
53
|
+
tailwind as tailwind2,
|
|
54
|
+
unicorn as unicorn2,
|
|
55
|
+
vitest as vitest2
|
|
56
|
+
} from "@santi020k/eslint-config-optionals";
|
|
57
|
+
import { reactConfig as reactConfig2 } from "@santi020k/eslint-config-react";
|
|
58
|
+
import { typescriptConfig as typescriptConfig2 } from "@santi020k/eslint-config-typescript";
|
|
59
|
+
import { vueConfig as vueConfig2 } from "@santi020k/eslint-config-vue";
|
|
60
|
+
var eslintConfig = ({
|
|
61
|
+
config = [],
|
|
62
|
+
optionals = [],
|
|
63
|
+
settings = []
|
|
64
|
+
} = {}) => {
|
|
65
|
+
const uniqueConfig = [...new Set(config)];
|
|
66
|
+
const uniqueOptionals = [...new Set(optionals)];
|
|
67
|
+
const uniqueSettings = [...new Set(settings)];
|
|
68
|
+
const hasReact = hasReactConfig2(uniqueConfig);
|
|
69
|
+
const useGitignore = !uniqueSettings.includes(SettingOption2.NoGitignore);
|
|
70
|
+
return [
|
|
71
|
+
// Settings
|
|
72
|
+
...useGitignore ? gitignore2 : [],
|
|
73
|
+
// Core JS config (always included)
|
|
74
|
+
...coreConfig2,
|
|
75
|
+
// React config (included if any React-based framework is used)
|
|
76
|
+
...hasReact ? reactConfig2 : [],
|
|
77
|
+
// Framework-specific configs
|
|
78
|
+
...applyConfigIfOptionPresent2(uniqueConfig, ConfigOption2.Ts, typescriptConfig2),
|
|
79
|
+
...applyConfigIfOptionPresent2(uniqueConfig, ConfigOption2.Next, nextConfig2),
|
|
80
|
+
...applyConfigIfOptionPresent2(uniqueConfig, ConfigOption2.Astro, astroConfig2),
|
|
81
|
+
...applyConfigIfOptionPresent2(uniqueConfig, ConfigOption2.Expo, expoConfig2),
|
|
82
|
+
...applyConfigIfOptionPresent2(uniqueConfig, ConfigOption2.Nest, nestConfig2),
|
|
83
|
+
...applyConfigIfOptionPresent2(uniqueConfig, ConfigOption2.Vue, vueConfig2),
|
|
84
|
+
// Optionals
|
|
85
|
+
...uniqueOptionals.includes(OptionalOption2.Cspell) ? cspell2 : [],
|
|
86
|
+
...uniqueOptionals.includes(OptionalOption2.Tailwind) ? tailwind2 : [],
|
|
87
|
+
...uniqueOptionals.includes(OptionalOption2.Vitest) ? vitest2 : [],
|
|
88
|
+
...uniqueOptionals.includes(OptionalOption2.I18next) ? i18next2 : [],
|
|
89
|
+
...uniqueOptionals.includes(OptionalOption2.Stencil) ? stencil2 : [],
|
|
90
|
+
...uniqueOptionals.includes(OptionalOption2.Regexp) ? regexp2 : [],
|
|
91
|
+
...uniqueOptionals.includes(OptionalOption2.Mdx) ? mdx2 : [],
|
|
92
|
+
...uniqueOptionals.includes(OptionalOption2.Markdown) ? markdown2 : [],
|
|
93
|
+
...uniqueOptionals.includes(OptionalOption2.Unicorn) ? unicorn2 : [],
|
|
94
|
+
// Prettier must be last to override stylistic rules
|
|
95
|
+
...uniqueOptionals.includes(OptionalOption2.Prettier) ? prettier2 : []
|
|
96
|
+
];
|
|
97
|
+
};
|
|
98
|
+
export {
|
|
99
|
+
ConfigOption,
|
|
100
|
+
OptionalOption,
|
|
101
|
+
ReactConfigs,
|
|
102
|
+
SettingOption,
|
|
103
|
+
applyConfigIfOptionPresent,
|
|
104
|
+
astroConfig,
|
|
105
|
+
coreConfig,
|
|
106
|
+
cspell,
|
|
107
|
+
eslintConfig,
|
|
108
|
+
expoConfig,
|
|
109
|
+
gitignore,
|
|
110
|
+
hasReactConfig,
|
|
111
|
+
i18next,
|
|
112
|
+
jsConfig,
|
|
113
|
+
markdown,
|
|
114
|
+
mdx,
|
|
115
|
+
nestConfig,
|
|
116
|
+
nextConfig,
|
|
117
|
+
prettier,
|
|
118
|
+
reactConfig,
|
|
119
|
+
regexp,
|
|
120
|
+
stencil,
|
|
121
|
+
tailwind,
|
|
122
|
+
tsConfig,
|
|
123
|
+
typescriptConfig,
|
|
124
|
+
unicorn,
|
|
125
|
+
vitest,
|
|
126
|
+
vueConfig
|
|
127
|
+
};
|
package/package.json
CHANGED
|
@@ -1,61 +1,58 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@santi020k/eslint-config-basic",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"access": "public"
|
|
6
|
-
},
|
|
7
|
-
"homepage": "https://santi020k.github.io/eslint-config-basic/",
|
|
8
|
-
"version": "0.1.0",
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "A comprehensive ESLint configuration package for JavaScript, TypeScript, and React projects.",
|
|
9
5
|
"type": "module",
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist"
|
|
13
17
|
],
|
|
14
18
|
"scripts": {
|
|
15
|
-
"
|
|
16
|
-
"build": "
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"clean": "turbo run clean && rm -rf node_modules",
|
|
21
|
-
"prepare": "husky config/.husky",
|
|
22
|
-
"pre-commit": "lint-staged",
|
|
23
|
-
"pre-push": "npm run test && npm run lint && npm run build",
|
|
24
|
-
"docs": "typedoc",
|
|
25
|
-
"docs:md": "typedoc --options typedoc.markdown.mjs",
|
|
26
|
-
"docs:clean": "rm -rf docs docs-md"
|
|
19
|
+
"build": "tsup",
|
|
20
|
+
"build:pack": "npm pack",
|
|
21
|
+
"dev": "tsup --watch",
|
|
22
|
+
"clean": "rm -rf dist",
|
|
23
|
+
"check:exports": "publint"
|
|
27
24
|
},
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"eslint": "
|
|
32
|
-
"eslint-config-
|
|
33
|
-
"eslint-
|
|
34
|
-
"eslint-
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"@santi020k/eslint-config-astro": "*",
|
|
27
|
+
"@santi020k/eslint-config-core": "*",
|
|
28
|
+
"@santi020k/eslint-config-expo": "*",
|
|
29
|
+
"@santi020k/eslint-config-nest": "*",
|
|
30
|
+
"@santi020k/eslint-config-next": "*",
|
|
31
|
+
"@santi020k/eslint-config-optionals": "*",
|
|
32
|
+
"@santi020k/eslint-config-react": "*",
|
|
33
|
+
"@santi020k/eslint-config-typescript": "*",
|
|
34
|
+
"@santi020k/eslint-config-vue": "*",
|
|
35
|
+
"@eslint/compat": "^2.0.3",
|
|
36
|
+
"@eslint/js": "^10.0.1",
|
|
37
|
+
"@typescript-eslint/eslint-plugin": "^8.57.0",
|
|
38
|
+
"@typescript-eslint/type-utils": "^8.57.0",
|
|
39
|
+
"cross-dirname": "^0.1.0",
|
|
40
|
+
"eslint": "^10.0.3",
|
|
41
|
+
"typescript-eslint": "^8.57.0"
|
|
41
42
|
},
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"tsup": "^8.5.1",
|
|
45
|
+
"typescript": "^5.9.3",
|
|
46
|
+
"@typescript-eslint/utils": "^8.57.0"
|
|
46
47
|
},
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"path": "./node_modules/cz-conventional-changelog"
|
|
50
|
-
}
|
|
48
|
+
"publishConfig": {
|
|
49
|
+
"access": "public"
|
|
51
50
|
},
|
|
52
|
-
"
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"minimist": "^1.2.6",
|
|
59
|
-
"tmp": "^0.2.3"
|
|
51
|
+
"license": "MIT",
|
|
52
|
+
"author": "santi020k",
|
|
53
|
+
"repository": {
|
|
54
|
+
"type": "git",
|
|
55
|
+
"url": "git+https://github.com/santi020k/eslint-config-basic.git",
|
|
56
|
+
"directory": "packages/basic"
|
|
60
57
|
}
|
|
61
58
|
}
|
package/.agent/rules/context.md
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
trigger: always_on
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
# Context
|
|
6
|
-
|
|
7
|
-
## Priority Reading Order
|
|
8
|
-
|
|
9
|
-
1. **`llms.txt`** - Project overview and architecture
|
|
10
|
-
2. **`../../src/index.ts`** - Main entry point with enums and config function
|
|
11
|
-
3. **`./guidelines.md`** - Detailed coding guidelines
|
|
12
|
-
|
|
13
|
-
## Project Summary
|
|
14
|
-
|
|
15
|
-
This is `@santi020k/eslint-config`, a composable ESLint 9 Flat Config package supporting:
|
|
16
|
-
- JavaScript, TypeScript, React, Next.js, Astro, Expo
|
|
17
|
-
- Optional integrations: Tailwind, Vitest, cspell, i18next, MDX, Markdown, Stencil
|
|
18
|
-
|
|
19
|
-
## Monorepo Architecture
|
|
20
|
-
|
|
21
|
-
This project uses **Turborepo** with **npm Workspaces** for modular package management.
|
|
22
|
-
|
|
23
|
-
### Package Structure
|
|
24
|
-
| Package | Location | Purpose |
|
|
25
|
-
|---------|----------|---------|
|
|
26
|
-
| `@santi020k/eslint-config-core` | `packages/core` | Base JS config, utilities, types |
|
|
27
|
-
| `@santi020k/eslint-config-typescript` | `packages/typescript` | TypeScript rules |
|
|
28
|
-
| `@santi020k/eslint-config-react` | `packages/react` | React + Hooks |
|
|
29
|
-
| `@santi020k/eslint-config-next` | `packages/next` | Next.js core-web-vitals |
|
|
30
|
-
|
|
31
|
-
### Dependency Graph
|
|
32
|
-
```
|
|
33
|
-
core → typescript → react → next
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
## Key Architecture Decisions
|
|
37
|
-
|
|
38
|
-
### Flat Config Only
|
|
39
|
-
This package only supports ESLint 9+ flat config format. No legacy `.eslintrc` support.
|
|
40
|
-
|
|
41
|
-
### Composable Design
|
|
42
|
-
Users select configs via enums rather than extending named configs:
|
|
43
|
-
```js
|
|
44
|
-
eslintConfig({ config: [ConfigOption.React, ConfigOption.Ts] })
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
### Dependency Alignment
|
|
48
|
-
Uses npm `overrides` with `$` references to align peer dependency versions across the plugin ecosystem.
|
|
49
|
-
|
|
50
|
-
## Validation Workflow
|
|
51
|
-
|
|
52
|
-
Always validate changes with:
|
|
53
|
-
```bash
|
|
54
|
-
npm run build && npm run lint && npm run test
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
All commands must pass before considering work complete.
|
|
58
|
-
|
|
59
|
-
## Known Issues / Gotchas
|
|
60
|
-
|
|
61
|
-
1. **FlatCompat issues**: Some legacy plugins don't resolve correctly. Use direct plugin object imports.
|
|
62
|
-
2. **TS2742 errors**: Export explicit types when inferred types reference internal modules.
|
|
63
|
-
3. **Plugin version conflicts**: Check `overrides` in package.json when adding new ESLint plugins.
|
|
64
|
-
4. **Workspace lint**: Lint runs from root only, not from individual packages.
|
|
65
|
-
|
|
66
|
-
## File Modification Patterns
|
|
67
|
-
|
|
68
|
-
### When adding a new framework config (as a package):
|
|
69
|
-
1. Create `packages/{name}/` with `package.json`, `tsconfig.json`, `tsup.config.ts`
|
|
70
|
-
2. Create `packages/{name}/src/index.ts` exporting the config
|
|
71
|
-
3. Add to `ConfigOption` enum in `packages/core/src/types.ts`
|
|
72
|
-
4. Wire into `eslintConfig()` function in `src/index.ts`
|
|
73
|
-
|
|
74
|
-
### When adding a new optional:
|
|
75
|
-
1. Create `src/optionals/{name}.ts`
|
|
76
|
-
2. Export from `src/optionals/index.ts`
|
|
77
|
-
3. Add to `OptionalOption` enum in `packages/core/src/types.ts`
|
|
78
|
-
4. Wire into `eslintConfig()` function
|