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
2426Install dependencies:
2527
@@ -36,7 +38,7 @@ import poupeConfig from '@poupe/eslint-config';
3638export 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+
5370Custom configuration:
5471
5572``` js
@@ -77,8 +94,24 @@ The filtering system categorizes plugins and rules to ensure only appropriate
7794rules apply to CSS files. See [ AGENT.md] ( ./AGENT.md#css-configuration-system )
7895for 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
84117This 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
136277The ` examples/ ` directory contains working examples demonstrating how to use
@@ -159,11 +300,74 @@ pnpm -r --filter "./examples/*" lint:fix
159300pnpm --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
164349For AI assistants working with this codebase, refer to [ AGENT.md] ( ./AGENT.md )
165350for 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
169373MIT
0 commit comments