@petbee/eslint-config 2.0.10 → 2.0.11

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.
package/README.md CHANGED
@@ -73,6 +73,22 @@ The preset will automatically load Typescript rules when dealing with `.ts` or `
73
73
 
74
74
  And you should be good to go.
75
75
 
76
+ ### For NestJS
77
+
78
+ The preset will automatically load NestJS rules when your projects has `@nestjs/core` installed. However, if you are using NestJS with Typescript, you need to make sure that the `tsconfig.json` file is present at the root of your project. If you are using a custom `tsconfig.json`, you can create a separate `tsconfig.eslint.json` file as follows:
79
+
80
+ ```jsonc
81
+
82
+ // tsconfig.eslint.json
83
+ {
84
+ "extends": "./tsconfig.json",
85
+ "include": ["**/*.ts", "**/*.tsx", "**/*.js"],
86
+ "exclude": []
87
+ }
88
+ ```
89
+
90
+ This will ensure that the ESLint parser can find all the files that need to be linted.
91
+
76
92
  ### For Javascript
77
93
 
78
94
  Sometimes you want to use modern, not yet officially supported, syntax in your Javascript files, such as dynamic `import()`. This can be achieved by using the [`babel-eslint` parser](https://github.com/babel/babel-eslint). For size reasons, we don't include it in this preset but it's extremely simple to configure it:
@@ -114,6 +130,7 @@ Please check the [`babel-eslint` documentation](https://github.com/babel/babel-e
114
130
 
115
131
  ## References
116
132
 
133
+ - [`@darraghor/eslint-plugin-nestjs-typed` documentation](https://github.com/darraghoriordan/eslint-plugin-nestjs-typed)
117
134
  - [`@typescript-eslint` documentation](https://typescript-eslint.io/docs/)
118
135
  - [`eslint-plugin-import` documentation](https://github.com/benmosher/eslint-plugin-import)
119
136
  - [`eslint-plugin-prettier` documentation](https://github.com/prettier/eslint-plugin-prettier)
package/index.mjs CHANGED
@@ -1,5 +1,7 @@
1
- import js from '@eslint/js'
1
+ import jsLint from '@eslint/js'
2
+ import tsLint from 'typescript-eslint'
2
3
 
4
+ // Importing all the rules from the rules directory
3
5
  import prettierConfig from './rules/prettier.js'
4
6
  import errorsConfig from './rules/errors.js'
5
7
  import nodeConfig from './rules/node.js'
@@ -9,9 +11,10 @@ import bestPracticesConfig from './rules/best-practices.js'
9
11
  import importsConfig from './rules/imports.js'
10
12
  import typescriptConfig from './rules/typescript.js'
11
13
  import testsConfig from './rules/tests.js'
14
+ import nestjsConfig from './rules/nestjs.js'
12
15
 
13
16
  const ignoreConfig = {
14
- ignores: ['node_modules/', 'coverage/', 'dist/'],
17
+ ignores: ['coverage', 'dist', '**/dist/', 'node_modules', '**/node_modules'],
15
18
  }
16
19
 
17
20
  // Helper to get the flat config if available, otherwise fallback
@@ -21,7 +24,8 @@ const getFlat = (config) => {
21
24
 
22
25
  export default [
23
26
  ignoreConfig,
24
- js.configs.recommended,
27
+ jsLint.configs.recommended,
28
+ ...tsLint.configs.recommended,
25
29
  ...getFlat(prettierConfig),
26
30
  ...getFlat(errorsConfig),
27
31
  ...getFlat(nodeConfig),
@@ -31,4 +35,5 @@ export default [
31
35
  ...getFlat(importsConfig),
32
36
  ...getFlat(typescriptConfig),
33
37
  ...getFlat(testsConfig),
38
+ ...getFlat(nestjsConfig),
34
39
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@petbee/eslint-config",
3
- "version": "2.0.10",
3
+ "version": "2.0.11",
4
4
  "description": "Petbee's eslint config",
5
5
  "keywords": [
6
6
  "eslint",
@@ -40,6 +40,7 @@
40
40
  "url": "https://github.com/petbee/typescript/issues"
41
41
  },
42
42
  "dependencies": {
43
+ "@darraghor/eslint-plugin-nestjs-typed": "^6.4.14",
43
44
  "@typescript-eslint/eslint-plugin": "^8.32.1",
44
45
  "@typescript-eslint/parser": "^8.32.1",
45
46
  "confusing-browser-globals": "^1.0.11",
@@ -49,7 +50,8 @@
49
50
  "eslint-plugin-jest": "^28.11.0",
50
51
  "eslint-plugin-n": "^17.18.0",
51
52
  "eslint-plugin-prettier": "^5.4.0",
52
- "eslint-plugin-react": "7.37.5"
53
+ "eslint-plugin-react": "7.37.5",
54
+ "typescript-eslint": "^8.32.1"
53
55
  },
54
56
  "peerDependencies": {
55
57
  "eslint": "^9.27.0",
@@ -79,5 +81,5 @@
79
81
  "publishConfig": {
80
82
  "access": "public"
81
83
  },
82
- "gitHead": "27a9175dc2b2b2dd41df7f7fea527161f2323b81"
84
+ "gitHead": "425da51a2562cd81138644e870d5003b2a571cc5"
83
85
  }
@@ -0,0 +1,9 @@
1
+ const { hasPackage } = require('../lib/utils')
2
+ const nestjsLint = require('@darraghor/eslint-plugin-nestjs-typed')
3
+
4
+ const hasNestJs = hasPackage('@nestjs/core')
5
+
6
+ module.exports = hasNestJs ? nestjsLint.classicPlugin : {}
7
+
8
+ // Flat config for ESLint v9 (no extends, plugins as object)
9
+ module.exports.flat = hasNestJs ? nestjsLint.default.configs.flatRecommended : []