ESLint config preset for JavaScript, TypeScript, Vue, and Prettier
- [x] 🎨 Format with Prettier
- [x] ⚡ Designed to work with Vue3 & TypeScript
- [x] 📋 ESLint Flat config
- [x] 🚫 Ignores common files like
node_modules
,dist
and files in.gitignore
- [x] 🎯 Best practices, only one-line of config
- [x] 💯 Just to pursue higher code quality, no more
- [ ] 🌐 Add more language support
Using pnpm, yarn, or npm
# with pnpm
pnpm add -D @refinist/eslint-config
# with yarn
yarn add -D @refinist/eslint-config
# with npm
npm i -D @refinist/eslint-config
Require Node.js >= 22.16.0, and ESLint >= 9.5.0.
// eslint.config.ts
import { refinist } from '@refinist/eslint-config';
export default refinist();
// eslint.config.ts
import { refinist } from '@refinist/eslint-config';
export default refinist({
vue: true, // auto detection
prettier: true // default true
});
// eslint.config.ts
import { refinist } from '@refinist/eslint-config';
export default refinist(
{},
// From the second arguments they are ESLint Flat Configs
// you can have multiple configs
{
files: ['**/*.ts'],
rules: {}
},
{
rules: {}
}
);
// eslint.config.ts
import { refinist, GLOB_VUE } from '@refinist/eslint-config';
export default refinist(
{},
{
files: [GLOB_VUE], // GLOB_VUE is '**/*.vue'
rules: {
'vue/block-order': 'off'
}
}
);
Combine with @refinist/prettier-config
pnpm add -D @refinist/prettier-config
npm i -D @refinist/prettier-config
yarn add -D @refinist/prettier-config
// package.json
{
"prettier": "@refinist/prettier-config"
}
// .prettierrc.json
"@refinist/prettier-config"
// prettier.config.js
export { default } from '@refinist/prettier-config';
// prettier.config.js
import config from '@refinist/prettier-config';
/** @type {import('prettier').Config} */
export default {
...config
/* your custom config */
};
[!TIP] For more Prettier configuration options, please refer to the official documentation
By the way, the configuration method I like is package.json
😬
If you used Official Vue Starter, which is npm create vue@latest
to create your project, here are a few steps to quickly integrate with the official template:
- Remove related packages and files
@vue/eslint-config-prettier
@vue/eslint-config-typescript
eslint-plugin-vue
-
.prettierrc.json
file
[!TIP] Keep the eslint and prettier packages
- Install
@refinist/eslint-config
and@refinist/prettier-config
pnpm add -D @refinist/eslint-config @refinist/prettier-config
- Configure
eslint.config.ts
// eslint.config.ts
import { refinist } from '@refinist/eslint-config';
export default refinist();
- Configure
prettier
// package.json
{
"prettier": "@refinist/prettier-config"
}
- Configure
scripts
// package.json
{
"scripts": {
"lint": "eslint",
"lint:fix": "eslint --fix"
}
}
- Verify/Fix
pnpm run lint
pnpm run lint:fix
[!WARNING] If your ESLint configuration file is
.ts
and you encounter errors when runningpnpm run lint
, it's because you don't have the jiti library as a dependency. See reference, or you can simply switch toeslint.config.js
instead of using.ts
, which works great too!
Done!
[!TIP] If you didn't select eslint and prettier, replace step 1 above with
pnpm add -D eslint
andpnpm add -D prettier
, then continue with the steps above!
// .vscode/settings.json
{
"editor.formatOnSave": false,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
}
}
Copyright (c) 2025-present, Zhifeng (Jeff) Wang