@petbee/eslint-config 2.0.14 → 3.0.0

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
@@ -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,40 +1,30 @@
1
1
  import jsLint from '@eslint/js'
2
- import tsLint from 'typescript-eslint'
3
2
 
4
3
  // Utils
5
- import { hasPackage, getFlat } from './lib/utils.js'
4
+ import { getFlat, hasPackage } from './lib/utils.js'
6
5
 
7
6
  // Importing all the rules from the rules directory
8
- import prettierConfig from './rules/prettier.js'
7
+ import bestPracticesConfig from './rules/best-practices.js'
9
8
  import errorsConfig from './rules/errors.js'
9
+ import importsConfig from './rules/imports.js'
10
+ import nestjsConfig from './rules/nestjs.js'
10
11
  import nodeConfig from './rules/node.js'
12
+ import prettierConfig from './rules/prettier.js'
11
13
  import styleConfig from './rules/style.js'
12
- import variablesConfig from './rules/variables.js'
13
- import bestPracticesConfig from './rules/best-practices.js'
14
- import importsConfig from './rules/imports.js'
15
- import typescriptConfig from './rules/typescript.js'
16
14
  import testsConfig from './rules/tests.js'
17
- import nestjsConfig from './rules/nestjs.js'
15
+ import typescriptConfig from './rules/typescript.js'
16
+ import variablesConfig from './rules/variables.js'
18
17
 
19
18
  const hasTypescript = hasPackage('typescript')
20
- const hasNestJs = hasPackage('@nestjs/core')
21
-
22
- const baseRecommended = [...tsLint.configs.recommended]
23
- const recommendedTypeChecked = [
24
- ...tsLint.configs.recommendedTypeChecked,
25
- ...tsLint.configs.strictTypeChecked,
26
- ...tsLint.configs.stylisticTypeChecked,
27
- ]
28
19
 
29
20
  const ignoreConfig = {
30
21
  ignores: ['coverage', 'dist', '**/dist/', 'node_modules', '**/node_modules'],
31
22
  }
32
23
 
33
- const eslintFlatConfig = tsLint.config(
24
+ const eslintFlatConfig = [
34
25
  ignoreConfig,
35
26
  ...(hasTypescript ? [] : [jsLint.configs.recommended]),
36
27
  ...getFlat(typescriptConfig),
37
- ...(hasTypescript ? (hasNestJs ? recommendedTypeChecked : baseRecommended) : []),
38
28
  ...getFlat(prettierConfig),
39
29
  ...getFlat(errorsConfig),
40
30
  ...getFlat(nodeConfig),
@@ -42,11 +32,11 @@ const eslintFlatConfig = tsLint.config(
42
32
  ...getFlat(variablesConfig),
43
33
  ...getFlat(bestPracticesConfig),
44
34
  ...getFlat(importsConfig),
45
- ...getFlat(testsConfig)
46
- )
35
+ ...getFlat(testsConfig),
36
+ ]
47
37
 
48
38
  const nestjsEslintFlatConfig = nestjsConfig.flat
49
39
 
50
- export { nestjsEslintFlatConfig, eslintFlatConfig }
40
+ export { eslintFlatConfig, nestjsEslintFlatConfig }
51
41
 
52
42
  export default eslintFlatConfig
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@petbee/eslint-config",
3
- "version": "2.0.14",
3
+ "version": "3.0.0",
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.4.14",
44
- "@typescript-eslint/eslint-plugin": "^8.32.1",
45
- "@typescript-eslint/parser": "^8.32.1",
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.5",
48
- "eslint-plugin-cypress": "^4.3.0",
49
- "eslint-plugin-import": "^2.31.0",
50
- "eslint-plugin-jest": "^28.11.0",
51
- "eslint-plugin-n": "^17.18.0",
52
- "eslint-plugin-prettier": "^5.4.0",
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.32.1"
54
+ "typescript-eslint": "^8.47.0"
55
55
  },
56
56
  "peerDependencies": {
57
- "eslint": "^9.27.0",
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.5.3",
74
+ "prettier": "3.6.2",
75
75
  "react": "19.1.0",
76
- "typescript": "5.8.3"
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": "7620d675794a985ac47570248038304617b45af0"
84
+ "gitHead": "e78d31f90c9546fa3b7e1959902bc6d703956349"
85
85
  }
@@ -5,11 +5,8 @@ const hasNestJs = hasPackage('@nestjs/core')
5
5
 
6
6
  const tsConfigOptions = [
7
7
  {
8
- files: ['*.ts', '*.tsx'],
9
- extends: [
10
- 'plugin:@typescript-eslint/eslint-recommended',
11
- hasNestJs ? 'plugin:@typescript-eslint/recommended' : 'plugin:@typescript-eslint/recommended-type-checked',
12
- ],
8
+ files: ['**/*.{ts,tsx}'],
9
+ extends: ['plugin:@typescript-eslint/eslint-recommended', 'plugin:@typescript-eslint/recommended'],
13
10
  plugins: ['@typescript-eslint'],
14
11
  parser: '@typescript-eslint/parser',
15
12
  parserOptions: {
@@ -145,22 +142,24 @@ const tsConfigOptions = [
145
142
  // ! ts only rules
146
143
  // Enforce explicit accessibility modifiers on class properties and methods
147
144
  // https://typescript-eslint.io/rules/explicit-member-accessibility/
148
- '@typescript-eslint/explicit-member-accessibility': [
149
- 'error',
150
- {
151
- accessibility: 'explicit',
152
- overrides: {
153
- accessors: 'explicit',
154
- constructors: 'no-public',
155
- methods: 'explicit',
156
- parameterProperties: 'explicit',
157
- },
158
- },
159
- ],
145
+ '@typescript-eslint/explicit-member-accessibility': hasNestJs
146
+ ? 'off'
147
+ : [
148
+ 'error',
149
+ {
150
+ accessibility: 'explicit',
151
+ overrides: {
152
+ accessors: 'explicit',
153
+ constructors: 'no-public',
154
+ methods: 'explicit',
155
+ parameterProperties: 'explicit',
156
+ },
157
+ },
158
+ ],
160
159
 
161
160
  // Don't allow "any" at all
162
161
  // https://typescript-eslint.io/rules/no-explicit-any
163
- '@typescript-eslint/no-explicit-any': 'error',
162
+ '@typescript-eslint/no-explicit-any': hasNestJs ? 'warn' : 'error',
164
163
 
165
164
  // Enforce explicit function return type
166
165
  // https://typescript-eslint.io/rules/explicit-function-return-type/
@@ -271,7 +270,7 @@ const tsConfigOptions = [
271
270
  },
272
271
  },
273
272
  {
274
- files: ['*.d.ts'],
273
+ files: ['**/*.d.ts', '**/*.d.tsx', '**/*.test.ts', '**/*.test.tsx'],
275
274
  rules: {
276
275
  'import/order': 'off',
277
276
  'import/no-duplicates': 'off',