@prowise/eslint-config-linting-rules 2.4.6 → 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.
@@ -1,5 +1,4 @@
1
1
  import vitestPlugin from "@vitest/eslint-plugin";
2
- import { commonRules } from "./test-rules.js";
3
2
 
4
3
  export default {
5
4
  plugins: { vitest: vitestPlugin },
@@ -25,8 +24,6 @@ export default {
25
24
  },
26
25
 
27
26
  rules: {
28
- ...commonRules("vitest"),
29
-
30
27
  /**
31
28
  * Forbidden test file pattern: default only "test" accepted
32
29
  * https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/consistent-test-filename.md
@@ -34,40 +31,231 @@ export default {
34
31
  "vitest/consistent-test-filename": ["warn", { pattern: ".*\\.test\\.[tj]sx?$" }],
35
32
 
36
33
  /**
37
- * Do not use conditionals to run tests
38
- * https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-conditional-tests.md
34
+ * Enforce the usage of "it" and "test" 🔧
35
+ * https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/consistent-test-it.md
39
36
  */
40
- // "vitest/no-conditional-tests": "off",
37
+ "vitest/consistent-test-it": ["warn", { fn: "test", withinDescribe: "it" }],
41
38
 
42
39
  /**
43
- * Disallow importing node:test ✅ 🔧
44
- * https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-import-node-test.md
40
+ * Enforce to use an expectation in the test body. ✅
41
+ * https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/expect-expect.md
45
42
  */
46
- "vitest/no-import-node-test": "error",
43
+ "vitest/expect-expect": "error",
44
+
45
+ /**
46
+ * Enforces a maximum depth to nested describe calls
47
+ * https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/max-nested-describe.md
48
+ */
49
+ "vitest/max-nested-describe": ["warn", { max: 5 }],
50
+
51
+ /**
52
+ * Disallow alias methods ✅ 🔧
53
+ * https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-alias-methods.md
54
+ */
55
+ "vitest/no-alias-methods": "error",
56
+
57
+ /**
58
+ * Disallow commented out tests ✅
59
+ * https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-commented-out-tests.md
60
+ */
61
+ "vitest/no-commented-out-tests": "error",
62
+
63
+ /**
64
+ * Disallow expects in a conditional block ✅
65
+ * https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-conditional-expect.md
66
+ */
67
+ "vitest/no-conditional-expect": "error",
68
+
69
+ /**
70
+ * Disallow disabled tests ✅
71
+ * https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-disabled-tests.md
72
+ */
73
+ "vitest/no-disabled-tests": "warn",
74
+
75
+ /**
76
+ * Disallow duplicate setup and teardown hooks
77
+ * https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-duplicate-hooks.md
78
+ */
79
+ "vitest/no-duplicate-hooks": "error",
80
+
81
+ /**
82
+ * Disallow focused tests
83
+ * https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-focused-tests.md
84
+ */
85
+ "vitest/no-focused-tests": "error",
86
+
87
+ /**
88
+ * Disallow identical titles ✅
89
+ * https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-identical-title.md
90
+ */
91
+ "vitest/no-identical-title": "error",
92
+
93
+ /**
94
+ * Disallow string interpolation inside snapshots ✅
95
+ * https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-interpolation-in-snapshots.md
96
+ */
97
+ "vitest/no-interpolation-in-snapshots": "warn",
98
+
99
+ /**
100
+ * Disallow large snapshots
101
+ * https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-large-snapshots.md
102
+ */
103
+ "vitest/no-large-snapshots": ["error", { maxSize: 30, inlineMaxSize: 10 }],
104
+
105
+ /**
106
+ * Disallow manually importing from __mocks__ ✅
107
+ * https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-mocks-import.md
108
+ */
109
+ "vitest/no-mocks-import": "error",
110
+
111
+ /**
112
+ * Disallow using expect outside of it or test blocks ✅
113
+ * https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-standalone-expect.md
114
+ */
115
+ "vitest/no-standalone-expect": "error",
116
+
117
+ /**
118
+ * Disallow using any prefixed to skip tests ✅ 🔧
119
+ * https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-test-prefixes.md
120
+ */
121
+ "vitest/no-test-prefixes": "error",
122
+
123
+ /**
124
+ * Disallow explicitly returning from tests
125
+ * https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-test-return-statement.md
126
+ */
127
+ "vitest/no-test-return-statement": "error",
128
+
129
+ /**
130
+ * Enforce using `toBeCalledTimes(1)` or `toHaveBeenCalledTimes(1)`
131
+ * https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-called-times.md
132
+ */
133
+ "vitest/prefer-called-times": "warn",
134
+
135
+ /**
136
+ * Suggest using toBeCalledWith() or toHaveBeenCalledWith()
137
+ * https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-called-with.md
138
+ */
139
+ "vitest/prefer-called-with": "warn",
47
140
 
48
141
  /**
49
- * Disallow specific vi. methods
50
- * https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-restricted-vi-methods.md
142
+ * Suggest using the built-in comparison matchers
143
+ * https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-comparison-matcher.md
51
144
  */
52
- // "vitest/no-restricted-vi-methods": "off",
145
+ "vitest/prefer-comparison-matcher": "warn",
53
146
 
54
147
  /**
55
- * Suggest using toBeFalsy() 🔧
56
- * https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-to-be-falsy.md
148
+ * Suggest using the built-in equality matchers
149
+ * https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-equality-matcher.md
57
150
  */
58
- // "vitest/prefer-to-be-falsy)": "off",
151
+ "vitest/prefer-equality-matcher": "warn",
59
152
 
60
153
  /**
61
- * Prefer toBeObject() 🔧
62
- * https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-to-be-object.md
154
+ * Suggest using expect().resolves over expect(await ...) syntax 🔧
155
+ * https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-expect-resolves.md
63
156
  */
64
- // "vitest/prefer-to-be-object": "off",
157
+ "vitest/prefer-expect-resolves": "warn",
65
158
 
66
159
  /**
67
- * Suggest using toBeTruthy 🔧
68
- * https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-to-be-truthy.md
160
+ * Enforce using `each` rather than manual loops
161
+ * https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-each.md
69
162
  */
70
- // "vitest/prefer-to-be-truthy": "off",
163
+ "vitest/prefer-each": "error",
164
+
165
+ /**
166
+ * Prefer having hooks in consistent order
167
+ * https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-hooks-in-order.md
168
+ */
169
+ "vitest/prefer-hooks-in-order": "warn",
170
+
171
+ /**
172
+ * Suggest having hooks before any test cases
173
+ * https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-hooks-on-top.md
174
+ */
175
+ "vitest/prefer-hooks-on-top": "warn",
176
+
177
+ /**
178
+ * Enforce lowercase test names
179
+ */
180
+ "vitest/prefer-lowercase-title": ["warn", { ignore: ["describe", "test"] }],
181
+
182
+ /**
183
+ * Prefer mock resolved/rejected shorthands for promises 🔧
184
+ * https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-mock-promise-shorthand.md
185
+ */
186
+ "vitest/prefer-mock-promise-shorthand": "warn",
187
+
188
+ /**
189
+ * Suggest using .spyOn()
190
+ * https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-spy-on.md
191
+ */
192
+ "vitest/prefer-spy-on": "warn",
193
+
194
+ /**
195
+ * Enforce using `toBe(true)` and `toBe(false)` over matchers that coerce types to boolean
196
+ * https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-strict-boolean-matchers.md
197
+ */
198
+ "vitest/prefer-strict-boolean-matchers": "warn",
199
+
200
+ /**
201
+ * Suggest using toBe() for primitive literals 🔧
202
+ * https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-to-be.md
203
+ */
204
+ "vitest/prefer-to-be": "warn",
205
+
206
+ /**
207
+ * Suggest using toContain() 🔧
208
+ * https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-to-contain.md
209
+ */
210
+ "vitest/prefer-to-contain": "warn",
211
+
212
+ /**
213
+ * Suggest using toHaveLength() 🔧
214
+ * https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-to-have-length.md
215
+ */
216
+ "vitest/prefer-to-have-length": "warn",
217
+
218
+ /**
219
+ * Suggest using test.todo 🔧
220
+ * https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-todo.md
221
+ */
222
+ "vitest/prefer-todo": "warn",
223
+
224
+ /**
225
+ * Require a message for toThrow()
226
+ * https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/require-hook.md
227
+ */
228
+ "vitest/require-to-throw-message": "warn",
229
+
230
+ /**
231
+ * Enforce valid describe() ✅
232
+ * https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/valid-describe-callback.md
233
+ */
234
+ "vitest/valid-describe-callback": "error",
235
+
236
+ /**
237
+ * Require promises that have expectations in their chain to be valid ✅
238
+ * https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/valid-expect-in-promise.md
239
+ */
240
+ "vitest/valid-expect-in-promise": "error",
241
+
242
+ /**
243
+ * Enforce valid expect() usage ✅
244
+ * https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/valid-expect.md
245
+ */
246
+ "vitest/valid-expect": ["error", { alwaysAwait: true, asyncMatchers: ["toBeResolved", "toBeRejected"] }],
247
+
248
+ /**
249
+ * Enforce valid titles ✅ 🔧
250
+ * https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/valid-title.md
251
+ */
252
+ "vitest/valid-title": "error",
253
+
254
+ /**
255
+ * Disallow importing node:test ✅ 🔧
256
+ * https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-import-node-test.md
257
+ */
258
+ "vitest/no-import-node-test": "error",
71
259
 
72
260
  /**
73
261
  * Require local Test Context for concurrent snapshot tests ✅
package/eslint.back.js DELETED
@@ -1,9 +0,0 @@
1
- import base from "./base.js";
2
- import node from "./rules/plugin-node-rules.js";
3
-
4
- export default [base, node, {
5
- rules: {
6
- "import/no-named-as-default-member": "off",
7
- "import/no-named-as-default": "off",
8
- },
9
- }];
@@ -1,136 +0,0 @@
1
- import solidPlugin from "eslint-plugin-solid";
2
-
3
- export default {
4
- /*
5
- * ✅ recommended
6
- * 🔧 fixable
7
- * 💡 has suggestion
8
- */
9
-
10
- plugins: {
11
- solid: solidPlugin,
12
- },
13
-
14
- rules: {
15
- /**
16
- * Disallow early returns in components. ✅ 🔧
17
- * Solid components only run once, and so conditionals should be inside JSX.
18
- * https://github.com/solidjs-community/eslint-plugin-solid/blob/main/packages/eslint-plugin-solid/docs/components-return-once.md
19
- */
20
- "solid/components-return-once": "warn",
21
-
22
- /**
23
- * Enforce naming DOM element event handlers consistently and prevent ✅ 🔧
24
- * Solid's analysis from misunderstanding whether a prop should be an event handler.
25
- * https://github.com/solidjs-community/eslint-plugin-solid/blob/main/packages/eslint-plugin-solid/docs/event-handlers.md
26
- */
27
- "solid/event-handlers": "warn",
28
-
29
- /**
30
- * Enforce consistent imports from "solid-js", "solid-js/web", and "solid-js/store". ✅ 🔧
31
- * https://github.com/solidjs-community/eslint-plugin-solid/blob/main/packages/eslint-plugin-solid/docs/imports.md
32
- */
33
- "solid/imports": "warn",
34
-
35
- /**
36
- * Disallow passing the same prop twice in JSX. ✅
37
- * https://github.com/solidjs-community/eslint-plugin-solid/blob/main/packages/eslint-plugin-solid/docs/jsx-no-duplicate-props.md
38
- */
39
- "solid/jsx-no-duplicate-props": "error",
40
-
41
- /**
42
- * Disallow javascript: URLs. ✅
43
- * https://github.com/solidjs-community/eslint-plugin-solid/blob/main/packages/eslint-plugin-solid/docs/jsx-no-script-url.md
44
- */
45
- "solid/jsx-no-script-url": "error",
46
-
47
- /**
48
- * Disallow references to undefined variables in JSX. Handles custom directives. ✅ 🔧
49
- * https://github.com/solidjs-community/eslint-plugin-solid/blob/main/packages/eslint-plugin-solid/docs/jsx-no-undef.md
50
- */
51
- "solid/jsx-no-undef": "error",
52
-
53
- /**
54
- * Prevent variables used in JSX from being marked as unused. ✅
55
- * https://github.com/solidjs-community/eslint-plugin-solid/blob/main/packages/eslint-plugin-solid/docs/jsx-uses-vars.md
56
- */
57
- "solid/jsx-uses-vars": "error",
58
-
59
- /**
60
- * Disallow usage of type-unsafe event handlers.
61
- * https://github.com/solidjs-community/eslint-plugin-solid/blob/main/packages/eslint-plugin-solid/docs/no-array-handlers.md
62
- */
63
- // "solid/no-array-handlers": "off",
64
-
65
- /**
66
- * Disallow destructuring props. ✅ 🔧
67
- * In Solid, props must be used with property accesses (props.foo) to preserve reactivity.
68
- * This rule only tracks destructuring in the parameter list.
69
- * https://github.com/solidjs-community/eslint-plugin-solid/blob/main/packages/eslint-plugin-solid/docs/no-destructure.md
70
- */
71
- "solid/no-destructure": "error",
72
-
73
- /**
74
- * Disallow usage of the innerHTML attribute, which can often lead to security vulnerabilities. ✅ 🔧
75
- * https://github.com/solidjs-community/eslint-plugin-solid/blob/main/packages/eslint-plugin-solid/docs/no-innerhtml.md
76
- */
77
- "solid/no-innerhtml": "error",
78
-
79
- /**
80
- * Disallow usage of APIs that use ES6 Proxies, only to target environments that don't support them.
81
- * https://github.com/solidjs-community/eslint-plugin-solid/blob/main/packages/eslint-plugin-solid/docs/no-proxy-apis.md
82
- */
83
- // "solid/no-proxy-apis": "off",
84
-
85
- /**
86
- * Disallow usage of dependency arrays in createEffect and createMemo. ✅ 🔧
87
- * https://github.com/solidjs-community/eslint-plugin-solid/blob/main/packages/eslint-plugin-solid/docs/no-react-deps.md
88
- */
89
- "solid/no-react-deps": "warn",
90
-
91
- /**
92
- * Disallow usage of React-specific className/htmlFor props, which were deprecated in v1.4.0. ✅ 🔧
93
- * https://github.com/solidjs-community/eslint-plugin-solid/blob/main/packages/eslint-plugin-solid/docs/no-react-specific-props.md
94
- */
95
- "solid/no-react-specific-props": "warn",
96
-
97
- /**
98
- * Enforce using only Solid-specific namespaced attribute names (i.e. 'on:' in <div on:click={...} />). ✅
99
- * https://github.com/solidjs-community/eslint-plugin-solid/blob/main/packages/eslint-plugin-solid/docs/no-unknown-namespaces.md
100
- */
101
- "solid/no-unknown-namespaces": "error",
102
-
103
- /**
104
- * Enforce using Solid's <For /> component for mapping an array to JSX elements. ✅ 🔧
105
- * https://github.com/solidjs-community/eslint-plugin-solid/blob/main/packages/eslint-plugin-solid/docs/prefer-for.md
106
- */
107
- "solid/prefer-for": "error",
108
-
109
- /**
110
- * Enforce using Solid's <Show /> component for conditionally showing content. 🔧
111
- * Solid's compiler covers this case, so it's a stylistic rule only.
112
- * https://github.com/solidjs-community/eslint-plugin-solid/blob/main/packages/eslint-plugin-solid/docs/prefer-show.md
113
- */
114
- // "solid/prefer-show": "off",
115
-
116
- /**
117
- * Enforce that reactivity (props, signals, memos, etc.) is properly used, ✅
118
- * so changes in those values will be tracked and update the view as expected.
119
- * https://github.com/solidjs-community/eslint-plugin-solid/blob/main/packages/eslint-plugin-solid/docs/reactivity.md
120
- */
121
- "solid/reactivity": "warn",
122
-
123
- /**
124
- * Disallow extra closing tags for components without children. ✅ 🔧
125
- * https://github.com/solidjs-community/eslint-plugin-solid/blob/main/packages/eslint-plugin-solid/docs/self-closing-comp.md
126
- */
127
- "solid/self-closing-comp": "warn",
128
-
129
- /**
130
- * Require CSS properties in the style prop to be valid and kebab-cased (ex. 'font-size'), ✅ 🔧
131
- * not camel-cased (ex. 'fontSize') like in React, and that property values with dimensions
132
- * are strings, not numbers with implicit 'px' units.
133
- */
134
- "solid/style-prop": "warn",
135
- },
136
- };