Getting Started
Configuration
Configure @eienjs/eslint-config options, auto-detected features, and rule presets.
The default export eienjs() (also exported as a named function) accepts an options object as its first argument to toggle integrations, customize stylistic preferences, and override rules.
eslint.config.js
import { eienjs } from '@eienjs/eslint-config';
export default eienjs({
adonisjs: true,
formatters: true,
typescript: {
erasableSyntaxOnly: true,
tsconfigPath: 'tsconfig.json',
},
});
Configuration Options Overview
| Option | Type | Default | Description |
|---|---|---|---|
gitignore | boolean | FlatGitignoreOptions | true | Respect .gitignore files via eslint-config-flat-gitignore. |
ignores | string[] | ((originals: string[]) => string[]) | [] | Extend or modify global ignore patterns. |
javascript | OptionsOverrides | Enabled | Core JavaScript rules (always enabled; supports overrides). |
typescript | boolean | OptionsTypescript | Auto-detected | TypeScript rules, type-aware linting, and erasable syntax checks. |
stylistic | boolean | (StylisticConfig & OptionsOverrides) | true | Code formatting rules powered by @stylistic/eslint-plugin. |
adonisjs | boolean | OptionsAdonisJS | false | AdonisJS rules and directory-specific overrides. |
nuxt | boolean | OptionsNuxt | false | Nuxt 3/4 rules, page/layout checks, and config key sorting. |
vue | boolean | OptionsVue | Auto-detected | Vue 3 SFC rules (<script setup lang="ts"> by default). |
astro | boolean | OptionsOverrides | false | Astro component rules and parser setup. |
formatters | boolean | OptionsFormatters | false | External Prettier formatters for CSS, HTML, XML, SVG, Markdown, and Astro. |
unicorn | boolean | OptionsUnicorn | true | eslint-plugin-unicorn rules (snake_case filenames by default). |
perfectionist | boolean | OptionsOverrides | true | Natural sorting for imports and exports via eslint-plugin-perfectionist. |
imports | boolean | OptionsOverrides | true | Import hygiene rules via eslint-plugin-import-lite and eslint-plugin-antfu. |
node | boolean | true | Node.js rules via eslint-plugin-n. |
jsdoc | boolean | true | JSDoc formatting and validation rules. |
regexp | boolean | (OptionsRegExp & OptionsOverrides) | true | Regular expression rules via eslint-plugin-regexp. |
test | boolean | OptionsOverrides | true | Vitest and no-only-tests rules for test files. |
jsonc | boolean | OptionsOverrides | true | JSON/JSONC/JSON5 linting plus package.json and tsconfig.json sorting. |
yaml | boolean | OptionsOverrides | true | YAML linting and formatting via eslint-plugin-yml. |
toml | boolean | OptionsOverrides | true | TOML linting and formatting via eslint-plugin-toml. |
markdown | boolean | OptionsMarkdown | true | Lints Markdown files and code blocks inside Markdown. |
pnpm | boolean | OptionsPnpm | Auto-detected | Lints package.json and pnpm-workspace.yaml when workspace file exists. |
componentExts | string[] | [] | Additional file extensions treated as components (e.g. ['vue']). |
isInEditor | boolean | Auto-detected | Disables disruptive auto-fixes when running inside an IDE. |
autoRenamePlugins | boolean | true | Renames plugin prefixes (import-lite → import, vitest → test, yml → yaml). |
Auto-Detection Behavior
Several features are automatically enabled based on your project environment unless explicitly set to true or false:
- TypeScript (
typescript): Enabled whentypescriptor@typescript/native-previewis installed in your dependencies. - Vue (
vue): Enabled whenvue,nuxt,vitepress, or@slidev/cliis installed. - pnpm Workspace (
pnpm): Enabled when apnpm-workspace.yamlfile is found in the current or parent directories. - Editor Mode (
isInEditor): Enabled when running inside VS Code, JetBrains IDEs, Vim/Neovim, or Zed (and disabled automatically during CI, Git hooks, orlint-staged).
Passing Global Flat Config Properties
In addition to preset options, the first argument of eienjs() accepts top-level flat config properties (name, languageOptions, linterOptions, processor, plugins, rules, settings) to apply globally:
eslint.config.js
import { eienjs } from '@eienjs/eslint-config';
export default eienjs({
adonisjs: true,
rules: {
'no-console': 'warn',
},
});
Do not pass
files in the first argument of eienjs(), as the first argument is reserved for global configuration. Attempting to pass files throws an error. Instead, chain .append() or pass additional flat config objects—see Composer & Overrides.