@petbee/eslint-config 2.0.14 → 2.0.15

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/index.mjs CHANGED
@@ -1,5 +1,4 @@
1
1
  import jsLint from '@eslint/js'
2
- import tsLint from 'typescript-eslint'
3
2
 
4
3
  // Utils
5
4
  import { hasPackage, getFlat } from './lib/utils.js'
@@ -17,24 +16,15 @@ import testsConfig from './rules/tests.js'
17
16
  import nestjsConfig from './rules/nestjs.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,8 +32,8 @@ 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
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@petbee/eslint-config",
3
- "version": "2.0.14",
3
+ "version": "2.0.15",
4
4
  "description": "Petbee's eslint config",
5
5
  "keywords": [
6
6
  "eslint",
@@ -81,5 +81,5 @@
81
81
  "publishConfig": {
82
82
  "access": "public"
83
83
  },
84
- "gitHead": "7620d675794a985ac47570248038304617b45af0"
84
+ "gitHead": "aea4c68136ad0c4b91c3b13012057491fe8e611c"
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',