This config brings together the best ESLint rules and plugins to help you write clean, consistent code. Here's what you get out of the box:
- JavaScript & TypeScript - Full support for modern JS/TS syntax
- React Support - Optional React-specific linting rules
- Node.js Integration - Node-specific rules when targeting server environments
- JSON Linting - Support for
.json
,.jsonc
, and.json5
files - Markdown Linting - Keep your documentation consistent
- Vitest Testing - Specialized rules for Vitest test files
- Prettier Integration - Seamlessly works with Prettier formatting
- JavaScript:
.js
,.jsx
,.mjs
,.cjs
- TypeScript:
.ts
,.tsx
,.mts
,.cts
- JSON:
.json
,.jsonc
,.json5
- Markdown:
.md
- Tests:
.test.*
,.benchmark.*
- ESLint recommended rules
- XO configuration (both JS and TS)
- Import/export validation and sorting
- Unicorn (modern JS practices)
- Promise best practices
- ESLint comments management
- TypeScript-specific linting
- React hooks and JSX rules (when enabled)
- And many more quality-of-life improvements!
yarn add -D @ver0/eslint-config
Setting up your ESLint config is straightforward! The configuration assumes you're using TypeScript and Prettier by default (though you can disable specific features if needed).
// eslint.config.js
import {defineConfig} from 'eslint/config';
import {buildConfig} from '@ver0/eslint-config';
export default defineConfig(
...buildConfig({
globals: 'node',
typescript: true,
typescriptUnsafe: true,
vitest: true,
json: true,
markdown: true,
react: true,
}),
{
files: ['README.md'],
language: 'markdown/gfm',
},
// ... any other configs on your taste...
);
Option | Type | Default | Description |
---|---|---|---|
globals |
string |
'node' |
Required. Environment globals ('node' , 'browser' , etc.) |
prettier |
boolean |
true |
Enable Prettier integration and formatting rules |
typescript |
boolean |
true |
Enable TypeScript-specific linting rules |
typescriptUnsafe |
boolean |
false |
Disable TypeScript's strict safety rules |
json |
boolean |
true |
Enable JSON/JSONC/JSON5 file linting |
markdown |
boolean |
true |
Enable Markdown file linting |
react |
boolean |
false |
Enable React and JSX-specific rules |
vitest |
boolean |
false |
Enable Vitest testing framework rules |
For a Node.js API project:
// eslint.config.js
import {defineConfig} from 'eslint/config';
import {buildConfig} from '@ver0/eslint-config';
export default defineConfig(
...buildConfig({
globals: 'node',
vitest: true, // if you're using Vitest for testing
}),
// ... any other configs on your taste...
);
For a React web application:
// eslint.config.js
import {defineConfig} from 'eslint/config';
import {buildConfig} from '@ver0/eslint-config';
export default defineConfig(
...buildConfig({
globals: 'browser',
react: true,
vitest: true,
}),
// ... any other configs on your taste...
);
This package also provides opininated default Prettier configuration, that you can extend from.
// .prettierrc.js
import ver0Config from '@ver0/eslint-config/.prettierrc.js';
export default {
...ver0Config,
// Override any settings if needed
// printWidth: 100,
};
For consistent formatting across different editors, you can copy our .editorconfig
that is aligned with our Prettier
configuration:
# .editorconfig
[*]
indent_style = tab
tab_width = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
max_line_length = 120
[*.yml]
indent_style = space
indent_size = 2
Rules conflicting with your existing setup? You can override specific rules by adding them after our config:
// eslint.config.js
import {defineConfig} from 'eslint/config';
import {buildConfig} from '@ver0/eslint-config';
export default defineConfig(...buildConfig({globals: 'node'}), {
rules: {
'some-rule': 'off', // Override any rule
},
});