Registry / web-framework / eslint-plugin-nestjs

eslint-plugin-nestjs

JSON →
library1.2.3jsnpmunverified

This package, `eslint-plugin-nestjs` (version 1.2.3), provides a set of ESLint rules specifically designed for the NestJS framework. It aims to help developers enforce common best practices and catch potential issues related to NestJS decorators, pipes, and dependency injection patterns. The rules cover areas such as enforcing `ParseIntPipe` for `@Param()`, checking for deprecated API usage, ensuring dependency injection via constructors, and promoting the use of `ValidationPipe` for `@Body` parameters. However, it's crucial to note that the project explicitly states it is a 'Proof of Concept (POC) and is not under development'. This means it lacks active maintenance, bug fixes, or updates to support newer NestJS versions or ESLint configurations, making it potentially outdated and unsuitable for modern NestJS projects. Developers looking for actively maintained NestJS ESLint rules might consider alternatives like `@darraghor/eslint-plugin-nestjs-typed` or `@elsikora/eslint-plugin-nestjs-typed`.

npm install eslint-plugin-nestjs
INSTALL
IMPORT
SIG · ESLINT-PLUGIN-NEST
E
eslint-plugin-nestjs
web-frameworkjavascriptv1.2.3
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

plugins: ['nestjs']
{ plugins: ['nestjs'], extends: ['plugin:nestjs/recommended'] }
import nestjsPlugin from 'eslint-plugin-nestjs'
ESLint plugins are configured in the `.eslintrc.*` file, not imported via `import` statements in JavaScript/TypeScript code.
plugin:nestjs/recommended
extends: ['plugin:nestjs/recommended']
extends: ['nestjs/recommended']
The `plugin:` prefix is required to correctly reference a plugin's recommended configuration.
nestjs/parse-int-pipe
rules: { 'nestjs/parse-int-pipe': 'error' }
rules: { 'parse-int-pipe': 'error' }
Individual rules must be prefixed with the plugin name (`nestjs/`) in the `rules` section of the ESLint configuration.

Demonstrates how to configure `eslint-plugin-nestjs` in a NestJS project's `.eslintrc.js` file, including recommended configuration and specific rule activation.

/* eslint-env node */ module.exports = { root: true, parser: '@typescript-eslint/parser', parserOptions: { project: 'tsconfig.json', sourceType: 'module', }, plugins: [ 'nestjs', '@typescript-eslint', ], extends: [ 'eslint:recommended', 'plugin:@typescript-eslint/recommended', 'plugin:nestjs/recommended', 'prettier', ], rules: { // Example: Enforce usage of ParseIntPipe for @Param() 'nestjs/parse-int-pipe': 'error', // Example: Warn about deprecated API modules 'nestjs/deprecated-api-modules': 'warn', // Example: Ensure dependencies are provided via constructor 'nestjs/use-dependency-injection': 'error', // Example: Enforce ValidationPipe for @Body parameters 'nestjs/use-validation-pipe': ['error', { 'optional': false }], // You can also override rules from the recommended config or other plugins '@typescript-eslint/interface-name-prefix': 'off', '@typescript-eslint/explicit-function-return-type': 'off', '@typescript-eslint/explicit-module-boundary-types': 'off', '@typescript-eslint/no-explicit-any': 'off', }, env: { node: true, jest: true, }, ignorePatterns: ['.eslintrc.js', 'src/**/*.d.ts'], }; // Ensure you have installed: // npm install --save-dev eslint eslint-plugin-nestjs @typescript-eslint/parser @typescript-eslint/eslint-plugin eslint-config-prettier prettier
Debug
Known issues
breakingThis project is explicitly marked as 'POC and is not under development'. It has not been updated in 8 years. This means it will not receive bug fixes, security updates, or compatibility patches for newer versions of NestJS, ESLint, or TypeScript. Using it in production environments is highly discouraged.
fix
Consider migrating to actively maintained NestJS ESLint plugins such as `@darraghor/eslint-plugin-nestjs-typed` or `@elsikora/eslint-plugin-nestjs-typed`.
affects: >=1.2.3
gotchaDue to lack of maintenance, rules might not be compatible with recent changes or new features introduced in NestJS (e.g., NestJS v8, v9, or later). Rules may produce false positives, false negatives, or simply fail to function as intended on modern NestJS codebases.
fix
Regularly review the rules against your current NestJS version and project requirements. Prioritize actively maintained alternatives if compatibility issues arise.
affects: >=1.2.3
gotchaThe plugin's ruleset might not cover the latest best practices or common pitfalls that have emerged in the NestJS ecosystem since its last update. Newer, more comprehensive plugins exist that address a wider array of concerns, including advanced dependency injection checks, Swagger/OpenAPI documentation validation, and GraphQL-specific rules.
fix
Evaluate the rule sets of alternative, actively developed NestJS ESLint plugins to ensure comprehensive code quality checks for your project.
affects: >=1.2.3
Errors
Common errors & fixes
ESLint: Definition for rule 'nestjs/parse-int-pipe' was not found.
The `eslint-plugin-nestjs` plugin is installed but not correctly configured in the `plugins` section of `.eslintrc.*` file, or the rule name is mistyped.
fix
Ensure `nestjs` is listed in the `plugins` array in your `.eslintrc.js` (or similar config file) and that the rule name includes the `nestjs/` prefix, e.g., `'nestjs/parse-int-pipe': 'error'`.
TypeError: Cannot read properties of undefined (reading 'plugins') in .eslintrc.js
The `.eslintrc.js` file has a syntax error or is not exporting a valid configuration object.
fix
Verify that your `.eslintrc.js` file `module.exports = { ... }` contains a correctly structured configuration object and that all properties are valid.
Upgrade
Version history
1.2.3latest on npm
Audit
Dependencies
eslintrequiredPeer dependency for any ESLint plugin.
Agent activity
2 hits · last 30 days
node
2
Resources
eslint-plugin-nestjs — npm install eslint-plugin-nestjs · libregistry