@dg-scripts/eslint-config 5.18.0 → 5.20.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.
Files changed (3) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/index.js +80 -3
  3. package/package.json +5 -2
package/CHANGELOG.md CHANGED
@@ -3,6 +3,38 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [5.20.0](https://github.com/sabertazimi/bod/compare/v5.19.0...v5.20.0) (2024-04-02)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **eslint-config:** require description rule ([#1162](https://github.com/sabertazimi/bod/issues/1162)) ([58d35e8](https://github.com/sabertazimi/bod/commit/58d35e8211aefe0bde523fba7da57c1b377e65b5))
12
+
13
+
14
+ ### Features
15
+
16
+ * **eslint-config:** add security and promise plugins ([#1163](https://github.com/sabertazimi/bod/issues/1163)) ([c9d49cf](https://github.com/sabertazimi/bod/commit/c9d49cfaed1b41364e620b120d359a1d4727868b))
17
+
18
+
19
+
20
+
21
+
22
+ # [5.19.0](https://github.com/sabertazimi/bod/compare/v5.18.0...v5.19.0) (2024-04-01)
23
+
24
+
25
+ ### Bug Fixes
26
+
27
+ * **eslint-config:** allow uppercase title for top-level describe ([#1160](https://github.com/sabertazimi/bod/issues/1160)) ([3a08c25](https://github.com/sabertazimi/bod/commit/3a08c2516496b99431119f50b4dd0527fe31a6eb))
28
+
29
+
30
+ ### Features
31
+
32
+ * **eslint-config:** add testing-library support ([#1161](https://github.com/sabertazimi/bod/issues/1161)) ([861ee93](https://github.com/sabertazimi/bod/commit/861ee93b9e71ed46f93b9a3927f8444e8591a2c0))
33
+
34
+
35
+
36
+
37
+
6
38
  # [5.18.0](https://github.com/sabertazimi/bod/compare/v5.17.0...v5.18.0) (2024-04-01)
7
39
 
8
40
 
package/index.js CHANGED
@@ -1,8 +1,11 @@
1
1
  // @ts-check
2
2
  import path from 'node:path'
3
3
  import { fileURLToPath } from 'node:url'
4
- import antfu, { GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_TS, GLOB_TSX } from '@antfu/eslint-config'
4
+ import antfu, { GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_SRC, GLOB_TESTS, GLOB_TS, GLOB_TSX } from '@antfu/eslint-config'
5
5
  import { FlatCompat } from '@eslint/eslintrc'
6
+ import eslintPluginPromise from 'eslint-plugin-promise'
7
+ import eslintPluginSecurity from 'eslint-plugin-security'
8
+ import eslintPluginTestingLibrary from 'eslint-plugin-testing-library'
6
9
  import { isPackageExists } from 'local-pkg'
7
10
 
8
11
  const baseDirectory = path.dirname(fileURLToPath(import.meta.url))
@@ -22,7 +25,7 @@ const eslintConfigNext
22
25
  },
23
26
  ],
24
27
  })
25
- : {}
28
+ : []
26
29
 
27
30
  /** @type {import('@antfu/eslint-config').TypedFlatConfigItem} */
28
31
  const eslintConfigMarkdown = {
@@ -30,9 +33,76 @@ const eslintConfigMarkdown = {
30
33
  languageOptions: { parserOptions: { project: false, program: null } },
31
34
  }
32
35
 
36
+ /** @type {import('@antfu/eslint-config').TypedFlatConfigItem} */
37
+ const eslintConfigTestingLibrary = {
38
+ files: [...GLOB_TESTS],
39
+ plugins: {
40
+ 'testing-library': eslintPluginTestingLibrary,
41
+ },
42
+ rules: {
43
+ 'test/no-interpolation-in-snapshots': 'error',
44
+ 'test/no-mocks-import': 'error',
45
+ 'test/prefer-lowercase-title': [
46
+ 'error',
47
+ {
48
+ ignoreTopLevelDescribe: true,
49
+ },
50
+ ],
51
+ 'test/valid-describe-callback': 'error',
52
+ 'test/valid-expect': 'error',
53
+ 'test/valid-title': 'warn',
54
+ 'testing-library/await-async-events': [
55
+ 'error',
56
+ { eventModule: 'userEvent' },
57
+ ],
58
+ 'testing-library/await-async-queries': 'error',
59
+ 'testing-library/await-async-utils': 'error',
60
+ 'testing-library/no-await-sync-events': [
61
+ 'error',
62
+ { eventModules: ['fire-event'] },
63
+ ],
64
+ 'testing-library/no-await-sync-queries': 'error',
65
+ 'testing-library/no-container': 'error',
66
+ 'testing-library/no-debugging-utils': 'warn',
67
+ 'testing-library/no-dom-import': 'error',
68
+ 'testing-library/no-global-regexp-flag-in-query': 'error',
69
+ 'testing-library/no-node-access': 'error',
70
+ 'testing-library/no-promise-in-fire-event': 'error',
71
+ 'testing-library/no-render-in-lifecycle': 'error',
72
+ 'testing-library/no-unnecessary-act': 'error',
73
+ 'testing-library/no-wait-for-multiple-assertions': 'error',
74
+ 'testing-library/no-wait-for-side-effects': 'error',
75
+ 'testing-library/no-wait-for-snapshot': 'error',
76
+ 'testing-library/prefer-find-by': 'error',
77
+ 'testing-library/prefer-presence-queries': 'error',
78
+ 'testing-library/prefer-query-by-disappearance': 'error',
79
+ 'testing-library/prefer-screen-queries': 'error',
80
+ 'testing-library/render-result-naming-convention': 'error',
81
+ },
82
+ }
83
+
84
+ /** @type {import('@antfu/eslint-config').TypedFlatConfigItem} */
85
+ const eslintConfigSecurity = {
86
+ files: [GLOB_SRC],
87
+ ...eslintPluginSecurity.configs.recommended,
88
+ }
89
+
90
+ /** @type {import('@antfu/eslint-config').TypedFlatConfigItem} */
91
+ const eslintConfigPromise = {
92
+ files: [GLOB_SRC],
93
+ plugins: {
94
+ promise: eslintPluginPromise,
95
+ },
96
+ // @ts-expect-error -- Allow assign `string` (error/warn/off) to `RuleEntry`.
97
+ rules: {
98
+ ...eslintPluginPromise.configs.recommended.rules,
99
+ },
100
+ }
101
+
33
102
  /** @type {import('@antfu/eslint-config').TypedFlatConfigItem} */
34
103
  const eslintConfigRules = {
35
104
  rules: {
105
+ 'eslint-comments/require-description': 'error',
36
106
  'style/brace-style': ['error', '1tbs'],
37
107
  'ts/prefer-literal-enum-member': [
38
108
  'error',
@@ -44,7 +114,14 @@ const eslintConfigRules = {
44
114
  }
45
115
 
46
116
  /** @type {import('@antfu/eslint-config').TypedFlatConfigItem[]} */
47
- const eslintConfig = [eslintConfigNext, eslintConfigMarkdown, eslintConfigRules]
117
+ const eslintConfig = [
118
+ ...eslintConfigNext,
119
+ eslintConfigMarkdown,
120
+ eslintConfigTestingLibrary,
121
+ eslintConfigSecurity,
122
+ eslintConfigPromise,
123
+ eslintConfigRules,
124
+ ]
48
125
 
49
126
  /** @type {import('@antfu/eslint-config').OptionsConfig} */
50
127
  const eslintConfigAntfu = {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dg-scripts/eslint-config",
3
3
  "type": "module",
4
- "version": "5.18.0",
4
+ "version": "5.20.0",
5
5
  "description": "ESLint configuration used by dg-scripts.",
6
6
  "author": "sabertazimi <sabertazimi@gmail.com>",
7
7
  "license": "MIT",
@@ -52,10 +52,13 @@
52
52
  "@antfu/eslint-config": "^2.11.6",
53
53
  "@eslint/eslintrc": "^3.0.2",
54
54
  "eslint-plugin-format": "^0.1.0",
55
+ "eslint-plugin-promise": "^6.1.1",
55
56
  "eslint-plugin-react": "^7.34.1",
56
57
  "eslint-plugin-react-hooks": "^4.6.0",
57
58
  "eslint-plugin-react-refresh": "^0.4.6",
59
+ "eslint-plugin-security": "^2.1.1",
60
+ "eslint-plugin-testing-library": "^6.2.0",
58
61
  "local-pkg": "^0.5.0"
59
62
  },
60
- "gitHead": "3bf0c5de549ce2a77026cbc7a3748013a45d0492"
63
+ "gitHead": "9af8259eec1e14e0cfcf4f408f9599b9d245c394"
61
64
  }