@nyvoru/eslint-config
@nyvoru/eslint-config
Opinionated ESLint config for Nyvoru Vue and Nuxt projects. Wraps @antfu/eslint-config with a small set of overrides: no semicolons, single quotes, braces except for one-line statements, and a few stylistic tweaks aligned with the Vue Core and Nuxt Core repos.
Install
pnpm add -D @nyvoru/eslint-config @antfu/eslint-config eslint
Usage
// eslint.config.ts (Vue)
import config from '@nyvoru/eslint-config'
export default config({ ignores: ['dist'] })
// eslint.config.ts (Nuxt)
import config from '@nyvoru/eslint-config'
import withNuxt from './.nuxt/eslint.config.mjs'
export default withNuxt(config({ ignores: ['dist', '.nuxt'] }))
// Opt into linting code blocks inside .md files
export default config({ markdown: true })
config() forwards every option to Antfu's factory. Append extra
flat-config items after the options:
import config from '@nyvoru/eslint-config'
export default config(
{ ignores: ['dist'] },
{
files: ['**/*.spec.ts'],
rules: { 'some-rule': 'off' },
},
)
Overrides
Three blocks extend Antfu's defaults: code, tests, and markdown. The
factory also locks stylistic.quotes: 'single' and stylistic.semi: false
so a future Antfu default flip cannot change them silently.
Code (Vue, Nuxt, JS, TS)
| Rule | Setting | Effect |
|---|---|---|
curly |
['error', 'multi-line', 'consistent'] |
Braces everywhere, except a single statement kept on the same line |
style/brace-style |
['error', 'stroustrup', { allowSingleLine: false }] |
A braced block never stays on one line |
antfu/if-newline |
'off' |
Keeps if (!x) return on one line |
style/space-before-function-paren |
['error', 'always'] |
function foo () |
style/quote-props |
['error', 'consistent'] |
Quote every key or none |
Tests (**/*.spec.ts)
| Rule | Setting | Effect |
|---|---|---|
test/prefer-lowercase-title |
['error', { ignore: ['describe'] }] |
Lowercase it/test titles, allow PascalCase in describe |
Markdown (**/*.md/**)
Active only when a project opts in via config({ markdown: true }).
| Rule | Setting | Effect |
|---|---|---|
vue/singleline-html-element-content-newline |
'off' |
Allow inline HTML in code samples |
style/arrow-parens |
'off' |
Allow paren-less single-param arrows |
Related Packages
Shared ESLint flat config for Vasek's Vue/Nuxt/TS projects. Wraps @antfu/eslint-...
Opinionated ESLint config for consistent, clean, auto-sorted code in TRES Vue3 a...
Version History
| Version | Released | License |
|---|---|---|
| 0.3.0 | MIT | |
| 0.2.0 | MIT | |
| 0.1.0 | MIT |