@vitest/eslint-plugin 1.0.2 → 1.0.4

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
@@ -16,7 +16,7 @@ npm i eslint --save-dev
16
16
  Next, install `@vitest/eslint-plugin`
17
17
 
18
18
  ```sh
19
- npm install @vitest/eslint-plugin --save
19
+ npm install @vitest/eslint-plugin --save-dev
20
20
  ```
21
21
 
22
22
  ### Usage
package/dist/index.cjs CHANGED
@@ -24,7 +24,7 @@ function _interopNamespaceCompat(e) {
24
24
  const path__namespace = /*#__PURE__*/_interopNamespaceCompat(path);
25
25
  const ts__default = /*#__PURE__*/_interopDefaultCompat(ts);
26
26
 
27
- const version = "1.0.1";
27
+ const version = "1.0.3";
28
28
 
29
29
  function createEslintRule(rule) {
30
30
  const createRule = utils.ESLintUtils.RuleCreator(
@@ -768,7 +768,7 @@ const expectExpect = createEslintRule({
768
768
  noAssertions: "Test has no assertions"
769
769
  }
770
770
  },
771
- defaultOptions: [{ assertFunctionNames: ["expect"], additionalTestBlockFunctions: [] }],
771
+ defaultOptions: [{ assertFunctionNames: ["expect", "assert"], additionalTestBlockFunctions: [] }],
772
772
  create(context, [{ assertFunctionNames = ["expect"], additionalTestBlockFunctions = [] }]) {
773
773
  const unchecked = [];
774
774
  const settings = parsePluginSettings(context.settings);
@@ -806,14 +806,12 @@ const expectExpect = createEslintRule({
806
806
  }
807
807
  },
808
808
  "Program:exit"() {
809
- const isActuallyNotValid = unchecked.filter((node) => node.arguments.some((arg) => arg.type === utils.AST_NODE_TYPES.Literal && arg.value === "assert"));
810
- if (!isActuallyNotValid.length)
811
- unchecked.forEach((node) => {
812
- context.report({
813
- node: node.callee,
814
- messageId: "noAssertions"
815
- });
809
+ unchecked.forEach((node) => {
810
+ context.report({
811
+ node: node.callee,
812
+ messageId: "noAssertions"
816
813
  });
814
+ });
817
815
  }
818
816
  };
819
817
  }
@@ -3239,7 +3237,6 @@ const validDescribeCallback = createEslintRule({
3239
3237
  messages: {
3240
3238
  nameAndCallback: "Describe requires a name and callback arguments",
3241
3239
  secondArgumentMustBeFunction: "Second argument must be a function",
3242
- noAsyncDescribeCallback: "Describe callback cannot be async",
3243
3240
  unexpectedDescribeArgument: "Unexpected argument in describe callback",
3244
3241
  unexpectedReturnInDescribe: "Unexpected return statement in describe callback"
3245
3242
  },
@@ -3275,12 +3272,6 @@ const validDescribeCallback = createEslintRule({
3275
3272
  });
3276
3273
  return;
3277
3274
  }
3278
- if (callback.async) {
3279
- context.report({
3280
- messageId: "noAsyncDescribeCallback",
3281
- node: callback
3282
- });
3283
- }
3284
3275
  if (vitestFnCall.members.every((s) => getAccessorValue(s) !== "each") && callback.params.length) {
3285
3276
  context.report({
3286
3277
  messageId: "unexpectedDescribeArgument",
package/dist/index.mjs CHANGED
@@ -5,7 +5,7 @@ import ts from 'typescript';
5
5
  import { fileURLToPath } from 'node:url';
6
6
  import { createRequire } from 'node:module';
7
7
 
8
- const version = "1.0.1";
8
+ const version = "1.0.3";
9
9
 
10
10
  function createEslintRule(rule) {
11
11
  const createRule = ESLintUtils.RuleCreator(
@@ -749,7 +749,7 @@ const expectExpect = createEslintRule({
749
749
  noAssertions: "Test has no assertions"
750
750
  }
751
751
  },
752
- defaultOptions: [{ assertFunctionNames: ["expect"], additionalTestBlockFunctions: [] }],
752
+ defaultOptions: [{ assertFunctionNames: ["expect", "assert"], additionalTestBlockFunctions: [] }],
753
753
  create(context, [{ assertFunctionNames = ["expect"], additionalTestBlockFunctions = [] }]) {
754
754
  const unchecked = [];
755
755
  const settings = parsePluginSettings(context.settings);
@@ -787,14 +787,12 @@ const expectExpect = createEslintRule({
787
787
  }
788
788
  },
789
789
  "Program:exit"() {
790
- const isActuallyNotValid = unchecked.filter((node) => node.arguments.some((arg) => arg.type === AST_NODE_TYPES.Literal && arg.value === "assert"));
791
- if (!isActuallyNotValid.length)
792
- unchecked.forEach((node) => {
793
- context.report({
794
- node: node.callee,
795
- messageId: "noAssertions"
796
- });
790
+ unchecked.forEach((node) => {
791
+ context.report({
792
+ node: node.callee,
793
+ messageId: "noAssertions"
797
794
  });
795
+ });
798
796
  }
799
797
  };
800
798
  }
@@ -3220,7 +3218,6 @@ const validDescribeCallback = createEslintRule({
3220
3218
  messages: {
3221
3219
  nameAndCallback: "Describe requires a name and callback arguments",
3222
3220
  secondArgumentMustBeFunction: "Second argument must be a function",
3223
- noAsyncDescribeCallback: "Describe callback cannot be async",
3224
3221
  unexpectedDescribeArgument: "Unexpected argument in describe callback",
3225
3222
  unexpectedReturnInDescribe: "Unexpected return statement in describe callback"
3226
3223
  },
@@ -3256,12 +3253,6 @@ const validDescribeCallback = createEslintRule({
3256
3253
  });
3257
3254
  return;
3258
3255
  }
3259
- if (callback.async) {
3260
- context.report({
3261
- messageId: "noAsyncDescribeCallback",
3262
- node: callback
3263
- });
3264
- }
3265
3256
  if (vitestFnCall.members.every((s) => getAccessorValue(s) !== "each") && callback.params.length) {
3266
3257
  context.report({
3267
3258
  messageId: "unexpectedDescribeArgument",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitest/eslint-plugin",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "license": "MIT",
5
5
  "description": "Eslint plugin for vitest",
6
6
  "repository": "vitest-dev/eslint-plugin-vitest",
@@ -30,7 +30,7 @@
30
30
  ],
31
31
  "devDependencies": {
32
32
  "@stylistic/eslint-plugin": "^2.6.2",
33
- "@types/eslint": "^8.56.11",
33
+ "@types/eslint": "^9.6.0",
34
34
  "@types/mocha": "^10.0.7",
35
35
  "@types/node": "^20.14.15",
36
36
  "@typescript-eslint/eslint-plugin": "8.0.0",
@@ -43,7 +43,7 @@
43
43
  "eslint-doc-generator": "^1.7.1",
44
44
  "eslint-plugin-eslint-plugin": "^6.2.0",
45
45
  "eslint-remote-tester": "^4.0.1",
46
- "eslint-remote-tester-repositories": "^1.0.1",
46
+ "eslint-remote-tester-repositories": "^2.0.0",
47
47
  "importx": "^0.3.11",
48
48
  "tsx": "^4.17.0",
49
49
  "typescript": "^5.5.4",