eslint-plugin-vue-perfectionist

ESLint rules for consistent, readable, and maintainable Vue 3 code.
2,366
Install
npm install eslint-plugin-vue-perfectionist
Latest Version:0.11.0
Vue:3
License:MIT
Last Updated:Oct 20, 2026
Links: GitHub  ·  npm
Maintainer: ntnyq

eslint-plugin-vue-perfectionist

CI NPM VERSION NPM DOWNLOADS LICENSE

ESLint rules for consistent, readable, and maintainable Vue 3 code.

Define conventions for callbacks and composables, macro types and layout, ref and result naming, component usage contracts, template expressions, and setup statement ordering. Each rule defines its own scope: Vue SFC templates, script blocks, or standalone JavaScript and TypeScript files.

The plugin provides rules only, with no built-in configurations. Choose rules explicitly and configure their options for your project.

[!WARNING] This project is under active development. The API is unstable and may introduce breaking changes before the first stable release.

Documentation · Getting Started · Rules

Setup

This ESM package requires ESLint ^10.0.0 and vue-eslint-parser ^10.0.0.

pnpm add -D eslint eslint-plugin-vue-perfectionist vue-eslint-parser

For TypeScript SFCs, also install the TypeScript parser:

pnpm add -D @typescript-eslint/parser typescript

Register the plugin and enable the rules you want in eslint.config.mjs. The plugin provides rules only, with no built-in configurations:

import tsParser from '@typescript-eslint/parser'
import { defineConfig } from 'eslint/config'
import vuePerfectionist from 'eslint-plugin-vue-perfectionist'
import vueParser from 'vue-eslint-parser'

export default defineConfig([
  {
    files: ['**/*.vue'],
    languageOptions: {
      parser: vueParser,
      parserOptions: { parser: tsParser },
    },
    plugins: {
      'vue-perfectionist': vuePerfectionist,
    },
    rules: {
      'vue-perfectionist/callback-style': 'error',
      'vue-perfectionist/consistent-template-ref-name': 'error',
      'vue-perfectionist/define-macros-newline': 'error',
      'vue-perfectionist/prefer-ref-pattern': 'error',
      'vue-perfectionist/sort-script-setup': 'error',
    },
  },
])

For JavaScript-only SFCs, omit the TypeScript parser import and parserOptions.parser. If your Vue configuration already supplies the parsers, add the plugin and your chosen rules.

See the setup guide for more configuration options.

Configuration

  • File scopes and parsers: configure Vue SFCs and standalone JS/TS files.
  • Auto-imported APIs: enable settings['vue-perfectionist'].autoImport for supported unbound API names. It defaults to false; local bindings and rule-level overrides take precedence. Configure ESLint globals separately.
  • Rule composition: combine related checks and avoid overlapping sorting or padding rules.
  • Public types: import rule option types and VuePerfectionistSettings from the package root. The default export and named plugin export refer to the same plugin object.

Rules

Component prop, slot, and generic-comment rules need explicit targets; they check no components by default. sort-script-setup orders groups by default; set type: 'natural' or another comparator to sort names within groups.

See the rules overview for file scopes and automatic fix availability. Only supported cases are fixed; naming, type, and component contract diagnostics require manual changes.

Rule Description
callback-style Enforce callback styles for Vue APIs.
component-prop-types Enforce configured component prop value types.
component-prop-values Enforce configured component prop value constraints.
consistent-template-ref-name Require template ref variable names to match their keys.
define-macros-newline Require multiline inline Vue macro declarations.
define-macros-type-style Enforce declaration styles for Vue macro types.
max-lines-per-callback Limit the length of inline callbacks for Vue APIs.
no-complex-v-for-source Disallow complex expressions in Vue v-for sources.
padding-line-between-tags Enforce blank-line counts between consecutive template tags.
prefer-composable-options Prefer a final options object for composable parameters.
prefer-function-declaration Require function declarations in SFCs and composables.
prefer-function-result-pattern Enforce naming patterns for function result bindings.
prefer-ref-pattern Enforce naming patterns for template refs.
prefer-simple-event-handler Require simple expressions in named template event handlers.
prefer-template-literal-in-interpolation Prefer a single template literal for mixed text and interpolation.
prefer-use-template-ref-inference Prefer inferred types for static Vue template refs.
require-component-props Require configured props at component usage sites.
require-component-slots Require configured slots at component usage sites.
require-macro-type-name Require exact call-site names for Vue macro types.
require-vue-generic Require explicit generic comments on configured components.
sort-script-setup Group and order top-level statements in <script setup>.

Development

Use the Node version selected by .node-version and the pnpm version pinned in package.json:

pnpm install --frozen-lockfile
pnpm test
pnpm docs:dev

See Contributing for build, validation, testing, and documentation workflows, and Architecture and Design for repository structure and analysis boundaries. Package build output in dist/ is generated.

Credits

This is an independent project and is not an official extension of eslint-plugin-perfectionist or eslint-plugin-vue.

License

MIT License © 2026-PRESENT ntnyq

Related Packages

@mutoe/eslint-plugin-perfectionist-vue

ESLint plugin for sorting vue attributes

5,488 2,937
eslint-plugin-vue-no-static-computed

ESLint rule to disallow Vue computed() wrapping purely static values with no rea...

892 0
eslint-plugin-vue-data-testid

An ESLint plugin to enforce consistent usage of 'data-testid' attributes in Vue....

147,849 3
eslint-plugin-vue-storefront

ESLint rules for Vue Storefront

39,292
eslint-plugin-vue-setup-order

ESLint plugin to enforce consistent order of statements in Vue 3

2,079 0

Version History

Version Released License
0.11.0 MIT
0.10.0 MIT
0.9.0 MIT
0.8.0 MIT
0.7.0 MIT