@viclafouch/eslint-config-viclafouch 4.22.1-beta.4 → 4.22.1-beta.6

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.
@@ -10,7 +10,12 @@
10
10
  "Bash(npm view:*)",
11
11
  "Bash(node -e:*)",
12
12
  "Bash(git add:*)",
13
- "Bash(git commit -m \"$\\(cat <<''EOF''\nfeat: update dependencies and refactor next config to flat config\n\n- Update all dependencies to latest versions\n- Refactor next.mjs to use nextPlugin.configs.recommended directly\n- Remove @eslint/eslintrc FlatCompat dependency\n- Reorganize exports alphabetically in index.mjs\n- Add ignores for *.d.ts files in eslint.config.mjs\n- Add coding conventions section to CLAUDE.md\n\nCo-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>\nEOF\n\\)\")"
13
+ "Bash(git commit -m \"$\\(cat <<''EOF''\nfeat: update dependencies and refactor next config to flat config\n\n- Update all dependencies to latest versions\n- Refactor next.mjs to use nextPlugin.configs.recommended directly\n- Remove @eslint/eslintrc FlatCompat dependency\n- Reorganize exports alphabetically in index.mjs\n- Add ignores for *.d.ts files in eslint.config.mjs\n- Add coding conventions section to CLAUDE.md\n\nCo-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>\nEOF\n\\)\")",
14
+ "WebSearch",
15
+ "Bash(npx eslint:*)",
16
+ "Bash(git -C /Users/victordelafouchardiere/Desktop/eslint-config-viclafouch status)",
17
+ "Bash(git -C /Users/victordelafouchardiere/Desktop/eslint-config-viclafouch add -A)",
18
+ "Bash(git -C /Users/victordelafouchardiere/Desktop/eslint-config-viclafouch commit -m \"$\\(cat <<''EOF''\nchore: remove Tailwind CSS configuration\n\n- Remove better-tailwindcss.mjs and betterTailwindcssConfig export\n- Update README, CLAUDE.md, and CLI templates\n\nCo-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>\nEOF\n\\)\")"
14
19
  ]
15
20
  }
16
21
  }
package/CLAUDE.md CHANGED
@@ -4,14 +4,14 @@ This file documents the **@viclafouch/eslint-config-viclafouch** project to faci
4
4
 
5
5
  ## What is this project?
6
6
 
7
- This is a reusable ESLint and Prettier configuration package published on npm. It provides a comprehensive, modular set of linting and formatting rules designed for modern JavaScript/TypeScript projects. The goal is to share consistent code quality standards across all of Victor de la Fouchardiere's projects.
7
+ This is a reusable ESLint and Prettier configuration package published on npm. It provides a comprehensive, modular set of linting and formatting rules designed for modern TypeScript projects. The goal is to share consistent code quality standards across all of Victor de la Fouchardiere's projects.
8
8
 
9
9
  **Key features:**
10
- - JavaScript ES6+, TypeScript, JSX/TSX support
10
+ - TypeScript-first configuration (all projects are TypeScript by default)
11
+ - ES6+, JSX/TSX support
11
12
  - React.js and Next.js frameworks
12
- - Tailwind CSS v4 linting
13
- - Testing libraries support
14
13
  - Promise handling and best practices
14
+ - Unicorn plugin for modern JavaScript
15
15
 
16
16
  ## File Structure
17
17
 
@@ -21,20 +21,36 @@ This is a reusable ESLint and Prettier configuration package published on npm. I
21
21
  |------|-------------|
22
22
  | `index.mjs` | Main entry point, exports all configuration modules |
23
23
  | `index.d.ts` | TypeScript type definitions for the package |
24
- | `eslint.config.mjs` | ESLint configuration for this package itself (uses baseConfig + prettierConfig) |
24
+ | `eslint.config.mjs` | ESLint configuration for this package itself |
25
25
 
26
26
  ### Configuration Modules (root)
27
27
 
28
28
  | File | Description |
29
29
  |------|-------------|
