@santi020k/eslint-config-basic 0.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.
Files changed (140) hide show
  1. package/.agent/rules/context.md +78 -0
  2. package/.agent/rules/guidelines.md +124 -0
  3. package/.editorconfig +13 -0
  4. package/.env.example +8 -0
  5. package/.github/CODEOWNERS +2 -0
  6. package/.github/DISCUSSION_TEMPLATE/rfcs.yml +21 -0
  7. package/.github/DISCUSSION_TEMPLATE/technical-discussions.yml +21 -0
  8. package/.github/FUNDING.yml +2 -0
  9. package/.github/ISSUE_TEMPLATE/README.md +13 -0
  10. package/.github/ISSUE_TEMPLATE/bug_report.yml +69 -0
  11. package/.github/ISSUE_TEMPLATE/config.yml +8 -0
  12. package/.github/ISSUE_TEMPLATE/feature_request.yml +43 -0
  13. package/.github/ISSUE_TEMPLATE/question.yml +22 -0
  14. package/.github/SECURITY.md +12 -0
  15. package/.github/SPONSORSHIPS.md +27 -0
  16. package/.github/dependabot.yml +45 -0
  17. package/.github/labeler.yml +46 -0
  18. package/.github/pull_request_template.md +56 -0
  19. package/.github/workflows/assign-issues.yml +18 -0
  20. package/.github/workflows/audit.yml +22 -0
  21. package/.github/workflows/build.yml +29 -0
  22. package/.github/workflows/codeql.yml +40 -0
  23. package/.github/workflows/docs.yml +49 -0
  24. package/.github/workflows/labeler.yml +18 -0
  25. package/.github/workflows/publish.yml +24 -0
  26. package/.github/workflows/release.yml +35 -0
  27. package/.github/workflows/size-check.yml +23 -0
  28. package/.github/workflows/stale.yml +31 -0
  29. package/.nvmrc +1 -0
  30. package/.vscode/extensions.json +10 -0
  31. package/.vscode/settings.json +55 -0
  32. package/CHANGELOG.md +16 -0
  33. package/CONTRIBUTING.md +194 -0
  34. package/DEVELOPMENT.md +4 -0
  35. package/LICENSE +21 -0
  36. package/README.md +275 -0
  37. package/config/.husky/commit-msg +9 -0
  38. package/config/.husky/pre-commit +1 -0
  39. package/config/.husky/pre-push +1 -0
  40. package/config/.husky/prepare-commit-msg +1 -0
  41. package/cspell.config.yaml +2 -0
  42. package/eslint.config.js +21 -0
  43. package/llms.txt +72 -0
  44. package/package.json +61 -0
  45. package/packages/astro/README.md +13 -0
  46. package/packages/astro/package.json +45 -0
  47. package/packages/astro/src/ambient.d.ts +10 -0
  48. package/packages/astro/src/index.ts +18 -0
  49. package/packages/astro/src/rules.ts +29 -0
  50. package/packages/astro/tsconfig.json +9 -0
  51. package/packages/astro/tsup.config.ts +11 -0
  52. package/packages/basic/README.md +33 -0
  53. package/packages/basic/package.json +55 -0
  54. package/packages/basic/src/index.ts +110 -0
  55. package/packages/basic/tsconfig.json +9 -0
  56. package/packages/basic/tsup.config.ts +18 -0
  57. package/packages/core/README.md +14 -0
  58. package/packages/core/index.ts +14 -0
  59. package/packages/core/package.json +61 -0
  60. package/packages/core/src/ambient.d.ts +61 -0
  61. package/packages/core/src/index.ts +75 -0
  62. package/packages/core/src/rules.ts +157 -0
  63. package/packages/core/src/settings/gitignore.ts +10 -0
  64. package/packages/core/src/settings/index.ts +1 -0
  65. package/packages/core/src/types.ts +57 -0
  66. package/packages/core/src/utils/index.ts +28 -0
  67. package/packages/core/tsconfig.json +9 -0
  68. package/packages/core/tsup.config.ts +10 -0
  69. package/packages/expo/README.md +13 -0
  70. package/packages/expo/package.json +48 -0
  71. package/packages/expo/src/ambient.d.ts +3 -0
  72. package/packages/expo/src/index.ts +39 -0
  73. package/packages/expo/tsconfig.json +9 -0
  74. package/packages/expo/tsup.config.ts +11 -0
  75. package/packages/nest/package.json +45 -0
  76. package/packages/nest/src/ambient.d.ts +14 -0
  77. package/packages/nest/src/index.ts +20 -0
  78. package/packages/nest/src/rules.ts +15 -0
  79. package/packages/nest/tsconfig.json +9 -0
  80. package/packages/nest/tsup.config.ts +11 -0
  81. package/packages/next/README.md +13 -0
  82. package/packages/next/package.json +47 -0
  83. package/packages/next/src/index.ts +31 -0
  84. package/packages/next/src/rules.ts +16 -0
  85. package/packages/next/tsconfig.json +9 -0
  86. package/packages/next/tsup.config.ts +10 -0
  87. package/packages/optionals/README.md +18 -0
  88. package/packages/optionals/package.json +55 -0
  89. package/packages/optionals/src/ambient.d.ts +25 -0
  90. package/packages/optionals/src/cspell.ts +14 -0
  91. package/packages/optionals/src/i18next.ts +19 -0
  92. package/packages/optionals/src/index.ts +8 -0
  93. package/packages/optionals/src/markdown.ts +66 -0
  94. package/packages/optionals/src/mdx.ts +40 -0
  95. package/packages/optionals/src/stencil.ts +48 -0
  96. package/packages/optionals/src/tailwind.ts +11 -0
  97. package/packages/optionals/src/vitest.ts +61 -0
  98. package/packages/optionals/tsconfig.json +9 -0
  99. package/packages/optionals/tsup.config.ts +11 -0
  100. package/packages/playground/README.md +14 -0
  101. package/packages/playground/package.json +17 -0
  102. package/packages/playground/src/astro/eslint.config.js +4 -0
  103. package/packages/playground/src/js/eslint.config.js +4 -0
  104. package/packages/playground/src/js/index.test.js +63 -0
  105. package/packages/playground/src/mdx/eslint.config.js +4 -0
  106. package/packages/playground/src/mdx/index.mdx +115 -0
  107. package/packages/playground/src/react/eslint.config.js +4 -0
  108. package/packages/playground/src/react/index.test.jsx +130 -0
  109. package/packages/playground/src/ts/eslint.config.js +4 -0
  110. package/packages/playground/src/ts/index.test.ts +61 -0
  111. package/packages/playground/src/ts/tsconfig.json +3 -0
  112. package/packages/playground/tsconfig.json +9 -0
  113. package/packages/react/README.md +14 -0
  114. package/packages/react/index.ts +26 -0
  115. package/packages/react/package.json +49 -0
  116. package/packages/react/src/ambient.d.ts +23 -0
  117. package/packages/react/src/index.ts +52 -0
  118. package/packages/react/src/rules.ts +47 -0
  119. package/packages/react/tsconfig.json +9 -0
  120. package/packages/react/tsup.config.ts +10 -0
  121. package/packages/tests/README.md +17 -0
  122. package/packages/tests/package.json +21 -0
  123. package/packages/tests/src/__snapshots__/snapshots.test.ts.snap +654 -0
  124. package/packages/tests/src/composition.test.ts +171 -0
  125. package/packages/tests/src/configs.test.ts +118 -0
  126. package/packages/tests/src/rules.test.ts +60 -0
  127. package/packages/tests/src/snapshots.test.ts +126 -0
  128. package/packages/tests/tsconfig.json +10 -0
  129. package/packages/tests/vitest.config.ts +8 -0
  130. package/packages/typescript/README.md +14 -0
  131. package/packages/typescript/package.json +47 -0
  132. package/packages/typescript/src/index.ts +32 -0
  133. package/packages/typescript/src/rules.ts +36 -0
  134. package/packages/typescript/tsconfig.json +9 -0
  135. package/packages/typescript/tsup.config.ts +10 -0
  136. package/tsconfig.base.json +20 -0
  137. package/tsconfig.docs.json +18 -0
  138. package/turbo.json +19 -0
  139. package/typedoc.config.mjs +25 -0
  140. package/typedoc.markdown.mjs +26 -0
