
Security News
rv Is a New Rust-Powered Ruby Version Manager Inspired by Python's uv
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
@volue/eslint-config
Advanced tools
🔍 Sharable ESLint configuration presets for usage across Volue projects.
[!NOTE] This package utilizes EsLint's "flat onfig" format, not the legacy "eslintrc" format and is only compatible with ESLint v9+.
Install as a dev dependency alongside ESLint and Prettier:
yarn add -D @volue/eslint-config
yarn add -D eslint prettier
or
npm install -D # etc ...
Add an eslint.config.js
and set up ESLint with relevant presets documented below. Import presets you are interested in, spreading them into your config:
// eslint.config.js
import {
base,
imports,
typescript,
react,
vitest,
testingLibrary
} from '@volue/eslint-config';
/** @type {import("eslint").Linter.Config[]} */
export default [
...base,
...imports,
...typescript,
...react,
...vitest,
...testingLibrary
];
If your project is CommonJS, no problem, you can use this package as CommonJS just fine!
// eslint.config.js
const {
base,
imports,
typescript,
react,
vitest,
testingLibrary
} = require('@volue/eslint-config');
/** @type {import("eslint").Linter.Config[]} */
module.exports = [
...base,
...imports,
...typescript,
...react,
...vitest,
...testingLibrary
];
Latest versions of ESLint support TypeScript configuration files natively. You can use eslint.config.ts
instead of eslint.config.js
:
// eslint.config.ts
import type { Linter } from 'eslint';
import {
base,
imports,
typescript,
react,
vitest,
testingLibrary
} from '@volue/eslint-config';
export default [
...common,
...modules,
...node,
...stylistic,
...typescript,
...ignores
];
export default [
...base,
...imports,
...typescript,
...react,
...vitest,
...testingLibrary
] satisfies Linter.Config[];
Each environment has its own preset configuration that can be easily applied in your project.
base
– A set of base rules that extend the neostandard base config. Includes prettier rules for code formatting and common ignore patterns like dist
, node_modules
and files in .gitignore
.imports
– Enables rules for formatting and ordering imports.typescript
– For usage with TypeScript.react
– For usage with React.jest
– For usage with Jest.testing frameworkvitest
– For usage with Vitest testing framework.testing-library
– For usage with Testing Library.playwright
– For usage with Playwright.Since base
preset integrates Prettier as a rule, this package also provides shared Prettier configuration.
Create a prettier.config.js
file that re-exports the configuration object from @volue/eslint-config/prettier-config
entry point:
// prettier.config.js
export { default } from '@volue/eslint-config/prettier-config';
// prettier.config.js
module.exports = require('@volue/eslint-config/prettier-config');
Alternatively, you can add the prettier
key in your package.json
like so:
+ "prettier": "@volue/eslint-config/prettier-config",
For all the possible options, please refer to the Prettier documentation.
You can extend or override the settings from @volue/eslint-config
per your project's needs by editing the eslint.config.js
file. Learn more about configuring ESLint on the ESLint website.
// eslint.config.js
import { base, imports, react, typescript } from '@volue/eslint-config';
import reactRefreshPlugin from 'eslint-plugin-react-refresh';
/** @type {import("eslint").Linter.Config[]} */
export default [
...base,
...imports,
...react,
...typescript,
// your modifications here
{
rules: {
'no-undef': 'off'
}
},
// additional, per-project custom plugins and rules
{
files: ['**/*.{ts,tsx}'],
plugins: {
'react-refresh': reactRefreshPlugin
},
rules: {
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true }
]
}
},
// extend what is ignored
{
ignores: ['**/*.mjs']
}
];
It's a common practice to add linting and formatting scripts to your package.json
for convenience:
// package.json
{
"scripts": {
"lint:js+ts": "eslint .",
"lint:fix:js+ts": "eslint . --fix",
"lint:format": "prettier \"**/*.{html,css,json,md,yml}\" --check",
"lint:fix:format": "prettier \"**/*.{html,css,json,md,yml}\" --write --log-level=warn"
}
}
Note that you can still use Prettier to format files that are not supported well by ESLint such as .css
, .html
, .yml
etc.
Make sure you have the ESLint and Prettier extensions installed in your Visual Studio Code.
It's a good idea to recommend installing these extensions via the .vscode/extensions.json
file in your project.
.vscode/extensions.json
{
"recommendations": ["dbaeumer.vscode-eslint", "esbenp.prettier-vscode"]
}
Then create a .vscode/settings.json
file in your project with the following contents to enable full formatting and fixing on save:
{
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
// turn it off for `js` and `ts(x)`, we will do this via ESLint
"[javascript][typescript][typescriptreact]": {
"editor.formatOnSave": false
},
// tell the ESLint plugin to run on save
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
}
}
You can use Lefthook, a fast, cross-platform hook manager to run ESLint and Prettier on staged files before committing.
Install Lefthook:
yarn add -D lefthook
Add a file named .lefthook.json
at the root of your Git repository.
Format and lint before committing example
// .lefthook.json
{
"$schema": "https://json.schemastore.org/lefthook.json",
"pre-commit": {
"parallel": true,
"commands": {
"lint": {
"glob": "*.{js,ts,tsx}",
"run": "yarn eslint --fix {staged_files}",
"stage_fixed": true
},
"format": {
"glob": "*.{html,css,json,md,yml}",
"run": "yarn prettier --write {staged_files}",
"stage_fixed": true
}
}
}
}
Contributions are welcome! Please check out the issues or submit a pull request.
Here's a subset of some projects that rely on @volue/eslint-config
:
FAQs
Volue ESLint config presets
The npm package @volue/eslint-config receives a total of 211 weekly downloads. As such, @volue/eslint-config popularity was classified as not popular.
We found that @volue/eslint-config demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.
Security News
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.