@voicenter-team/eslint-config-vue
An eslint configuration for vue
Shared ESLint config for Vue 3 + TypeScript projects. Ships as a flat config array and supports ESLint 9 and 10.
Versions 2.x and 3.x require ESLint >= 9 (flat config). For legacy
.eslintrcprojects on ESLint 8, stay on version 1.x.
This single package includes everything a Vue project needs — eslint:recommended, typescript-eslint recommended, eslint-plugin-vue strongly-recommended, @vue/eslint-config-typescript and @voicenter-team/eslint-config-ts — so nothing else has to be added.
Usage
- Install dependencies
npm i eslint @voicenter-team/eslint-config-vue --save-dev - Create
eslint.config.mjsin the project root:
or CommonJS (import voicenterVue from '@voicenter-team/eslint-config-vue' export default [ ...voicenterVue, // project-specific overrides go here ]eslint.config.js):const voicenterVue = require('@voicenter-team/eslint-config-vue') module.exports = [ ...voicenterVue ]
Strict TypeScript rules
In script code, @voicenter-team/eslint-config-ts bans type assertions (x as Foo, <Foo>x), non-null assertions (x!), // @ts-ignore, // @ts-expect-error and // @ts-nocheck comments, and explicit any; as const and // @ts-check are allowed. Its README lists the rules and what replaces each construct: unknown instead of any, type guards, explicit checks, generics, annotations and satisfies.
Those rules see script code only. In <template> expressions, vue/no-restricted-syntax bans the same syntax: TSAsExpression, TSTypeAssertion and TSNonNullExpression. In a template every as is reported, as const included. A value the template needs narrowed is narrowed by a v-if with a type guard, or in the script, for example in a computed.
Migrating from 2.x
3.x depends on @voicenter-team/eslint-config-ts 3.x and completes the strict TypeScript rules: it bans type assertions and non-null assertions in script code and in templates, and // @ts-expect-error comments with a description, which 2.x allowed. // @ts-ignore, // @ts-nocheck and explicit any were already errors in 2.x. Every other rule and option is unchanged. A project that upgrades fails lint at each newly banned construct it uses.
Migrating from 1.x
The old .eslintrc setup:
{
"extends": [
"plugin:@typescript-eslint/recommended",
"plugin:vue/vue3-strongly-recommended",
"@vue/typescript/recommended",
"eslint:recommended",
"@voicenter-team/vue"
]
}
becomes just the eslint.config.mjs shown above — all of those presets are already composed into this package.
All custom rules and options are preserved. What changed under the hood:
| 1.x (eslintrc) | 2.x (flat config) |
|---|---|
plugin:vue/vue3-strongly-recommended |
eslint-plugin-vue v10 flat/strongly-recommended |
@vue/typescript/recommended |
@vue/eslint-config-typescript v14 (defineConfigWithVueTs) |
vue/component-tags-order |
vue/block-order (rule was renamed in eslint-plugin-vue v10; same template → script → style order) |
env: { 'vue/setup-compiler-macros': true } |
compiler macro globals baked in (now also covers defineModel, defineOptions, defineSlots) |
@voicenter-team/eslint-config-ts 1.x |
2.x — see its migration notes |
Things to check in consuming projects:
- Inline disable comments for formatting rules need the new prefix:
// eslint-disable-next-line semibecomes// eslint-disable-next-line @stylistic/semi.vue/*and@typescript-eslint/*rule names are unchanged, exceptvue/component-tags-order→vue/block-order. <script>blocks may usets,tsx,jsorjsx, same as 1.x. To restrict to TypeScript only, the consuming project can add avue/block-langoverride.- Remove
--extflags from lint scripts — flat config handles file matching itself.
Related Packages
Nuxt module that helps you to easily load your Umbraco data directly into your g...
Nuxt module that helps you to easily load your Umbraco data directly into your g...
This is Vue 3.x + Typescript component library made for Voicenter systems.
Nuxt 3/4 module that renders AI-optimized documentation files (llms.txt, llms-fu...
Version History
| Version | Released | License |
|---|---|---|
| 3.0.0 | ISC | |
| 2.0.1 | ISC | |
| 2.0.0 | ISC | |
| 1.0.26 | ISC | |
| 1.0.25 | ISC | |
| 1.0.24 | ISC | |
| 1.0.23 | ISC | |
| 1.0.21 | ISC | |
| 1.0.20 | ISC |