30
- | `base.mjs` | Core JavaScript/TypeScript linting rules (imports all `/rules/` files) |
31
- | `typescript.mjs` | TypeScript-specific rules with parser and project service |
30
+ | `typescript.mjs` | Wrapper that exports `rules/typescript.mjs` |
32
31
  | `react.mjs` | React library rules and JSX accessibility (jsx-a11y) |
33
32
  | `next.mjs` | Next.js-specific rules (extends react + hooks + Next.js plugin) |
34
33
  | `hooks.mjs` | React Hooks rules (rules-of-hooks, exhaustive-deps, useState naming) |
35
34
  | `imports.mjs` | Import sorting with simple-import-sort in priority groups |
36
35
  | `prettier.mjs` | Prettier integration via eslint-plugin-prettier |
37
- | `better-tailwindcss.mjs` | Tailwind CSS v4 linting (function accepting `{ entryPoint }`) |
36
+
37
+ ### Rules Directory
38
+
39
+ | File | Description |
40
+ |------|-------------|
41
+ | `rules/typescript.mjs` | **Main configuration file.** Contains all base rules (best practices, ES6+, variables, errors, style, node) + TypeScript rules + Unicorn + Promise plugins |
42
+ | `rules/imports.mjs` | Import sorting rules with alias detection from tsconfig/jsconfig |
43
+ | `rules/react.mjs` | React-specific rules |
44
+ | `rules/react-hooks.mjs` | React Hooks rules |
45
+
46
+ ### CLI
47
+
48
+ | File | Description |
49
+ |------|-------------|
50
+ | `bin/init.js` | CLI script for initializing eslint.config.js |
51
+ | `templates/react.js` | Template for React projects |
52
+ | `templates/nextjs.js` | Template for Next.js projects |
53
+ | `templates/typescript.js` | Template for pure TypeScript projects |
38
54
 
39
55
  ### Utility Files for Other Projects
40
56
 
@@ -61,51 +77,33 @@ npm run publish:beta # Publish beta version
61
77
  Each module exports an array of configurations that can be spread:
62
78
 
63
79
  ```javascript
64
- // Minimal setup
65
- import { baseConfig } from '@viclafouch/eslint-config-viclafouch'
66
- export default [...baseConfig]
67
-
68
- // Full Next.js setup
69
- import { baseConfig, typescriptConfig, nextConfig, prettierConfig } from '@viclafouch/eslint-config-viclafouch'
70
- export default [...baseConfig, ...typescriptConfig, ...nextConfig, ...prettierConfig]
80
+ // Typical React setup
81
+ import {
82
+ typescriptConfig,
83
+ reactConfig,
84
+ importsConfig,
85
+ prettierConfig
86
+ } from '@viclafouch/eslint-config-viclafouch'
87
+
88
+ export default [
89
+ { ignores: ['**/node_modules/**'] },
90
+ ...typescriptConfig,
91
+ ...reactConfig,
92
+ ...importsConfig,
93
+ ...prettierConfig
94
+ ]
71
95
  ```
72
96
 
73
97
  ### Loading Hierarchy
74
98
 
75
- 1. **baseConfig** → loads 7 rule modules + Unicorn plugin
76
- 2. **typescriptConfig** → replaces some rules with TypeScript versions
77
- 3. **reactConfig** → adds JSX/a11y rules
78
- 4. **nextConfig** → extends react + hooks + Next.js plugin
79
- 5. **importsConfig** → organizes import sorting
80
- 6. **prettierConfig** → formatting (must be last)
81
- 7. **betterTailwindcssConfig({ entryPoint })** → Tailwind CSS v4
82
-
83
- ## Usage in Other Projects
84
-
85
- ### Extending tsconfig.json
86
-
87
- ```json
88
- {
89
- "extends": "@viclafouch/eslint-config-viclafouch/tsconfig.json",
90
- "compilerOptions": {
91
- // Project-specific overrides
92
- }
93
- }
94
- ```
95
-
96
- ### Using reset.d.ts
97
-
98
- The `reset.d.ts` file re-exports improved types from `@total-typescript/ts-reset`, providing:
99
-
100
- - Better inference for `.filter(Boolean)`
101
- - Stricter types for `JSON.parse`
102
- - Improved `Array.includes()`
103
-
104
- To use it, reference it in your project's tsconfig.json or include it in your types.
99
+ 1. **typescriptConfig** → Base configuration with all rules (ES6+, best practices, TypeScript, Unicorn, Promise)
100
+ 2. **nextConfig** → Next.js rules (includes React + Hooks + a11y)
101
+ 3. **reactConfig** + **hooksConfig** For React without Next.js
102
+ 4. **importsConfig** → Import sorting
103
+ 5. **prettierConfig** → Formatting (must be last)
105
104
 
