eslint-config-metalab

raw JSON →
10.1.0 verified Fri May 01 auth: no javascript maintenance

ESLint shareable config for MetaLab's JavaScript style guidelines, version 10.1.0. It extends rules inspired by Airbnb with additional opinionated choices, covering ES5 (legacy), ES6 (base), and React. The config namespaces all plugin rules under `metalab/` to avoid peer dependency conflicts and multiple plugin installs. Release cadence is sporadic; major versions may introduce breaking rule changes.

error Error: Failed to load plugin 'metalab': Cannot find module 'eslint-plugin-metalab'
cause Using 'extends: metalab' without installing eslint-config-metalab, or confusion with plugin namespacing.
fix
Ensure eslint-config-metalab is installed: npm install --save-dev eslint-config-metalab.
error ESLint couldn't determine the config for 'metalab'. Check your configuration file.
cause Missing or incorrect .eslintrc.json; 'extends' value should be just 'metalab', not 'eslint-config-metalab'.
fix
Set 'extends': ['metalab'] in .eslintrc.json.
error Error: Cannot read property 'rules' of undefined for the 'metalab/import/no-commonjs' rule.
cause The rule name uses the namespaced prefix 'metalab/', but the actual rule is from eslint-plugin-import.
fix
Use 'metalab/import/no-commonjs' as the rule key when disabling.
error Peer dependency warning: eslint@>=5.2.0 is required but not installed.
cause ESLint not installed or version mismatch.
fix
Run: npm install --save-dev eslint@^5.2.0
gotcha Rules from plugins are namespaced under 'metalab/', so to disable a rule you must use the prefixed name, e.g., 'metalab/import/no-commonjs': 0.
fix Use 'metalab/rule-name' instead of 'plugin/rule-name' to disable rules.
breaking Version 2.x changed extending from 'metalab' to 'metalab/base' for ES6 code. Old 'metalab' preset now targets legacy ES5.
fix Update your .eslintrc to use 'metalab/base' for modern code or 'metalab/legacy' for ES5.
breaking Version 5.0.0 dropped support for Node.js <6 and upgraded ESLint peer dependency to ^4.0.0.
fix Update Node.js to >=6 and ESLint to ^4.
deprecated The 'metalab/legacy' preset is deprecated in favor of 'metalab/base' with a separate config for legacy code.
fix Use 'metalab/base' for modern ES6+ code and consider a custom config for legacy ES5.
gotcha This package does not auto-install its ESLint plugins; you must manually install any plugins that rules depend on (e.g., eslint-plugin-import, eslint-plugin-react).
fix Check the package's dependencies in node_modules/eslint-config-metalab/package.json for required plugins and install them.
npm install eslint-config-metalab
yarn add eslint-config-metalab
pnpm add eslint-config-metalab

Install eslint and eslint-config-metalab, then configure .eslintrc with the 'metalab' preset and optional sub-presets (base, react). Copy .gitignore to .eslintignore and run eslint.

# Install dependencies
npm install --save-dev eslint eslint-config-metalab

# Create .eslintrc.json
cat > .eslintrc.json << EOF
{
  "extends": [
    "metalab",
    "metalab/base",
    "metalab/react"
  ]
}
EOF

# Alternatively, copy .gitignore to .eslintignore
cp .gitignore .eslintignore

# Lint all JS files
eslint .

# Or add to package.json scripts:
# "lint": "eslint ."