eslint-config-vtex
raw JSON → 15.1.0 verified Sat Apr 25 auth: no javascript
VTEX's shared ESLint configuration, version 15.1.0. It provides a preset for both JavaScript and TypeScript projects, automatically applying TypeScript rules for .ts/.tsx files and requiring type-checking via tsconfig. The config is extensible and integrates with Prettier. Released monthly with breaking changes following VTEX's internal needs. Differentiates from other configs by its opinionated set of rules tuned for VTEX's ecosystem, including React and Node.js practices.
Common errors
error Error: Cannot find module 'eslint-config-vtex' ↓
cause Missing package installation or incorrect extends value.
fix
Run: yarn add -D eslint-config-vtex (or npm install --save-dev eslint-config-vtex)
error ESLint: Error while loading rule '@typescript-eslint/...': You have used a rule which requires parserServices to be generated. You must provide 'parserOptions.project'. ↓
cause Missing tsconfig for type-checking rules.
fix
Add tsconfig.eslint.json and set parserOptions.project: './tsconfig.eslint.json'
error Error: Failed to load parser 'babel-eslint' ↓
cause babel-eslint not installed or wrong parser name.
fix
Install @babel/eslint-parser and use parser: '@babel/eslint-parser'
Warnings
breaking In v15, dropped support for ESLint 7; requires ESLint ^8. ↓
fix Upgrade ESLint to version 8 or later.
deprecated babel-eslint is deprecated; use @babel/eslint-parser instead. ↓
fix Replace 'babel-eslint' with '@babel/eslint-parser' in dependencies and config.
gotcha TypeScript type-checking rules require a tsconfig.json including all files. ↓
fix Create tsconfig.eslint.json that extends base and includes needed files.
gotcha Using 'extends' as a string instead of array can cause issues with override resolution. ↓
fix Always use array syntax: "extends": ["vtex"].
Install
npm install eslint-config-vtex yarn add eslint-config-vtex pnpm add eslint-config-vtex Imports
- vtex (config name) wrong
// wrong: extends as a string { "extends": "vtex" }correct// .eslintrc { "extends": ["vtex"] } - babel-eslint parser for JS files wrong
// wrong: misspelled parser: "babel-eslint-parser"correctparser: "babel-eslint" - TypeScript type-checking rules wrong
// wrong: including node_modules { "exclude": [] }correct// tsconfig.eslint.json { "extends": "./tsconfig.json", "include": ["**/*.ts", "**/*.tsx", "**/*.js"], "exclude": [] }
Quickstart
// .eslintrc
{
"extends": ["vtex"],
"rules": {
"no-console": "warn"
}
}