eslint-config-nestjs

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

An ESLint configuration preset extracted from the official NestJS TypeScript starter. Version 0.8.0 consolidates ESLint, TypeScript-ESLint, Prettier, and other plugins into a single shareable config, reducing direct dependencies. It is distributed as an npm package and updated occasionally. Unlike manually wiring up @typescript-eslint/eslint-plugin, @typescript-eslint/parser, eslint-config-prettier, eslint-plugin-prettier, and prettier, this preset provides a one-line extend and automatic plugin resolution, though it offers limited customization out of the box.

error ESLint couldn't find the config "nestjs"
cause The eslint-config-nestjs package is not installed or not in node_modules.
fix
Install the package: npm i -D eslint-config-nestjs."
error Failed to load plugin '@typescript-eslint' declared in 'nestjs': Cannot find module '@typescript-eslint/eslint-plugin'
cause Missing peer dependency @typescript-eslint/eslint-plugin.
fix
Install peer dependency: npm i -D @typescript-eslint/eslint-plugin @typescript-eslint/parser."
error Definition for rule 'prettier/prettier' was not found
cause eslint-plugin-prettier is not installed.
fix
Install the missing plugin: npm i -D eslint-plugin-prettier prettier."
gotcha The preset's peer dependencies may not be automatically installed by npm/pnpm. Ensure all peer dependencies are present.
fix Run `npm i -D eslint-config-nestjs @typescript-eslint/eslint-plugin @typescript-eslint/parser eslint-config-prettier eslint-plugin-prettier prettier`."
gotcha Using 'extends: 'nestjs'' in .eslintrc.js will be ignored if the preset is not installed or if ESLint cannot resolve the configuration.
fix Verify eslint-config-nestjs is in node_modules and check ESLint's config resolution by running `npx eslint --print-config src/index.ts`."
gotcha The preset includes `eslint-plugin-prettier` which may cause performance issues on large projects. Consider using Prettier as a separate formatter.
fix Disable the plugin by adding `'prettier/prettier': 'off'` in rules.
npm install eslint-config-nestjs
yarn add eslint-config-nestjs
pnpm add eslint-config-nestjs

Minimal ESLint config using the nestjs preset, including parser options for TypeScript project. Shows how to extend the preset and run ESLint.

// .eslintrc.js
module.exports = {
  extends: 'nestjs',
  parserOptions: {
    project: './tsconfig.json',
  },
};

// Install peer dependencies (if not auto-installed)
// npm i -D eslint-config-nestjs eslint @typescript-eslint/eslint-plugin @typescript-eslint/parser eslint-config-prettier eslint-plugin-prettier prettier

// Run ESLint:
// npx eslint "src/**/*.ts"