Configs
@ntnyq/eslint-config provides a collection of composable ESLint configurations for different file types and use cases. All configs are automatically enabled based on your project structure, or you can enable/disable them manually.
Config Status
Enabled by Default
These configs are enabled automatically when relevant files are detected in your project:
| Config | Description | Auto-detect |
|---|---|---|
| JavaScript | Base JavaScript rules | Always |
| TypeScript | TypeScript support and rules | *.ts, *.tsx files |
| Vue | Vue 3 SFC linting | *.vue files |
| JSON/JSONC | JSON/JSONC linting | *.json, *.jsonc files |
| Markdown | Markdown linting | *.md files |
| YAML | YAML linting | *.yaml, *.yml files |
| TOML | TOML linting | *.toml files |
| Gitignore | Respect .gitignore patterns | .gitignore exists |
| Ignores | Common ignore patterns | Always |
| Node | Node.js rules | Always |
| Import X | Import/export linting | Always |
| Unicorn | Quality/style rules | Always |
| Perfectionist | Sorting and formatting | Always |
| Antfu | Anthony Fu's custom rules | Always |
| ESLint Comments | ESLint directive comments | Always |
| Command | Magic ESLint commands | Always |
Disabled by Default
These configs must be explicitly enabled in your configuration:
| Config | Description | Enable with |
|---|---|---|
| Astro | Astro component linting | astro: true |
| Svelte | Svelte component linting | svelte: true |
| SVGO | SVG optimization linting | svgo: true |
| HTML | HTML file linting | html: true |
| Pinia | Pinia store rules | pinia: true |
| PNPM | PNPM workspace linting | pnpm: true |
| Test | Test framework rules | Auto-detect test files |
| ESLint Plugin | Rules for ESLint plugin development | eslintPlugin: true |
Usage
Enable/Disable Configs
js
import { defineESLintConfig } from '@ntnyq/eslint-config'
export default defineESLintConfig({
// Enable optional configs
svgo: true,
astro: true,
// Disable default configs
jsdoc: false,
unicorn: false,
})Configure Options
Each config can accept options:
js
import { defineESLintConfig } from '@ntnyq/eslint-config'
export default defineESLintConfig({
typescript: {
tsconfigPath: './tsconfig.json',
overrides: {
'@typescript-eslint/no-unused-vars': 'warn',
},
},
vue: {
sfcBlocks: true,
overrides: {
'vue/multi-word-component-names': 'off',
},
},
})Config Interface
The complete TypeScript interface for configuration options:
ts
export interface ConfigOptions {
/**
* Shareable options
*/
shareable?: OptionsShareable
/**
* Configs enabled by default
*/
command?: ConfigCommandOptions
eslintComments?: ConfigESLintCommentsOptions
ignores?: ConfigIgnoresOptions
javascript?: ConfigJavaScriptOptions
node?: ConfigNodeOptions
/**
* Configs below can be disabled
*/
antfu?: boolean | ConfigAntfuOptions
deMorgan?: boolean | ConfigDeMorganOptions
depend?: boolean | ConfigDependOptions
githubAction?: boolean | ConfigGitHubActionOptions
gitignore?: boolean | ConfigGitIgnoreOptions
importX?: boolean | ConfigImportXOptions
jsdoc?: boolean | ConfigJsdocOptions
jsonc?: boolean | ConfigJsoncOptions
markdown?: boolean | ConfigMarkdownOptions
ntnyq?: boolean | ConfigNtnyqOptions
perfectionist?: boolean | ConfigPerfectionistOptions
pinia?: boolean | ConfigPiniaOptions
prettier?: boolean | ConfigPrettierOptions
regexp?: boolean | ConfigRegexpOptions
sort?: boolean | ConfigSortOptions
specials?: boolean | ConfigSpecialsOptions
test?: boolean | ConfigTestOptions
toml?: boolean | ConfigTomlOptions
typescript?: boolean | ConfigTypeScriptOptions
unicorn?: boolean | ConfigUnicornOptions
unocss?: boolean | ConfigUnoCSSOptions
vue?: boolean | ConfigVueOptions
yml?: boolean | ConfigYmlOptions
/**
* Configs below are disabled by default
*/
astro?: boolean | ConfigAstroOptions
html?: boolean | ConfigHtmlOptions
pnpm?: boolean | ConfigPnpmOptions
oxfmt?: boolean | ConfigOxfmtOptions
svelte?: boolean | ConfigSvelteOptions
svgo?: boolean | ConfigSVGOOptions
eslintPlugin?: boolean | ConfigESLintPluginOptions
}For detailed type definitions, see:
Config Details
Click on each config name in the sidebar to see:
- Plugins used
- Available options
- Default configuration
- Implementation source
See Also
- Guide - Getting started guide
- Custom Configuration - Advanced customization
- ESLint Config Inspector - Visual rule browser