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.

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'
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"].
npm install eslint-config-vtex
yarn add eslint-config-vtex
pnpm add eslint-config-vtex

Shows basic ESLint config extending vtex preset and overriding one rule.

// .eslintrc
{
  "extends": ["vtex"],
  "rules": {
    "no-console": "warn"
  }
}