eslint-config-loopback

raw JSON →
14.0.0 verified Sat Apr 25 auth: no javascript

Shareable ESLint configuration for LoopBack projects. Version 14.0.0 provides a set of predefined rules consistent with LoopBack's coding standards. This package is maintained by the LoopBack team and is primarily used in Node.js server-side applications. It integrates with ESLint and allows easy extension and overriding of rules. Release cadence is tied to LoopBack releases. Unlike generic ESLint configs, this one is tailored specifically for LoopBack projects, ensuring code style consistency across the ecosystem.

error Error: Failed to load config 'loopback' to extend from.
cause The package is not installed or ESLint cannot find the config module.
fix
Ensure eslint-config-loopback is installed: npm install -D eslint eslint-config-loopback.
error Definition for rule 'comma-dangle' was not found.
cause The rule 'comma-dangle' is deprecated or removed in the version of ESLint in use.
fix
Update .eslintrc to use the correct rule name (e.g., '@stylistic/comma-dangle') or set to 'off'.
error Environment key "es2021" is unknown.
cause ESLint version does not support the specified ecmaVersion or env setting.
fix
Use appropriate ESLint version or adjust ecmaVersion/env in .eslintrc.
breaking ESLint version compatibility: eslint-config-loopback may require specific ESLint major versions. Breaking changes in ESLint (e.g., v7 to v8) can cause config incompatibility.
fix Check peer dependency requirements in package.json; use compatible ESLint version.
deprecated Some rules may be deprecated in newer ESLint versions (e.g., no-catch-shadow, no-native-reassign). These rules are no longer valid and can cause errors.
fix Override deprecated rules in .eslintrc with appropriate replacements or set to 'off'.
gotcha The config extends 'loopback' but does not include a 'parser' option. If using TypeScript or Babel, you must set a parser manually.
fix Add 'parser' field to .eslintrc (e.g., '@typescript-eslint/parser') and install corresponding packages.
gotcha Config does not include environment settings (e.g., node, browser). You may need to set 'env' in your .eslintrc for proper global variable recognition.
fix Add 'env' object to .eslintrc: { "env": { "node": true } }.
npm install eslint-config-loopback
yarn add eslint-config-loopback
pnpm add eslint-config-loopback

Shows how to install and configure eslint-config-loopback in a LoopBack project, with optional override of rules.

// Install dependencies
// npm install -D eslint eslint-config-loopback

// .eslintrc
{
  "extends": "loopback",
  "rules": {
    "comma-dangle": "off"
  }
}

// package.json scripts
{
  "scripts": {
    "lint": "eslint .",
    "posttest": "npm run lint"
  }
}

// Run lint
// npm run lint