@darraghor/eslint-plugin-nestjs-typed 4.0.0 → 4.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +46 -37
  2. package/package.json +9 -9
package/README.md CHANGED
@@ -6,9 +6,9 @@
6
6
 
7
7
  ## A note on versions
8
8
 
9
- Version 2.x supports Eslint version <=7.x and typescript eslint parser 4
10
-
11
- Version 3.x supports Eslint version >=8.x and typescript eslint parser 5+
9
+ - Version `4.x` supports Eslint version `>=8.x` and typescript eslint parser `^6`
10
+ - Version `3.x` supports Eslint version `>=8.x` and typescript eslint parser `^5`
11
+ - Version `2.x` supports Eslint version `<=7.x` and typescript eslint parser `^4`
12
12
 
13
13
  There were many breaking changes between these versions.
14
14
 
@@ -18,34 +18,32 @@ This plugin only supports typescript up to the version typescript eslint parser
18
18
 
19
19
  ## Index of available rules
20
20
 
21
- Please check the recommended list (https://github.com/darraghoriordan/eslint-plugin-nestjs-typed/blob/main/src/configs/recommended.ts) to check which rules are turned on when using that config.
22
-
23
- Some rules are opinionated and have to be turned on explicitly (if they're not in the recommended config pack).
24
-
25
- | Category | Rule | is in recommended config |
26
- | ------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------ |
27
- | Nest Modules and Dependency Injection | [`provided-injected-should-match-factory-parameters`](./src/docs/rules/provided-injected-should-match-factory-parameters.md) | Y |
28
- | | [`injectable-should-be-provided`](./src/docs/rules/injectable-should-be-provided.md) | Y |
29
- | | | |
30
- | Nest Swagger | [`api-property-matches-property-optionality`](./src/docs/rules/api-property-matches-property-optionality.md) | Y |
31
- | | [`controllers-should-supply-api-tags`](./src/docs/rules/controllers-should-supply-api-tags.md) | Y |
32
- | | [`api-method-should-specify-api-response`](./src/docs/rules/api-method-should-specify-api-response.md) | N |
33
- | | [`api-method-should-specify-api-operation`](./src/docs/rules/api-method-should-specify-api-operation.md) | Y |
34
- | | [`api-enum-property-best-practices`](./src/docs/rules/api-enum-property-best-practices.md) | Y |
35
- | | [`api-property-returning-array-should-set-array`](./src/docs/rules/api-property-returning-array-should-set-array.md) | Y |
36
- | | | |
37
- | Preventing bugs | [`param-decorator-name-matches-route-param`](./src/docs/rules/param-decorator-name-matches-route-param.md) | Y |
38
- | | [`validate-nested-of-array-should-set-each`](./src/docs/rules/validate-nested-of-array-should-set-each.md) | Y |
39
- | | [`validated-non-primitive-property-needs-type-decorator`](./src/docs/rules/validated-non-primitive-property-needs-type-decorator.md) | Y |
40
- | | [`all-properties-are-whitelisted`](./src/docs/rules/all-properties-are-whitelisted.md) | Y |
41
- | | [`all-properties-have-explicit-defined`](./src/docs/rules/all-properties-have-explicit-defined.md) | Y |
42
- | | | |
43
- | Security | [`validation-pipe-should-forbid-unknown`](./src/docs/rules/validation-pipe-should-use-forbid-unknown.md) | Y |
44
- | | [`api-methods-should-be-guarded`](./src/docs/rules/api-methods-should-be-guarded.md) | N |
45
- | | | |
46
- | Code Consistency | [`sort-module-metadata-arrays`](./src/docs/rules/sort-module-metadata-arrays.md) | N |
47
-
48
- Detailed docs are available here: https://github.com/darraghoriordan/eslint-plugin-nestjs-typed/tree/main/src/docs/rules
21
+ | Category | Rule | is on in recommended ruleset? |
22
+ | ------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------- |
23
+ | Nest Modules and Dependency Injection | [`provided-injected-should-match-factory-parameters`](./src/docs/rules/provided-injected-should-match-factory-parameters.md) | Y |
24
+ | | [`injectable-should-be-provided`](./src/docs/rules/injectable-should-be-provided.md) | Y |
25
+ | | | |
26
+ | Nest Swagger | [`api-property-matches-property-optionality`](./src/docs/rules/api-property-matches-property-optionality.md) | Y |
27
+ | | [`controllers-should-supply-api-tags`](./src/docs/rules/controllers-should-supply-api-tags.md) | Y |
28
+ | | [`api-method-should-specify-api-response`](./src/docs/rules/api-method-should-specify-api-response.md) | N |
29
+ | | [`api-method-should-specify-api-operation`](./src/docs/rules/api-method-should-specify-api-operation.md) | Y |
30
+ | | [`api-enum-property-best-practices`](./src/docs/rules/api-enum-property-best-practices.md) | Y |
31
+ | | [`api-property-returning-array-should-set-array`](./src/docs/rules/api-property-returning-array-should-set-array.md) | Y |
32
+ | | | |
33
+ | Preventing bugs | [`param-decorator-name-matches-route-param`](./src/docs/rules/param-decorator-name-matches-route-param.md) | Y |
34
+ | | [`validate-nested-of-array-should-set-each`](./src/docs/rules/validate-nested-of-array-should-set-each.md) | Y |
35
+ | | [`validated-non-primitive-property-needs-type-decorator`](./src/docs/rules/validated-non-primitive-property-needs-type-decorator.md) | Y |
36
+ | | [`all-properties-are-whitelisted`](./src/docs/rules/all-properties-are-whitelisted.md) | Y |
37
+ | | [`all-properties-have-explicit-defined`](./src/docs/rules/all-properties-have-explicit-defined.md) | Y |
38
+ | | | |
39
+ | Security | [`validation-pipe-should-forbid-unknown`](./src/docs/rules/validation-pipe-should-use-forbid-unknown.md) | Y |
40
+ | | [`api-methods-should-be-guarded`](./src/docs/rules/api-methods-should-be-guarded.md) | N |
41
+ | | | |
42
+ | Code Consistency | [`sort-module-metadata-arrays`](./src/docs/rules/sort-module-metadata-arrays.md) | N |
43
+
44
+ The "recommended" ruleset are the default rules that are turned on when you configure the plugin as described in this document.
45
+
46
+ The name "recommended" is an eslint convention. Some rules in this plugin are opinionated and have to be turned on explicitly in your eslintrc file.
49
47
 
50
48
  ## Who is this package for?
51
49
 
@@ -53,7 +51,7 @@ If you use NestJs (https://nestjs.com/) these ESLint rules will help you to prev
53
51
 
54
52
  They mostly check that you are using decorators correctly.
55
53
 
56
- The three primary groupings of rules in this plugin are...
54
+ The primary groupings of rules in this plugin are...
57
55
 
58
56
  ### 1. Detect Nest Dependency Injection issues
59
57
 
@@ -83,12 +81,18 @@ https://github.com/typestack/class-validator/issues/438
83
81
 
84
82
  ## To install
85
83
 
84
+ The plugin is on npm here: https://www.npmjs.com/package/@darraghor/eslint-plugin-nestjs-typed
85
+ You can see how the rules are used in this NestJS project: https://github.com/darraghoriordan/use-miller
86
+
86
87
  ```
87
88
  npm install --save-dev @darraghor/eslint-plugin-nestjs-typed
88
89
 
89
90
  // or
90
91
 
91
92
  yarn add -D @darraghor/eslint-plugin-nestjs-typed
93
+ // or
94
+
95
+ pnpm add -D @darraghor/eslint-plugin-nestjs-typed
92
96
  ```
93
97
 
94
98
  If you don't already have `class-validator` you should install that
@@ -97,14 +101,17 @@ If you don't already have `class-validator` you should install that
97
101
  npm install class-validator
98
102
 
99
103
  // or
104
+
100
105
  yarn add class-validator
106
+
107
+ // or
108
+
109
+ pnpm add class-validator
101
110
  ```
102
111
 
103
112
  ## To configure
104
113
 
105
- You can see how the rules are used in this NestJS project: https://github.com/darraghoriordan/use-miller
106
-
107
- Then update your eslint with the plugin import and add the recommended rule set
114
+ Update your eslint with the plugin import and add the recommended rule set
108
115
 
109
116
  ```ts
110
117
  module.exports = {
@@ -122,7 +129,9 @@ module.exports = {
122
129
  };
123
130
  ```
124
131
 
125
- Note: the injectables test scans your whole project. It's best to filter out ts things that don't matter - use `filterFromPaths` configuration setting for this. There are some defaults already applied. See details below.
132
+ Note: the injectables test scans your whole project. It's best to filter out ts things that don't matter - use `filterFromPaths` configuration setting for this. See the rule documentation for more info.
133
+
134
+ There are some defaults already applied.
126
135
 
127
136
  Note: You can easily turn off all the swagger rules if you don't use swagger by adding the `no-swagger` rule set AFTER the recommended rule set.
128
137
 
@@ -131,7 +140,7 @@ Note: You can easily turn off all the swagger rules if you don't use swagger by
131
140
  extends: ["plugin:@darraghor/nestjs-typed/recommended",
132
141
  "plugin:@darraghor/nestjs-typed/no-swagger"
133
142
  ],
134
- // more config
143
+ // more config
135
144
  ```
136
145
 
137
146
  Disable a single rule with the full name e.g. in your eslint configuration...
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@darraghor/eslint-plugin-nestjs-typed",
3
- "version": "4.0.0",
3
+ "version": "4.0.2",
4
4
  "description": "Eslint rules for nestjs projects",
5
5
  "scripts": {
6
6
  "clean": "rm -Rf ./dist/",
@@ -43,22 +43,22 @@
43
43
  "main": "dist/index.js",
44
44
  "types": "index.d.ts",
45
45
  "dependencies": {
46
- "@typescript-eslint/scope-manager": "6.0.0",
47
- "@typescript-eslint/utils": "6.0.0",
46
+ "@typescript-eslint/scope-manager": "6.1.0",
47
+ "@typescript-eslint/utils": "6.1.0",
48
48
  "eslint-module-utils": "2.8.0",
49
49
  "reflect-metadata": "0.1.13"
50
50
  },
51
51
  "devDependencies": {
52
- "@typescript-eslint/rule-tester": "6.0.0",
53
- "@commitlint/cli": "17.6.6",
54
- "@commitlint/config-conventional": "17.6.6",
52
+ "@commitlint/cli": "17.6.7",
53
+ "@commitlint/config-conventional": "17.6.7",
55
54
  "@semantic-release/changelog": "6.0.3",
56
55
  "@semantic-release/exec": "6.0.3",
57
56
  "@types/eslint": "8.44.0",
58
57
  "@types/jest": "29.5.3",
59
58
  "@types/node": "20.4.2",
60
- "@typescript-eslint/eslint-plugin": "6.0.0",
61
- "@typescript-eslint/parser": "6.0.0",
59
+ "@typescript-eslint/eslint-plugin": "6.1.0",
60
+ "@typescript-eslint/parser": "6.1.0",
61
+ "@typescript-eslint/rule-tester": "6.1.0",
62
62
  "class-validator": "^0.14",
63
63
  "eslint": "8.45.0",
64
64
  "eslint-config-prettier": "8.8.0",
@@ -76,7 +76,7 @@
76
76
  "typescript": "5.1.6"
77
77
  },
78
78
  "peerDependencies": {
79
- "@typescript-eslint/parser": "^5.0.0",
79
+ "@typescript-eslint/parser": "^6.0.0",
80
80
  "class-validator": "*",
81
81
  "eslint": "^8.0.0"
82
82
  },