Skip to content

ej-shafran/eslint-plugin-nestjs-pedantic

Repository files navigation

eslint-plugin-nestjs-pedantic

Nitpicky ESLint rules.

Installation

npm install -D eslint eslint-plugin-nestjs-pedantic

Configuration

Old (.eslintrc.*)

module.exports = {
  // ...
  plugins: [
    // ...
    "nestjs-pedantic",
  ],
  extends: [
    // ...
    "nestjs-pedantic/recommended",
  ],
};

New (eslint.config.js)

Either use one of the configs in eslint-plugin-nestjs-pedantic/lib/configs or import the plugin as a standalone from eslint-plugin-nestjs-pedantic.

const nestjsPedanticRecommended = require("eslint-plugin-nestjs-pedantic/lib/configs/recommended");

module.exports = {
  // ...
  ...nestjsPedanticRecommended,
};

Rules

💼 Configurations enabled in.
🌐 Set in the all configuration.
✅ Set in the recommended configuration.
🔧 Automatically fixable by the --fix CLI option.
💡 Manually fixable by editor suggestions.

Name Description 💼 🔧 💡
match-methods-to-routes Match method names to the decorated API routes 🌐 ✅ 🔧
no-duplicate-route-params Disallow duplicate route parameters 🌐 ✅
no-unused-route-params Disallow unused route parameters 🌐 ✅ 💡
route-convention Keep a convention when decorating routes 🌐 ✅ 🔧 💡
safe-route-params Ensure safe usage of the @Param decorator 🌐 ✅ 💡