@petbee/eslint-config 2.0.15 → 3.0.1
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 +20 -11
- package/index.mjs +8 -8
- package/package.json +15 -15
- package/rules/typescript.js +1 -8
package/README.md
CHANGED
|
@@ -2,6 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
This package provides Petbee's ESLint configuration as an extensible shared config, supporting both ESLint v9.x (flat config) and older versions (.eslintrc).
|
|
4
4
|
|
|
5
|
+
## Features (v3.0.0)
|
|
6
|
+
|
|
7
|
+
- ✅ **ESLint 9.39+** - Latest ESLint with flat config
|
|
8
|
+
- ✅ **TypeScript 5.9+** - Modern TypeScript support
|
|
9
|
+
- ✅ **typescript-eslint 8.47+** - Latest type-aware linting
|
|
10
|
+
- ✅ **Auto NestJS detection** - Automatically configures for NestJS projects
|
|
11
|
+
- ✅ **Jest 29 support** - Updated test linting rules
|
|
12
|
+
- ✅ **Cypress 5 support** - Modern E2E test linting
|
|
13
|
+
- ✅ **Prettier integration** - Conflicts automatically resolved
|
|
14
|
+
|
|
5
15
|
## Installation
|
|
6
16
|
|
|
7
17
|
Give that you already have ESLint installed, run:
|
|
@@ -17,7 +27,7 @@ yarn add -D @petbee/eslint-config typescript prettier
|
|
|
17
27
|
```jsonc
|
|
18
28
|
// .eslintrc
|
|
19
29
|
{
|
|
20
|
-
"extends": ["@petbee/eslint-config"]
|
|
30
|
+
"extends": ["@petbee/eslint-config"],
|
|
21
31
|
}
|
|
22
32
|
```
|
|
23
33
|
|
|
@@ -52,7 +62,7 @@ And maintain a .eslintrc file:
|
|
|
52
62
|
```jsonc
|
|
53
63
|
// .eslintrc
|
|
54
64
|
{
|
|
55
|
-
"extends": ["@petbee/eslint-config"]
|
|
65
|
+
"extends": ["@petbee/eslint-config"],
|
|
56
66
|
}
|
|
57
67
|
```
|
|
58
68
|
|
|
@@ -67,7 +77,7 @@ The preset will automatically load Typescript rules when dealing with `.ts` or `
|
|
|
67
77
|
{
|
|
68
78
|
"extends": "./tsconfig.json",
|
|
69
79
|
"include": ["**/*.ts", "**/*.tsx", "**/*.js"],
|
|
70
|
-
"exclude": []
|
|
80
|
+
"exclude": [],
|
|
71
81
|
}
|
|
72
82
|
```
|
|
73
83
|
|
|
@@ -78,12 +88,11 @@ And you should be good to go.
|
|
|
78
88
|
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
89
|
|
|
80
90
|
```jsonc
|
|
81
|
-
|
|
82
91
|
// tsconfig.eslint.json
|
|
83
92
|
{
|
|
84
93
|
"extends": "./tsconfig.json",
|
|
85
94
|
"include": ["**/*.ts", "**/*.tsx", "**/*.js"],
|
|
86
|
-
"exclude": []
|
|
95
|
+
"exclude": [],
|
|
87
96
|
}
|
|
88
97
|
```
|
|
89
98
|
|
|
@@ -103,8 +112,8 @@ yarn add -D babel-eslint
|
|
|
103
112
|
"extends": "@petbee/eslint-config",
|
|
104
113
|
"parser": "babel-eslint",
|
|
105
114
|
"parserOptions": {
|
|
106
|
-
"sourceType": "module"
|
|
107
|
-
}
|
|
115
|
+
"sourceType": "module",
|
|
116
|
+
},
|
|
108
117
|
}
|
|
109
118
|
```
|
|
110
119
|
|
|
@@ -119,10 +128,10 @@ If a project uses both Typescript and Javascript, you can configure the parser i
|
|
|
119
128
|
"files": ["*.js", "*.jsx"],
|
|
120
129
|
"parser": "babel-eslint",
|
|
121
130
|
"parserOptions": {
|
|
122
|
-
"sourceType": "module"
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
]
|
|
131
|
+
"sourceType": "module",
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
],
|
|
126
135
|
}
|
|
127
136
|
```
|
|
128
137
|
|
package/index.mjs
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import jsLint from '@eslint/js'
|
|
2
2
|
|
|
3
3
|
// Utils
|
|
4
|
-
import {
|
|
4
|
+
import { getFlat, hasPackage } from './lib/utils.js'
|
|
5
5
|
|
|
6
6
|
// Importing all the rules from the rules directory
|
|
7
|
-
import
|
|
7
|
+
import bestPracticesConfig from './rules/best-practices.js'
|
|
8
8
|
import errorsConfig from './rules/errors.js'
|
|
9
|
+
import importsConfig from './rules/imports.js'
|
|
10
|
+
import nestjsConfig from './rules/nestjs.js'
|
|
9
11
|
import nodeConfig from './rules/node.js'
|
|
12
|
+
import prettierConfig from './rules/prettier.js'
|
|
10
13
|
import styleConfig from './rules/style.js'
|
|
11
|
-
import variablesConfig from './rules/variables.js'
|
|
12
|
-
import bestPracticesConfig from './rules/best-practices.js'
|
|
13
|
-
import importsConfig from './rules/imports.js'
|
|
14
|
-
import typescriptConfig from './rules/typescript.js'
|
|
15
14
|
import testsConfig from './rules/tests.js'
|
|
16
|
-
import
|
|
15
|
+
import typescriptConfig from './rules/typescript.js'
|
|
16
|
+
import variablesConfig from './rules/variables.js'
|
|
17
17
|
|
|
18
18
|
const hasTypescript = hasPackage('typescript')
|
|
19
19
|
|
|
@@ -37,6 +37,6 @@ const eslintFlatConfig = [
|
|
|
37
37
|
|
|
38
38
|
const nestjsEslintFlatConfig = nestjsConfig.flat
|
|
39
39
|
|
|
40
|
-
export {
|
|
40
|
+
export { eslintFlatConfig, nestjsEslintFlatConfig }
|
|
41
41
|
|
|
42
42
|
export default eslintFlatConfig
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@petbee/eslint-config",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.1",
|
|
4
4
|
"description": "Petbee's eslint config",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -40,21 +40,21 @@
|
|
|
40
40
|
"url": "https://github.com/petbee/typescript/issues"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@darraghor/eslint-plugin-nestjs-typed": "^6.
|
|
44
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
45
|
-
"@typescript-eslint/parser": "^8.
|
|
43
|
+
"@darraghor/eslint-plugin-nestjs-typed": "^6.9.12",
|
|
44
|
+
"@typescript-eslint/eslint-plugin": "^8.47.0",
|
|
45
|
+
"@typescript-eslint/parser": "^8.47.0",
|
|
46
46
|
"confusing-browser-globals": "^1.0.11",
|
|
47
|
-
"eslint-config-prettier": "^10.1.
|
|
48
|
-
"eslint-plugin-cypress": "^
|
|
49
|
-
"eslint-plugin-import": "^2.
|
|
50
|
-
"eslint-plugin-jest": "^
|
|
51
|
-
"eslint-plugin-n": "^17.
|
|
52
|
-
"eslint-plugin-prettier": "^5.4
|
|
47
|
+
"eslint-config-prettier": "^10.1.8",
|
|
48
|
+
"eslint-plugin-cypress": "^5.2.0",
|
|
49
|
+
"eslint-plugin-import": "^2.32.0",
|
|
50
|
+
"eslint-plugin-jest": "^29.2.1",
|
|
51
|
+
"eslint-plugin-n": "^17.23.1",
|
|
52
|
+
"eslint-plugin-prettier": "^5.5.4",
|
|
53
53
|
"eslint-plugin-react": "7.37.5",
|
|
54
|
-
"typescript-eslint": "^8.
|
|
54
|
+
"typescript-eslint": "^8.47.0"
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
57
|
-
"eslint": "^9.
|
|
57
|
+
"eslint": "^9.39.1",
|
|
58
58
|
"prettier": ">=3.0.0",
|
|
59
59
|
"typescript": "^4.0.0 || ^5.0.0"
|
|
60
60
|
},
|
|
@@ -71,9 +71,9 @@
|
|
|
71
71
|
},
|
|
72
72
|
"devDependencies": {
|
|
73
73
|
"@types/react": "19.1.5",
|
|
74
|
-
"prettier": "3.
|
|
74
|
+
"prettier": "3.6.2",
|
|
75
75
|
"react": "19.1.0",
|
|
76
|
-
"typescript": "5.
|
|
76
|
+
"typescript": "5.9.3"
|
|
77
77
|
},
|
|
78
78
|
"engines": {
|
|
79
79
|
"node": ">=18.0.0"
|
|
@@ -81,5 +81,5 @@
|
|
|
81
81
|
"publishConfig": {
|
|
82
82
|
"access": "public"
|
|
83
83
|
},
|
|
84
|
-
"gitHead": "
|
|
84
|
+
"gitHead": "1b88a796860c98f200563762903c20cbe0f78aeb"
|
|
85
85
|
}
|
package/rules/typescript.js
CHANGED
|
@@ -12,15 +12,8 @@ const tsConfigOptions = [
|
|
|
12
12
|
parserOptions: {
|
|
13
13
|
ecmaVersion: 2022,
|
|
14
14
|
sourceType: 'module',
|
|
15
|
-
project: [
|
|
16
|
-
// look in the root
|
|
17
|
-
'tsconfig{.eslint.json,.json}',
|
|
18
|
-
// look in dirs like node/react
|
|
19
|
-
'*/tsconfig{.eslint.json,.json}',
|
|
20
|
-
// look in dirs like packages/package/*
|
|
21
|
-
'*/*/tsconfig{.eslint.json,.json}',
|
|
22
|
-
],
|
|
23
15
|
projectService: true,
|
|
16
|
+
defaultProject: 'tsconfig.json',
|
|
24
17
|
tsconfigRootDir: process.cwd(),
|
|
25
18
|
projectFolderIgnoreList: [/node_modules/i],
|
|
26
19
|
// We need this configuration to avoid performance issues in monorepos
|