@mikey-pro/eslint-config 8.0.15 → 8.0.17

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.js CHANGED
@@ -14,6 +14,7 @@ import importSortPlugin from 'eslint-plugin-simple-import-sort';
14
14
  import perfectionistPlugin from 'eslint-plugin-perfectionist';
15
15
  import noSecretsPlugin from 'eslint-plugin-no-secrets';
16
16
  import noOnlyTestsPlugin from 'eslint-plugin-no-only-tests';
17
+ import sonarjsPlugin from 'eslint-plugin-sonarjs';
17
18
 
18
19
  import { baseOverrides } from './overrides.js';
19
20
  import { baseRules } from './rules.js';
@@ -81,6 +82,7 @@ const config = [
81
82
  perfectionist: perfectionistPlugin,
82
83
  'no-secrets': noSecretsPlugin,
83
84
  'no-only-tests': noOnlyTestsPlugin,
85
+ sonarjs: sonarjsPlugin,
84
86
  },
85
87
  rules: {
86
88
  ...baseRules,
@@ -88,6 +90,7 @@ const config = [
88
90
  ...compatPlugin.configs.recommended.rules,
89
91
  ...cssModules.configs.recommended.rules,
90
92
  ...importPlugin.configs.recommended.rules,
93
+ ...sonarjsPlugin.configs.recommended.rules,
91
94
  'prettier/prettier': ['warn', {
92
95
  parser: 'babel',
93
96
  endOfLine: 'lf',
@@ -125,6 +128,15 @@ const config = [
125
128
  'import/no-cycle': 'warn',
126
129
  'import/no-useless-path-segments': 'warn',
127
130
  'import/no-anonymous-default-export': 'warn',
131
+
132
+ // SonarJS rules
133
+ 'sonarjs/cognitive-complexity': ['error', 15],
134
+ 'sonarjs/no-duplicate-string': ['error', 5],
135
+ 'sonarjs/no-redundant-boolean': 'error',
136
+ 'sonarjs/prefer-immediate-return': 'error',
137
+ 'sonarjs/no-small-switch': 'warn',
138
+ 'sonarjs/no-duplicated-branches': 'error',
139
+ 'sonarjs/max-switch-cases': ['warn', 10],
128
140
  },
129
141
  settings: {
130
142
  'json/json-with-comments-files': [],
package/overrides.js CHANGED
@@ -4,6 +4,7 @@ import typescriptParser from '@typescript-eslint/parser';
4
4
  import typeScriptPlugin from '@typescript-eslint/eslint-plugin';
5
5
  import importPlugin from 'eslint-plugin-import';
6
6
  import markdownPlugin from 'eslint-plugin-markdownlint';
7
+ import jestPlugin from 'eslint-plugin-jest';
7
8
 
8
9
  const currentDir = path.dirname(fileURLToPath(import.meta.url));
9
10
 
@@ -357,13 +358,17 @@ const json5 = {
357
358
  };
358
359
 
359
360
  const jestJs = {
360
- files: ['*.test.js'],
361
- plugins: ['jest'],
361
+ files: ['*.test.js', '**/__tests__/**/*.js'],
362
+ plugins: {
363
+ jest: jestPlugin,
364
+ },
362
365
  extends: ['plugin:jest/all'],
363
366
  env: {
364
367
  jest: true,
365
368
  },
366
369
  rules: {
370
+ 'jest/prefer-spy-on': 'warn',
371
+ 'jest/require-top-level-describe': 'error',
367
372
  'unicorn/no-array-callback-reference': 'off',
368
373
  'jest/unbound-method': 'off',
369
374
  'unicorn/prevent-abbreviations': [
@@ -376,14 +381,19 @@ const jestJs = {
376
381
  };
377
382
 
378
383
  const jestTs = {
379
- files: ['*.test.ts'],
384
+ files: ['*.test.ts', '**/__tests__/**/*.ts'],
380
385
  parser: '@typescript-eslint/parser',
381
- plugins: ['@typescript-eslint', 'jest'],
386
+ plugins: {
387
+ '@typescript-eslint': typeScriptPlugin,
388
+ jest: jestPlugin,
389
+ },
382
390
  extends: ['plugin:jest/all'],
383
391
  env: {
384
392
  jest: true,
385
393
  },
386
394
  rules: {
395
+ 'jest/prefer-spy-on': 'warn',
396
+ 'jest/require-top-level-describe': 'error',
387
397
  'unicorn/no-array-callback-reference': 'off',
388
398
  'jest/unbound-method': 'off',
389
399
  'unicorn/prevent-abbreviations': [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikey-pro/eslint-config",
3
- "version": "8.0.15",
3
+ "version": "8.0.17",
4
4
  "description": "Mikey Pro ESLint configuration",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
package/rules.js CHANGED
@@ -202,37 +202,21 @@ export const baseRules = {
202
202
 
203
203
  // Security
204
204
  'security/detect-non-literal-fs-filename': 'error',
205
- 'security/detect-unsafe-regex': ['error', {
206
- allowDollarMatchAll: false,
207
- maxLength: 50
208
- }],
205
+ 'security/detect-unsafe-regex': 'error',
209
206
  'security/detect-buffer-noassert': 'error',
210
207
  'security/detect-child-process': 'warn',
211
208
  'security/detect-disable-mustache-escape': 'error',
212
- 'security/detect-possible-timing-attacks': ['error', {
213
- threshold: 8,
214
- catchAliases: true
215
- }],
216
- 'security/detect-non-literal-regexp': ['error', {
217
- report: 'error',
218
- warnOnDynamicRegexp: true
219
- }],
209
+ 'security/detect-possible-timing-attacks': 'error',
210
+ 'security/detect-non-literal-regexp': 'error',
220
211
  'security/detect-non-literal-require': 'error',
221
212
 
222
- // Better testing
223
- 'jest/prefer-spy-on': 'warn',
224
- 'jest/require-top-level-describe': 'error',
225
-
226
- // Code Quality
227
- 'sonarjs/cognitive-complexity': ['error', 15],
228
- 'sonarjs/no-duplicate-string': ['error', 5],
229
- 'sonarjs/no-redundant-boolean': 'error',
230
- 'sonarjs/prefer-immediate-return': 'error',
213
+ 'no-duplicate-imports': 'error',
214
+ 'no-unreachable': 'error',
215
+ 'no-constant-condition': 'error',
216
+ 'complexity': ['error', { max: 15 }],
231
217
 
232
218
  // RegExp
233
219
  'regexp/no-missing-g-flag': 'error',
234
- 'regexp/no-useless-flag': 'error',
235
- 'regexp/prefer-quantifier': 'error',
236
220
 
237
221
  // Enhanced TypeScript
238
222
  'etc/no-commented-out-code': 'warn',
@@ -258,9 +242,6 @@ export const baseRules = {
258
242
 
259
243
  // Code Quality
260
244
  'write-good-comments/write-good-comments': 'warn',
261
- 'sonarjs/no-small-switch': 'warn',
262
- 'sonarjs/no-duplicated-branches': 'error',
263
- 'sonarjs/max-switch-cases': ['warn', 10],
264
245
 
265
246
  // Import Safety
266
247
  'import/no-cycle': ['error', {