package/README.md ADDED
@@ -0,0 +1,275 @@
1
+ # @santi020k/eslint-config-basic
2
+
3
+ [![CI](https://github.com/santi020k/eslint-config/actions/workflows/build.yml/badge.svg)](https://github.com/santi020k/eslint-config/actions/workflows/build.yml)
4
+ [![npm version](https://img.shields.io/npm/v/@santi020k/eslint-config-basic.svg)](https://www.npmjs.com/package/@santi020k/eslint-config-basic)
5
+ [![npm downloads](https://img.shields.io/npm/dm/@santi020k/eslint-config-basic.svg)](https://www.npmjs.com/package/@santi020k/eslint-config-basic)
6
+ [![Docs](https://img.shields.io/badge/docs-TypeDoc-blue.svg)](https://santi020k.github.io/eslint-config-basic/)
7
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](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!
@@ -0,0 +1,9 @@
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
@@ -0,0 +1 @@
1
+ npm run pre-commit
@@ -0,0 +1 @@
1
+ npm run pre-push
@@ -0,0 +1 @@
1
+ exec < /dev/tty && npx cz --hook || true
@@ -0,0 +1,2 @@
1
+ words:
2
+ - santi
@@ -0,0 +1,21 @@
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 ADDED
@@ -0,0 +1,72 @@
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/package.json ADDED
@@ -0,0 +1,61 @@
1
+ {
2
+ "name": "@santi020k/eslint-config-basic",
3
+ "private": false,
4
+ "publishConfig": {
5
+ "access": "public"
6
+ },
7
+ "homepage": "https://santi020k.github.io/eslint-config-basic/",
8
+ "version": "0.1.0",
9
+ "type": "module",
10
+ "packageManager": "npm@10.8.3",
11
+ "workspaces": [
12
+ "packages/*"
13
+ ],
14
+ "scripts": {
15
+ "dev": "turbo run dev",
16
+ "build": "turbo run build",
17
+ "lint": "turbo run lint",
18
+ "lint:fix": "turbo run lint:fix",
19
+ "test": "vitest run packages/tests",
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"
27
+ },
28
+ "devDependencies": {
29
+ "commitizen": "^4.3.1",
30
+ "cz-conventional-changelog": "^3.3.0",
31
+ "eslint": "^9.39.2",
32
+ "eslint-config-standard": "^17.1.0",
33
+ "eslint-plugin-n": "^17.23.2",
34
+ "eslint-plugin-promise": "^7.2.1",
35
+ "husky": "^9.1.7",
36
+ "lint-staged": "^16.2.7",
37
+ "turbo": "^2.5.3",
38
+ "typedoc": "^0.28.16",
39
+ "typedoc-plugin-markdown": "^4.10.0",
40
+ "vitest": "^4.0.18"
41
+ },
42
+ "lint-staged": {
43
+ "*.{js,jsx,ts,tsx,md}": [
44
+ "eslint --fix"
45
+ ]
46
+ },
47
+ "config": {
48
+ "commitizen": {
49
+ "path": "./node_modules/cz-conventional-changelog"
50
+ }
51
+ },
52
+ "overrides": {
53
+ "eslint": "$eslint",
54
+ "eslint-config-standard": "$eslint-config-standard",
55
+ "eslint-plugin-promise": "$eslint-plugin-promise",
56
+ "eslint-plugin-n": "$eslint-plugin-n",
57
+ "lodash": "^4.17.23",
58
+ "minimist": "^1.2.6",
59
+ "tmp": "^0.2.3"
60
+ }
61
+ }
@@ -0,0 +1,13 @@
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.
@@ -0,0 +1,45 @@
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
+ }
@@ -0,0 +1,10 @@
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
+ }
@@ -0,0 +1,18 @@
1
+ import pluginAstro from 'eslint-plugin-astro'
2
+
3
+ import type { TSESLint } from '@typescript-eslint/utils'
4
+
5
+ import { rules } from './rules.js'
6
+
7
+ /**
8
+ * Astro ESLint configuration
9
+ * Includes Astro plugin recommended rules and custom overrides
10
+ */
11
+ export const astroConfig: TSESLint.FlatConfig.ConfigArray = [
12
+ ...(pluginAstro.configs.recommended as TSESLint.FlatConfig.ConfigArray),
13
+ {
14
+ name: 'eslint-config-astro/custom',
15
+ files: ['**/*.astro'],
16
+ rules
17
+ }
18
+ ]
@@ -0,0 +1,29 @@
1
+ import type { TSESLint } from '@typescript-eslint/utils'
2
+
3
+ import { groups } from '@santi020k/eslint-config-core'
4
+
5
+ export const rules: TSESLint.Linter.RulesRecord = {
6
+ 'simple-import-sort/imports': [
7
+ 'warn',
8
+ {
9
+ groups: [
10
+ // Packages `react` related packages come first.
11
+ ['^react'],
12
+ ['^(astro)(/.*|$)?'],
13
+ ...groups
14
+ ]
15
+ }
16
+ ],
17
+ // Disable no-unresolved rule for .astro files
18
+ 'react/jsx-filename-extension': [1, { extensions: ['.astro'] }], // Accept jsx in astro files
19
+ 'react/destructuring-assignment': 'off', // Vscode doesn't support automatically destructuring
20
+ 'react/require-default-props': 'off', // Allow non-defined react props as undefined
21
+ 'react/jsx-props-no-spreading': 'off', // _app.tsx uses spread operator
22
+ 'react/react-in-jsx-scope': 'off',
23
+ 'react/no-unknown-property': 'off',
24
+ // Disable conflicted rules
25
+ '@stylistic/jsx-indent': 'off',
26
+ '@stylistic/jsx-one-expression-per-line': 'off',
27
+ '@stylistic/jsx-tag-spacing': 'off',
28
+ 'react/jsx-key': 'off'
29
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "extends": "../../tsconfig.base.json",
3
+ "compilerOptions": {
4
+ "outDir": "./dist",
5
+ "rootDir": "./src"
6
+ },
7
+ "include": ["src/**/*.ts"],
8
+ "exclude": ["node_modules", "dist"]
9
+ }
@@ -0,0 +1,11 @@
1
+ import { defineConfig } from 'tsup'
2
+
3
+ export default defineConfig({
4
+ entry: ['src/index.ts'],
5
+ format: ['esm'],
6
+ dts: true,
7
+ splitting: false,
8
+ sourcemap: true,
9
+ clean: true,
10
+ target: 'es2022'
11
+ })
@@ -0,0 +1,33 @@
1
+ # @santi020k/eslint-config-basic
2
+
3
+ A comprehensive, composable ESLint configuration for modern JavaScript and TypeScript projects.
4
+
5
+ ## Features
6
+
7
+ - **Composable**: Pick and choose what you need (React, Next.js, Astro, Expo, etc.).
8
+ - **Flat Config**: Built natively for ESLint 9+ Flat Config system.
9
+ - **Opinionated yet Flexible**: Sane defaults with easy override capabilities.
10
+
11
+ ## Installation
12
+
13
+ ```bash
14
+ npm install -D @santi020k/eslint-config-basic eslint
15
+ ```
16
+
17
+ ## Usage
18
+
19
+ Create `eslint.config.mjs` (or `.js`):
20
+
21
+ ```js
22
+ import { ConfigOption, eslintConfig, OptionalOption } from '@santi020k/eslint-config-basic'
23
+
24
+ export default eslintConfig({
25
+ config: [
26
+ ConfigOption.Ts,
27
+ ConfigOption.React
28
+ ],
29
+ optionals: [
30
+ OptionalOption.Tailwind
31
+ ]
32
+ })
33
+ ```