106
105
  ## Integrated Plugins
107
106
 
108
- - `@eslint/js` - Core ESLint rules
109
107
  - `typescript-eslint` - TypeScript linting
110
108
  - `eslint-plugin-react` - React rules
111
109
  - `eslint-plugin-react-hooks` - Hooks enforcement
@@ -114,7 +112,6 @@ To use it, reference it in your project's tsconfig.json or include it in your ty
114
112
  - `eslint-plugin-promise` - Promise handling
115
113
  - `eslint-plugin-unicorn` - Best practices
116
114
  - `eslint-plugin-prettier` - Code formatting
117
- - `eslint-plugin-better-tailwindcss` - Tailwind v4
118
115
  - `@next/eslint-plugin-next` - Next.js specific
119
116
 
120
117
  ## Peer Dependencies
@@ -132,6 +129,8 @@ To use it, reference it in your project's tsconfig.json or include it in your ty
132
129
  - Use `'off'` for rules that should be disabled
133
130
  - **NEVER use `'warn'`** - warnings are not acceptable in this configuration
134
131
 
132
+ **Exception**: `no-console` uses `'warn'` to allow console statements during development.
133
+
135
134
  This ensures that linting is either passing or failing, with no ambiguous middle ground.
136
135
 
137
136
  ### Rule Comment Format
@@ -162,4 +161,4 @@ For TypeScript rules, use the appropriate documentation URL:
162
161
  - TypeScript ESLint: `https://typescript-eslint.io/rules/rule-name`
163
162
  - React: `https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/rule-name.md`
164
163
  - React Hooks: `https://react.dev/reference/rules/rules-of-hooks`
165
-
164
+ - Unicorn: `https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/rule-name.md`
package/README.md CHANGED
@@ -1,258 +1,172 @@
1
- # Eslint / Prettier Setup of @viclafouch 📦
1
+ # @viclafouch/eslint-config-viclafouch
2
2
 
3
- These are the ESLint and Prettier settings for a Next.js project ⚡️
3
+ ESLint and Prettier configuration for modern TypeScript projects.
4
4
 
5
+ ## Installation
5
6
 
