Skip to content

Commit 3d5b709

Browse files
authored
Merge pull request #158
chore(release): v0.7.10 - documentation improvements and minor fixes
2 parents 4689baf + 0da5194 commit 3d5b709

File tree

6 files changed

+363
-11
lines changed

6 files changed

+363
-11
lines changed

AGENT.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,16 @@ import { forNuxt } from '@poupe/eslint-config/nuxt';
300300
import withNuxt from './.nuxt/eslint.config.mjs';
301301
export default withNuxt(...forNuxt());
302302

303+
// Nuxt Module usage
304+
import { createConfigForNuxt } from '@nuxt/eslint-config/flat';
305+
import { forNuxtModules } from '@poupe/eslint-config/nuxt';
306+
export default createConfigForNuxt({
307+
features: {
308+
tooling: true,
309+
stylistic: true,
310+
}
311+
}, ...forNuxtModules());
312+
303313
// Custom composition with withConfig
304314
import { configs, withConfig } from '@poupe/eslint-config';
305315
export default withConfig(
@@ -309,6 +319,47 @@ export default withConfig(
309319
);
310320
```
311321

322+
## Nuxt Configuration Complexity
323+
324+
### Why Different Configs for Nuxt Apps vs Modules?
325+
326+
Nuxt applications and Nuxt modules have different ESLint setups:
327+
328+
1. **Nuxt Applications** use `@nuxt/eslint` which generates a config at
329+
`.nuxt/eslint.config.mjs`. This is integrated with the Nuxt build process.
330+
331+
2. **Nuxt Modules** use `@nuxt/eslint-config/flat` directly with
332+
`createConfigForNuxt`. The `tooling` feature enables module-author-specific
333+
rules including their own version of unicorn rules.
334+
335+
### The Unicorn Plugin Conflict
336+
337+
The issue with unicorn rules stems from:
338+
339+
1. **Plugin Instance Conflicts**: When both our config and Nuxt's tooling config
340+
try to load the unicorn plugin, ESLint detects different instances and throws
341+
an error: "Different instances of plugin 'unicorn' found"
342+
343+
2. **Version Mismatches**: Historically, Nuxt tooling used an older version of
344+
unicorn that didn't include these rules:
345+
- `unicorn/no-unnecessary-array-flat-depth`
346+
- `unicorn/no-unnecessary-array-splice-count`
347+
- `unicorn/no-unnecessary-slice-end`
348+
- `unicorn/prefer-single-call`
349+
350+
3. **Current Solution**: For Nuxt modules, we:
351+
- Remove the unicorn plugin using `withoutPlugin('unicorn', ...)`
352+
- Filter out rules that might not exist using `withoutRules(...)`
353+
- This allows Nuxt's tooling to provide its own unicorn configuration
354+
355+
### Future Considerations
356+
357+
- The version mismatch may no longer exist if Nuxt has updated their unicorn
358+
dependency
359+
- The filtered rules should be periodically reviewed to check if they're still
360+
necessary
361+
- Consider using feature detection instead of hardcoding rule names
362+
312363
## Git Workflow
313364

314365
### Commit Guidelines

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,18 @@ All notable changes to this project will be documented in this file.
44

55
## [Unreleased]
66

7+
## [0.7.10] - 2025-07-02
8+
9+
### Documentation
10+
11+
- Enhanced README with comprehensive documentation including supported file types,
12+
advanced configuration examples, migration guide, and troubleshooting section
13+
- Added package.json description field for better npm registry visibility
14+
15+
### Fixed
16+
17+
- Removed redundant export in index.ts that was duplicating configs exports
18+
719
## [0.7.9] - 2025-07-01
820

921
### Added

README.md

Lines changed: 207 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# `@poupe/eslint-config`
22

3-
Sharable ESLint config preset for usage across Poupe UI projects.
3+
Sharable ESLint configuration preset for Poupe UI projects with TypeScript,
4+
Vue.js, and Tailwind CSS support.
45

56
✅ Includes:
67

@@ -19,7 +20,8 @@ Sharable ESLint config preset for usage across Poupe UI projects.
1920
## Getting started
2021

2122
> [!NOTE]
22-
> This preset uses the new [ESLint flat config][flat-config].
23+
> This preset uses the new [ESLint flat config][flat-config] format and
24+
> requires ESLint v9+ and Node.js v18.20.8+.
2325
2426
Install dependencies:
2527

@@ -36,7 +38,7 @@ import poupeConfig from '@poupe/eslint-config';
3638
export default poupeConfig;
3739
```
3840

39-
For Nuxt.js projects (with @nuxt/eslint module):
41+
For Nuxt.js applications (with @nuxt/eslint):
4042

4143
```js
4244
// @ts-check
@@ -50,6 +52,21 @@ export default withNuxt(...forNuxt({
5052
}));
5153
```
5254

55+
For Nuxt modules (with @nuxt/eslint-config):
56+
57+
```js
58+
// @ts-check
59+
import { createConfigForNuxt } from '@nuxt/eslint-config/flat';
60+
import { forNuxtModules } from '@poupe/eslint-config/nuxt';
61+
62+
export default createConfigForNuxt({
63+
features: {
64+
tooling: true, // Enables rules for module authors
65+
stylistic: true, // Enables formatting rules
66+
},
67+
}, ...forNuxtModules());
68+
```
69+
5370
Custom configuration:
5471

5572
```js
@@ -77,8 +94,24 @@ The filtering system categorizes plugins and rules to ensure only appropriate
7794
rules apply to CSS files. See [AGENT.md](./AGENT.md#css-configuration-system)
7895
for implementation details.
7996

97+
## Supported File Types
98+
99+
This configuration automatically lints the following file types:
100+
101+
* **JavaScript**: `.js`, `.mjs`, `.cjs`
102+
* **TypeScript**: `.ts`, `.tsx`
103+
* **Vue.js**: `.vue` (Single File Components)
104+
* **JSON/JSONC**: `.json`, `.jsonc`, `package.json`
105+
* **Markdown**: `.md`
106+
* **CSS**: `.css` (with Tailwind CSS v4 syntax support)
107+
80108
## Features
81109

110+
### Self-Dogfooding
111+
112+
This package uses its own ESLint configuration for validation, ensuring
113+
quality and serving as a real-world test case.
114+
82115
### Automatic Import/Export Sorting
83116

84117
This configuration includes `eslint-plugin-perfectionist` which automatically
@@ -131,6 +164,114 @@ type Status =
131164
| 'success';
132165
```
133166

167+
## Advanced Configuration
168+
169+
### Custom Rule Overrides
170+
171+
```js
172+
// @ts-check
173+
import { defineConfig } from '@poupe/eslint-config';
174+
175+
export default defineConfig({
176+
rules: {
177+
// Disable specific rules
178+
'unicorn/filename-case': 'off',
179+
180+
// Customize rule severity and options
181+
'@typescript-eslint/no-unused-vars': ['warn', {
182+
argsIgnorePattern: '^_',
183+
varsIgnorePattern: '^_',
184+
}],
185+
},
186+
});
187+
```
188+
189+
### Selective Configuration Import
190+
191+
```js
192+
// @ts-check
193+
import { configs, withConfig } from '@poupe/eslint-config';
194+
195+
// Import only specific configurations
196+
export default withConfig(
197+
configs.javascript,
198+
configs.typescript,
199+
configs.stylistic,
200+
configs.vue,
201+
// Add custom overrides
202+
{
203+
rules: {
204+
'vue/multi-word-component-names': 'off',
205+
},
206+
},
207+
);
208+
```
209+
210+
## Poupe UI Recommended Rules
211+
212+
In addition to the rules from included plugins, this configuration adds these
213+
custom rules:
214+
215+
### TypeScript Rules
216+
217+
* Enforces explicit return types on exported functions
218+
* Requires consistent type imports (`import type`)
219+
* Disables `@ts-` comment directives
220+
221+
### Vue.js Rules
222+
223+
* Enforces multi-word component names
224+
* Requires `defineEmits` and `defineProps` type declarations
225+
* Ensures proper `v-model` usage patterns
226+
227+
### General JavaScript Rules
228+
229+
* Enforces camelCase naming convention
230+
* Requires explicit radix in `parseInt`
231+
* Prevents console statements in production code
232+
233+
### Stylistic Rules
234+
235+
* Single quotes for strings
236+
* Semicolons required
237+
* 1tbs (one true brace style)
238+
* 2-space indentation for web files
239+
* 80-character line limit for Markdown
240+
241+
## Migration Guide
242+
243+
### From Legacy ESLint Config
244+
245+
If you're migrating from a legacy `.eslintrc` configuration:
246+
247+
1. **Remove old config files**: Delete `.eslintrc`, `.eslintrc.js`,
248+
`.eslintrc.json`, etc.
249+
250+
2. **Update dependencies**:
251+
252+
```sh
253+
pnpm remove eslint-config-* eslint-plugin-*
254+
pnpm install -D eslint@^9 typescript @poupe/eslint-config
255+
```
256+
257+
3. **Create new config**: Add `eslint.config.mjs` as shown in Getting Started
258+
259+
4. **Update scripts**: ESLint v9 automatically finds `eslint.config.mjs`
260+
261+
```json
262+
{
263+
"scripts": {
264+
"lint": "eslint .",
265+
"lint:fix": "eslint . --fix"
266+
}
267+
}
268+
```
269+
270+
5. **Handle breaking changes**:
271+
* Some rules have been renamed or moved to different plugins
272+
* The flat config uses different property names (`files` instead of `overrides`)
273+
* Plugin names are now used as object keys instead of strings
274+
134275
## Examples
135276

136277
The `examples/` directory contains working examples demonstrating how to use
@@ -159,11 +300,74 @@ pnpm -r --filter "./examples/*" lint:fix
159300
pnpm --filter "@poupe/eslint-config-playground-standard" lint
160301
```
161302

303+
## Troubleshooting
304+
305+
### Common Issues
306+
307+
#### "Cannot find module '@poupe/eslint-config'"
308+
309+
Ensure you've installed the package and are using the correct import path:
310+
311+
```sh
312+
pnpm install -D @poupe/eslint-config
313+
```
314+
315+
#### "Plugin conflict" errors with Nuxt
316+
317+
For Nuxt applications, make sure to use the appropriate helper:
318+
319+
* Use `forNuxt()` for Nuxt applications
320+
* Use `forNuxtModules()` for Nuxt module development
321+
322+
#### CSS rules applying to JavaScript files
323+
324+
This should not happen with the default configuration. If it does, ensure
325+
you're using the latest version and report an issue.
326+
327+
#### "Unknown rule" warnings
328+
329+
These warnings help the CSS filtering system learn about new rules. They're
330+
informational and don't affect functionality.
331+
332+
### Debugging
333+
334+
To debug ESLint configuration issues:
335+
336+
```sh
337+
# Show resolved configuration for a specific file
338+
eslint --print-config path/to/file.js
339+
340+
# Enable ESLint debug output
341+
DEBUG=eslint:* eslint .
342+
343+
# Debug specific aspects
344+
DEBUG=eslint:eslint eslint .
345+
```
346+
162347
## Development
163348

164349
For AI assistants working with this codebase, refer to [AGENT.md](./AGENT.md)
165350
for detailed guidance and conventions.
166351

352+
### Project Structure
353+
354+
```text
355+
src/
356+
├── configs/ # Individual ESLint rule configurations
357+
├── core/ # Core utilities and type definitions
358+
├── config.ts # Main configuration builder
359+
├── configs.ts # Configuration presets
360+
├── index.ts # Main entry point
361+
└── nuxt.ts # Nuxt-specific configurations
362+
```
363+
364+
### Contributing
365+
366+
1. Make changes to configuration files in `src/configs/`
367+
2. Run `pnpm build` to compile the package
368+
3. Test with `pnpm lint` (self-linting)
369+
4. Test in examples: `pnpm -r --filter "./examples/*" lint`
370+
167371
## License
168372

169373
MIT

package.json

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"name": "@poupe/eslint-config",
3-
"version": "0.7.9",
3+
"version": "0.7.10",
44
"type": "module",
5-
"description": "",
5+
"description": "Sharable ESLint configuration preset for Poupe UI projects with TypeScript, Vue.js, and Tailwind CSS support",
66
"author": "Alejandro Mery <[email protected]>",
77
"license": "MIT",
88
"homepage": "https://github.com/poupe-ui/eslint-config",
@@ -24,12 +24,12 @@
2424
],
2525
"scripts": {
2626
"build": "unbuild",
27-
"clean": "rm -rf dist node_modules && pnpm -r --filter \"./examples/*\" clean",
27+
"clean": "rimraf dist node_modules && pnpm -r --filter \"./examples/*\" clean",
2828
"dev:prepare": "unbuild --stub",
29-
"lint": "unbuild --stub && env DEBUG=eslint:eslint eslint --fix .",
29+
"lint": "unbuild --stub && cross-env DEBUG=eslint:eslint eslint --fix .",
3030
"lint:all": "run-s lint lint:examples",
3131
"lint:examples": "pnpm -r --filter \"playground-*\" lint:fix",
32-
"postinstall": "[ -s dist/index.mjs ] || unbuild --stub",
32+
"postinstall": "node -e \"require('fs').existsSync('dist/index.mjs') || process.exit(1)\" || unbuild --stub",
3333
"precommit": "run-s lint:all type-check test:all build",
3434
"prepack": "run-s lint type-check test:all build publint",
3535
"publint": "publint",
@@ -58,10 +58,12 @@
5858
},
5959
"devDependencies": {
6060
"@vitest/ui": "^3.2.4",
61+
"cross-env": "^7.0.3",
6162
"globals": "^16.3.0",
6263
"npm-run-all2": "^8.0.4",
6364
"pkg-pr-new": "^0.0.54",
6465
"publint": "^0.3.12",
66+
"rimraf": "^6.0.1",
6567
"typescript": "~5.8.3",
6668
"unbuild": "3.5.0",
6769
"vitest": "^3.2.4"
@@ -72,7 +74,7 @@
7274
}
7375
},
7476
"engines": {
75-
"node": ">= 18.20.8",
77+
"node": ">= 18.20.0",
7678
"pnpm": ">= 10.10.0"
7779
},
7880
"packageManager": "[email protected]+sha512.d615db246fe70f25dcfea6d8d73dee782ce23e2245e3c4f6f888249fb568149318637dca73c2c5c8ef2a4ca0d5657fb9567188bfab47f566d1ee6ce987815c39"

0 commit comments

Comments
 (0)