@voicenter-team/eslint-config-ts
v2.0.1
Published
Shared eslint config
Keywords
Readme
An eslint configuration for ts
Shared ESLint config for TypeScript projects. Ships as a flat config array and supports ESLint 9 and 10.
Version 2.x requires ESLint >= 9 (flat config). For legacy
.eslintrcprojects on ESLint 8, stay on version 1.x.
Usage
- Install dependencies
npm i eslint @voicenter-team/eslint-config-ts --save-dev - Create
eslint.config.mjsin the project root:
or CommonJS (import voicenterTs from '@voicenter-team/eslint-config-ts' export default [ ...voicenterTs, // project-specific overrides go here ]eslint.config.js):const voicenterTs = require('@voicenter-team/eslint-config-ts') module.exports = [ ...voicenterTs ]
eslint:recommended and plugin:@typescript-eslint/recommended are already included — no need to add them again.
Usage with Vue 3
The config is framework-agnostic: the TypeScript parser is scoped to JS/TS files only, so framework plugins (Vue, Astro, Svelte, ...) keep ownership of their own file types, while the style/TS rules still apply inside them. Spread this config last so its rules win:
npm i eslint eslint-plugin-vue @vue/eslint-config-typescript @voicenter-team/eslint-config-ts --save-dev// eslint.config.mjs
import pluginVue from 'eslint-plugin-vue'
import { defineConfigWithVueTs, vueTsConfigs } from '@vue/eslint-config-typescript'
import voicenterTs from '@voicenter-team/eslint-config-ts'
export default defineConfigWithVueTs(
pluginVue.configs['flat/strongly-recommended'],
vueTsConfigs.recommended,
...voicenterTs
)This is the equivalent of the old .eslintrc:
{
"extends": [
"plugin:@typescript-eslint/recommended",
"plugin:vue/vue3-strongly-recommended",
"@vue/typescript/recommended",
"eslint:recommended",
"@voicenter-team/ts"
]
}Migrating from 1.x
All rules and options are preserved. What changed under the hood:
| 1.x (eslintrc) | 2.x (flat config) |
|---------------------------------------------------------|-------------------------------------------------------------------------------------------------|
| eslint:recommended | @eslint/js recommended |
| plugin:@typescript-eslint/recommended | typescript-eslint v8 recommended |
| env: { es2021, node, browser } | globals package |
| Core formatting rules (semi, quotes, indent, ...) | @stylistic/eslint-plugin — same rules, same options (core versions were removed in ESLint 10) |
| @typescript-eslint/no-var-requires: off | @typescript-eslint/no-require-imports: off (rules merged in typescript-eslint v8) |
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. Same forquotes,indent, etc. TypeScript rule names (@typescript-eslint/*) are unchanged. - typescript-eslint v8 renamed/split a few recommended rules:
ban-typesis nowno-empty-object-type/no-unsafe-function-type/no-wrapper-object-types, andno-unused-expressionswas added to recommended. - Remove
--extflags from lint scripts — flat config handles file matching itself. - On
.tsfiles, typescript-eslint v8 now disables the core rules that the TypeScript compiler already enforces (no-undef,no-dupe-keys,constructor-super,no-unreachable, ...). Those errors are reported bytscinstead of ESLint. Rules that were dropped fromeslint:recommendedin ESLint 9 without a TypeScript equivalent (no-inner-declarations,no-extra-semi,no-mixed-spaces-and-tabs) are explicitly restored by this config.