6
- # Table of Contents
7
-
8
- - [Eslint / Prettier Setup of @viclafouch 📦](#eslint--prettier-setup-of-viclafouch-)
9
- - [Table of Contents](#table-of-contents)
10
- - [What it does](#what-it-does)
11
- - [Local / Per Project Install](#local--per-project-install)
12
- - [Scripts](#scripts)
13
- - [If you use TypeScript](#if-you-use-typescript)
14
- - [Extend your tsconfig](#extend-your-tsconfig)
15
- - [Add the typescript eslint config](#add-the-typescript-eslint-config)
16
- - [Better typing](#better-typing)
17
- - [Scripts](#scripts-1)
18
- - [If you want to enable imports sorting](#if-you-want-to-enable-imports-sorting)
19
- - [If you use Next.js](#if-you-use-nextjs)
20
- - [If you use React.js](#if-you-use-reactjs)
21
- - [If you use Tailwind CSS v4](#if-you-use-tailwind-css-v4)
22
- - [If you want to use Prettier](#if-you-want-to-use-prettier)
23
- - [If you use VS Code](#if-you-use-vs-code)
24
-
25
- ## What it does
26
-
27
- * Lints JavaScript / TypeScript based on the latest standards
28
- * Multiple configs `react` `hooks` `next` `tailwindcss`..
29
- * Shared `tsconfig.json`
30
- * Fixes issues and formatting errors with Prettier
31
- * Check for accessibility rules on JSX elements.
32
-
33
- ## Local / Per Project Install
34
-
35
- 1. If you don't already have a `package.json` file, create one with `npm init`.
36
-
37
- 2. Then we need to install the config:
38
-
39
- ```
7
+ ```bash
40
8
  npm i -D @viclafouch/eslint-config-viclafouch
41
9
  ```
42
10
 
43
- 3. Make sure your `package.json` has `"type": "module"`:
11
+ ## Quick Init (recommended)
44
12
 
45
- ```json
46
- {
47
- "name": "your-project",
48
- "type": "module",
49
- ...
50
- }
13
+ ```bash
14
+ npx @viclafouch/eslint-config-viclafouch
51
15
  ```
52
16
 
53
- 4. Create a `eslint.config.js` file in the root of your project's directory (it should live where package.json does).
17
+ This will prompt you to select your stack and create the `eslint.config.js` file automatically.
54
18
 
55
- 5. Extends your config with the minimal base of @viclafouch config :
19
+ ## Manual Setup (React)
56
20
 
57
21
  ```js
58
- import { baseConfig } from '@viclafouch/eslint-config-viclafouch'
22
+ // eslint.config.js
23
+ import {
24
+ importsConfig,
25
+ prettierConfig,
26
+ reactConfig,
27
+ typescriptConfig
28
+ } from '@viclafouch/eslint-config-viclafouch'
59
29
 
60
30
  /**
61
31
  * @type {import("eslint").Linter.Config}
62
32
  */
63
33
  export default [
64
- ...baseConfig,
65
34
  {
66
- ignores: ['**/node_modules/**']
67
- }
35
+ ignores: [
36
+ '**/node_modules/**',
37
+ '**/.output/**',
38
+ '**/.tanstack/**'
39
+ ]
40
+ },
41
+ ...typescriptConfig,
42
+ ...reactConfig,
43
+ ...importsConfig,
44
+ ...prettierConfig
68
45
  ]
69
46
  ```
70
47
 
71
- ### Scripts
72
-
73
- You can add two scripts to your package.json to lint and/or fix your code:
74
-
75
- ```json
76
- {
77
- "scripts": {
78
- "lint": "eslint",
79
- "lint:fix": "npm run lint -- --fix",
80
- }
81
- }
82
- ```
83
- ## If you use TypeScript
84
-
85
- ### Extend your tsconfig
48
+ ## Stack Examples
86
49
 
87
- First, extend your current config file `tsconfig.json` with this following snippet:
88
-
89
- ```json
90
- {
91
- "extends": "@viclafouch/eslint-config-viclafouch/tsconfig.json",
92
- ...
93
- }
94
- ```
95
-
96
- ### Add the typescript eslint config
97
-
98
- Then, add the TypeScript Eslint rules to your `.eslintrc` file:
50
+ ### React + Vite
99
51
 
100
52
  ```js
101
- import { baseConfig, typescriptConfig } from '@viclafouch/eslint-config-viclafouch'
53
+ // eslint.config.js
54
+ import {
55
+ hooksConfig,
56
+ importsConfig,
57
+ prettierConfig,
58
+ reactConfig,
59
+ typescriptConfig
60
+ } from '@viclafouch/eslint-config-viclafouch'
102
61
 
103
62
  /**
104
63
  * @type {import("eslint").Linter.Config}
105
64
  */
106
65
  export default [
107
- ...baseConfig,
66
+ { ignores: ['**/node_modules/**', '**/dist/**'] },
108
67
  ...typescriptConfig,
109
- {
110
- ignores: ['**/node_modules/**']
111
- }
68
+ ...reactConfig,
69
+ ...hooksConfig,
70
+ ...importsConfig,
71
+ ...prettierConfig
112
72
  ]
113
73
  ```
114
74
 
115
- ### Better typing
116
-
117
- TypeScript's built-in typings are not perfect. viclafouch-reset makes them better.
118
-
119
- 1. Create a `reset.d.ts` file in your project with these contents:
120
-
121
- ```ts
122
- // Do not add any other lines of code to this file!
123
- import '@viclafouch/eslint-config-viclafouch/reset.d'
124
- ```
125
-
126
- 2. Enjoy improved typings across your entire project.
127
-
128
- ### Scripts
129
-
130
- You can add two scripts to your package.json to lint and/or fix your code:
131
-
132
- ```json
133
- {
134
- "scripts": {
135
- "lint": "tsc --noEmit && eslint",
136
- "lint:fix": "npm run lint -- --fix",
137
- },
138
- }
139
- ```
140
-
141
- ## If you want to enable imports sorting
142
-
143
- If you want to sort your imports using your alias at the same time from your `jsonfig.json` or `tsconfig.json` file.
75
+ ### Pure TypeScript (Node.js, lib)
144
76
 
145
77
  ```js
146
- import { baseConfig, importsConfig } from '@viclafouch/eslint-config-viclafouch'
78
+ // eslint.config.js
79
+ import {
80
+ importsConfig,
81
+ prettierConfig,
82
+ typescriptConfig
83
+ } from '@viclafouch/eslint-config-viclafouch'
147
84
 
148
85
  /**
149
86
  * @type {import("eslint").Linter.Config}
150
87
  */
151
88
  export default [
152
- ...baseConfig,
89
+ { ignores: ['**/node_modules/**', '**/dist/**'] },
90
+ ...typescriptConfig,
153
91
  ...importsConfig,
154
- {
155
- ignores: ['**/node_modules/**']
156
- }
92
+ ...prettierConfig
157
93
  ]
158
94
  ```
159
95
 
160
- ## If you use Next.js
161
-
162
- You can also add additional rules for Next.js. It includes the following configurations : `reactConfig`, `hooksConfig` and Next.js specific rules.
96
+ ### Next.js
163
97
 
164
98
  ```js
165
- import { baseConfig, nextConfig } from '@viclafouch/eslint-config-viclafouch'
99
+ // eslint.config.js
100
+ import {
101
+ importsConfig,
102
+ nextConfig,
103
+ prettierConfig,
104
+ typescriptConfig
105
+ } from '@viclafouch/eslint-config-viclafouch'
166
106
 
167
107
  /**
168
108
  * @type {import("eslint").Linter.Config}
169
109
  */
170
110
  export default [
171
- ...baseConfig,
111
+ { ignores: ['**/node_modules/**', '**/.next/**'] },
112
+ ...typescriptConfig,
172
113
  ...nextConfig,
173
- {
174
- ignores: ['**/node_modules/**', '**/dist/**', '**/.next/**']
175
- }
114
+ ...importsConfig,
115
+ ...prettierConfig
176
116
  ]
177
117
  ```
178
118
 
179
- ## If you use React.js
119
+ ## Available Configurations
180
120
 
181
- You can also add additional rules for only React.js ecosystem (without Next.js).
121
+ | Config | Description |
122
+ |--------|-------------|
123
+ | `typescriptConfig` | **Required base.** TypeScript, ES6+, best practices, unicorn, promise |
124
+ | `reactConfig` | React and JSX a11y |
125
+ | `hooksConfig` | React Hooks |
126
+ | `nextConfig` | Next.js (includes React + Hooks + a11y) |
127
+ | `importsConfig` | Automatic import sorting |
128
+ | `prettierConfig` | Prettier (always last) |
182
129
 
183
- ```js
184
- import { baseConfig, hooksConfig, reactConfig } from '@viclafouch/eslint-config-viclafouch'
130
+ ## TypeScript
185
131
 
186
- /**
187
- * @type {import("eslint").Linter.Config}
188
- */
189
- export default [
190
- ...baseConfig,
191
- ...hooksConfig,
192
- ...reactConfig,
193
- {
194
- ignores: ['**/node_modules/**']
132
+ ### Extend tsconfig.json
133
+
134
+ ```json
135
+ {
136
+ "extends": "@viclafouch/eslint-config-viclafouch/tsconfig.json",
137
+ "compilerOptions": {
138
+ "baseUrl": ".",
139
+ "paths": {
140
+ "@/*": ["./src/*"]
141
+ }
195
142
  }
196
- ]
143
+ }
197
144
  ```
198
145
 
199
- ## If you use Tailwind CSS v4
146
+ ### Better Typing with reset.d.ts
200
147
 
201
- You can add linting rules for Tailwind CSS v4 using `eslint-plugin-better-tailwindcss`. You need to provide the path to your CSS entry file via the `entryPoint` option.
148
+ Improves native types (`.filter(Boolean)`, `JSON.parse`, `Array.includes()`, etc.):
202
149
 
203
- ```js
204
- import { baseConfig, betterTailwindcssConfig } from '@viclafouch/eslint-config-viclafouch'
205
-
206
- /**
207
- * @type {import("eslint").Linter.Config}
208
- */
209
- export default [
210
- ...baseConfig,
211
- ...betterTailwindcssConfig({
212
- entryPoint: 'src/global.css'
213
- }),
214
- {
215
- ignores: ['**/node_modules/**']
216
- }
217
- ]
150
+ ```ts
151
+ import '@viclafouch/eslint-config-viclafouch/reset.d'
218
152
  ```
219
153
 
220
- ## If you want to use Prettier
221
-
222
- Be sure for the prettier config to be the last one.
223
-
224
- ```js
225
- import {
226
- baseConfig,
227
- hooksConfig,
228
- importsConfig,
229
- prettierConfig,
230
- reactConfig,
231
- typescriptConfig
232
- } from '@viclafouch/eslint-config-viclafouch'
154
+ ## Scripts
233
155
 
234
- /**
235
- * @type {import("eslint").Linter.Config}
236
- */
237
- export default [
238
- ...baseConfig,
239
- ...reactConfig,
240
- ...hooksConfig,
241
- ...importsConfig,
242
- ...typescriptConfig,
243
- ...prettierConfig,
244
- {
245
- ignores: ['**/node_modules/**', '**/dist/**']
156
+ ```json
157
+ {
158
+ "type": "module",
159
+ "scripts": {
160
+ "lint": "tsc --noEmit && eslint .",
161
+ "lint:fix": "npm run lint -- --fix"
246
162
  }
247
- ]
163
+ }
248
164
  ```
249
165
 
250
- ## If you use VS Code
251
-
252
- Once you have done. You probably want your editor to lint and fix for you.
166
+ ## VS Code
253
167
 
254
- 1. Install the [ESLint package](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint)
255
- 2. Now we need to setup some VS Code settings. Create a `.vscode` folder at your root project, and create a `settings.json` file in this folder. Then, add this little config:
168
+ 1. Install the [ESLint extension](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint)
169
+ 2. Create a `.vscode` folder at your root project, and create a `settings.json` file:
256
170
 
257
171
  ```json
258
172
  {
@@ -261,3 +175,11 @@ Once you have done. You probably want your editor to lint and fix for you.
261
175
  }
262
176
  }
263
177
  ```
178
+
179
+ ## Configuration Order
180
+
181
+ 1. `ignores` (always first)
182
+ 2. `typescriptConfig` (base)
183
+ 3. `reactConfig` / `nextConfig` / `hooksConfig`
184
+ 4. `importsConfig`
185
+ 5. `prettierConfig` (always last)
package/bin/init.js ADDED
@@ -0,0 +1,77 @@
1
+ #!/usr/bin/env node
2
+ /* eslint-disable no-console */
3
+
4
+ import { existsSync, readFileSync, writeFileSync } from 'node:fs'
5
+ import { dirname, join } from 'node:path'
6
+ import { createInterface } from 'node:readline'
7
+ import { fileURLToPath } from 'node:url'
8
+
9
+ const filename = fileURLToPath(import.meta.url)
10
+ const directory = dirname(filename)
11
+
12
+ const TEMPLATES = {
13
+ 1: { name: 'React', file: 'react.js' },
14
+ 2: { name: 'Next.js', file: 'nextjs.js' },
15
+ 3: { name: 'Pure TypeScript', file: 'typescript.js' }
16
+ }
17
+
18
+ const rl = createInterface({
19
+ input: process.stdin,
20
+ output: process.stdout
21
+ })
22
+
23
+ function question(query) {
24
+ return new Promise((resolve) => {
25
+ rl.question(query, resolve)
26
+ })
27
+ }
28
+
29
+ async function main() {
30
+ console.log('\n@viclafouch/eslint-config-viclafouch\n')
31
+ console.log('Select your stack:\n')
32
+
33
+ for (const [key, value] of Object.entries(TEMPLATES)) {
34
+ console.log(` ${key}. ${value.name}`)
35
+ }
36
+
37
+ console.log('')
38
+
39
+ const answer = await question('Your choice (1-3): ')
40
+ const choice = TEMPLATES[answer]
41
+
42
+ if (!choice) {
43
+ console.log('\nInvalid choice. Exiting.\n')
44
+ rl.close()
45
+ process.exit(1)
46
+ }
47
+
48
+ const templatePath = join(directory, '..', 'templates', choice.file)
49
+ const targetPath = join(process.cwd(), 'eslint.config.js')
50
+
51
+ if (existsSync(targetPath)) {
52
+ const overwrite = await question(
53
+ '\neslint.config.js already exists. Overwrite? (y/N): '
54
+ )
55
+
56
+ if (overwrite.toLowerCase() !== 'y') {
57
+ console.log('\nAborted.\n')
58
+ rl.close()
59
+ process.exit(0)
60
+ }
61
+ }
62
+
63
+ const template = readFileSync(templatePath, 'utf-8')
64
+ writeFileSync(targetPath, template)
65
+
66
+ console.log(`\neslint.config.js created with ${choice.name} configuration.\n`)
67
+ console.log('Next steps:')
68
+ console.log(' 1. Run: npm i -D @viclafouch/eslint-config-viclafouch')
69
+ console.log(' 2. Run: npm run lint\n')
70
+
71
+ rl.close()
72
+ }
73
+
74
+ main().catch((error) => {
75
+ console.error(error)
76
+ process.exit(1)
77
+ })
package/eslint.config.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { baseConfig, prettierConfig } from './index.mjs'
1
+ import { prettierConfig, typescriptConfig } from './index.mjs'
2
2
 
3
3
  /**
4
4
  * @type {import("eslint").Linter.Config}
@@ -7,7 +7,7 @@ export default [
7
7
  {
8
8
  ignores: ['**/*.d.ts']
9
9
  },
10
- ...baseConfig,
10
+ ...typescriptConfig,
11
11
  ...prettierConfig,
12
12
  {
13
13
  rules: {
package/index.d.ts CHANGED
@@ -1,18 +1,8 @@
1
1
  import type { Linter } from 'eslint'
2
2
 
3
- export declare const baseConfig: Linter.Config[]
4
3
  export declare const typescriptConfig: Linter.Config[]
5
4
  export declare const reactConfig: Linter.Config[]
6
5
  export declare const nextConfig: Linter.Config[]
7
6
  export declare const prettierConfig: Linter.Config[]
8
7
  export declare const hooksConfig: Linter.Config[]
9
8
  export declare const importsConfig: Linter.Config[]
10
-
11
- export interface BetterTailwindcssOptions {
12
- /** Path to the CSS entry file (Tailwind v4) */
13
- entryPoint: string
14
- }
15
-
16
- export declare function betterTailwindcssConfig(
17
- options: BetterTailwindcssOptions
18
- ): Linter.Config[]
package/index.mjs CHANGED
@@ -1,5 +1,3 @@
1
- export { default as baseConfig } from './base.mjs'
2
- export { default as betterTailwindcssConfig } from './better-tailwindcss.mjs'
3
1
  export { default as hooksConfig } from './hooks.mjs'
4
2
  export { default as importsConfig } from './imports.mjs'
5
3
  export { default as nextConfig } from './next.mjs'
package/package.json CHANGED
@@ -1,10 +1,13 @@
1
1
  {
2
2
  "name": "@viclafouch/eslint-config-viclafouch",
3
- "version": "4.22.1-beta.4",
3
+ "version": "4.22.1-beta.6",
4
4
  "description": "ESLint and Prettier Config from Victor de la Fouchardiere",
5
5
  "type": "module",
6
6
  "main": "./index.mjs",
7
7
  "types": "./index.d.ts",
8
+ "bin": {
9
+ "eslint-config-viclafouch": "./bin/init.js"
10
+ },
8
11
  "exports": {
9
12
  ".": {
10
13
  "types": "./index.d.ts",