@vitest/eslint-plugin 1.0.5 → 1.1.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.
- package/dist/index.cjs +9 -13
- package/dist/index.d.cts +16 -2
- package/dist/index.d.mts +16 -2
- package/dist/index.d.ts +16 -2
- package/dist/index.mjs +10 -14
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
const utils = require('@typescript-eslint/utils');
|
|
4
4
|
const path = require('node:path');
|
|
5
5
|
const ts = require('typescript');
|
|
6
|
-
const node_url = require('node:url');
|
|
7
6
|
const node_module = require('node:module');
|
|
8
7
|
|
|
9
8
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
@@ -24,7 +23,7 @@ function _interopNamespaceCompat(e) {
|
|
|
24
23
|
const path__namespace = /*#__PURE__*/_interopNamespaceCompat(path);
|
|
25
24
|
const ts__default = /*#__PURE__*/_interopDefaultCompat(ts);
|
|
26
25
|
|
|
27
|
-
const version = "1.0.
|
|
26
|
+
const version = "1.0.5";
|
|
28
27
|
|
|
29
28
|
function createEslintRule(rule) {
|
|
30
29
|
const createRule = utils.ESLintUtils.RuleCreator(
|
|
@@ -2537,9 +2536,6 @@ const isBooleanEqualityMatcher = (expectFnCall) => {
|
|
|
2537
2536
|
};
|
|
2538
2537
|
const isInstanceOfBinaryExpression = (node, className) => node.type === utils.AST_NODE_TYPES.BinaryExpression && node.operator === "instanceof" && isSupportedAccessor(node.right, className);
|
|
2539
2538
|
const hasOnlyOneArgument = (call) => call.arguments.length === 1;
|
|
2540
|
-
function getFilename(url) {
|
|
2541
|
-
return path.parse(path.basename(node_url.fileURLToPath(url))).name;
|
|
2542
|
-
}
|
|
2543
2539
|
|
|
2544
2540
|
const RULE_NAME$t = "prefer-to-be-object";
|
|
2545
2541
|
const preferToBeObject = createEslintRule({
|
|
@@ -4257,7 +4253,7 @@ const createPaddingRule = (name, description, configs, deprecated = false) => {
|
|
|
4257
4253
|
});
|
|
4258
4254
|
};
|
|
4259
4255
|
|
|
4260
|
-
const RULE_NAME$7 =
|
|
4256
|
+
const RULE_NAME$7 = "padding-around-after-all-blocks";
|
|
4261
4257
|
const config$6 = [
|
|
4262
4258
|
{
|
|
4263
4259
|
paddingType: PaddingType.Always,
|
|
@@ -4272,7 +4268,7 @@ const config$6 = [
|
|
|
4272
4268
|
];
|
|
4273
4269
|
const paddingAroundAfterAllBlocks = createPaddingRule(RULE_NAME$7, "Enforce padding around `afterAll` blocks", config$6);
|
|
4274
4270
|
|
|
4275
|
-
const RULE_NAME$6 =
|
|
4271
|
+
const RULE_NAME$6 = "padding-around-after-each-blocks";
|
|
4276
4272
|
const config$5 = [
|
|
4277
4273
|
{
|
|
4278
4274
|
paddingType: PaddingType.Always,
|
|
@@ -4287,7 +4283,7 @@ const config$5 = [
|
|
|
4287
4283
|
];
|
|
4288
4284
|
const paddingAroundAfterEachBlocks = createPaddingRule(RULE_NAME$6, "Enforce padding around `afterEach` blocks", config$5);
|
|
4289
4285
|
|
|
4290
|
-
const RULE_NAME$5 =
|
|
4286
|
+
const RULE_NAME$5 = "padding-around-before-all-blocks";
|
|
4291
4287
|
const config$4 = [
|
|
4292
4288
|
{
|
|
4293
4289
|
paddingType: PaddingType.Always,
|
|
@@ -4302,7 +4298,7 @@ const config$4 = [
|
|
|
4302
4298
|
];
|
|
4303
4299
|
const paddingAroundBeforeAllBlocks = createPaddingRule(RULE_NAME$5, "Enforce padding around `beforeAll` blocks", config$4);
|
|
4304
4300
|
|
|
4305
|
-
const RULE_NAME$4 =
|
|
4301
|
+
const RULE_NAME$4 = "padding-around-before-each-blocks";
|
|
4306
4302
|
const config$3 = [
|
|
4307
4303
|
{
|
|
4308
4304
|
paddingType: PaddingType.Always,
|
|
@@ -4321,7 +4317,7 @@ const paddingAroundBeforeEachBlocks = createPaddingRule(
|
|
|
4321
4317
|
config$3
|
|
4322
4318
|
);
|
|
4323
4319
|
|
|
4324
|
-
const RULE_NAME$3 =
|
|
4320
|
+
const RULE_NAME$3 = "padding-around-describe-blocks";
|
|
4325
4321
|
const config$2 = [
|
|
4326
4322
|
{
|
|
4327
4323
|
paddingType: PaddingType.Always,
|
|
@@ -4348,7 +4344,7 @@ const paddingAroundDescribeBlocks = createPaddingRule(
|
|
|
4348
4344
|
config$2
|
|
4349
4345
|
);
|
|
4350
4346
|
|
|
4351
|
-
const RULE_NAME$2 =
|
|
4347
|
+
const RULE_NAME$2 = "padding-around-expect-groups";
|
|
4352
4348
|
const config$1 = [
|
|
4353
4349
|
{
|
|
4354
4350
|
paddingType: PaddingType.Always,
|
|
@@ -4372,7 +4368,7 @@ const paddingAroundExpectGroups = createPaddingRule(
|
|
|
4372
4368
|
config$1
|
|
4373
4369
|
);
|
|
4374
4370
|
|
|
4375
|
-
const RULE_NAME$1 =
|
|
4371
|
+
const RULE_NAME$1 = "padding-around-test-blocks";
|
|
4376
4372
|
const config = [
|
|
4377
4373
|
{
|
|
4378
4374
|
paddingType: PaddingType.Always,
|
|
@@ -4403,7 +4399,7 @@ const paddingAroundTestBlocks = createPaddingRule(
|
|
|
4403
4399
|
config
|
|
4404
4400
|
);
|
|
4405
4401
|
|
|
4406
|
-
const RULE_NAME =
|
|
4402
|
+
const RULE_NAME = "padding-around-all";
|
|
4407
4403
|
const paddingAroundAll = createPaddingRule(
|
|
4408
4404
|
RULE_NAME,
|
|
4409
4405
|
"Enforce padding around vitest functions",
|
package/dist/index.d.cts
CHANGED
|
@@ -7,7 +7,6 @@ declare const plugin: {
|
|
|
7
7
|
version: string;
|
|
8
8
|
};
|
|
9
9
|
rules: {
|
|
10
|
-
[x: string]: eslint.Rule.RuleModule;
|
|
11
10
|
"prefer-lowercase-title": eslint.Rule.RuleModule;
|
|
12
11
|
"max-nested-describe": eslint.Rule.RuleModule;
|
|
13
12
|
"no-identical-title": eslint.Rule.RuleModule;
|
|
@@ -60,6 +59,14 @@ declare const plugin: {
|
|
|
60
59
|
"prefer-comparison-matcher": eslint.Rule.RuleModule;
|
|
61
60
|
"prefer-to-contain": eslint.Rule.RuleModule;
|
|
62
61
|
"prefer-expect-assertions": eslint.Rule.RuleModule;
|
|
62
|
+
"padding-around-after-all-blocks": eslint.Rule.RuleModule;
|
|
63
|
+
"padding-around-after-each-blocks": eslint.Rule.RuleModule;
|
|
64
|
+
"padding-around-all": eslint.Rule.RuleModule;
|
|
65
|
+
"padding-around-before-all-blocks": eslint.Rule.RuleModule;
|
|
66
|
+
"padding-around-before-each-blocks": eslint.Rule.RuleModule;
|
|
67
|
+
"padding-around-describe-blocks": eslint.Rule.RuleModule;
|
|
68
|
+
"padding-around-expect-groups": eslint.Rule.RuleModule;
|
|
69
|
+
"padding-around-test-blocks": eslint.Rule.RuleModule;
|
|
63
70
|
};
|
|
64
71
|
configs: {
|
|
65
72
|
'legacy-recommended': {
|
|
@@ -90,7 +97,6 @@ declare const plugin: {
|
|
|
90
97
|
readonly vitest: ESLint.Plugin;
|
|
91
98
|
};
|
|
92
99
|
rules: {
|
|
93
|
-
readonly [x: `vitest/${string}`]: "warn";
|
|
94
100
|
readonly "vitest/prefer-lowercase-title": "warn";
|
|
95
101
|
readonly "vitest/max-nested-describe": "warn";
|
|
96
102
|
readonly "vitest/no-focused-tests": "warn";
|
|
@@ -135,6 +141,14 @@ declare const plugin: {
|
|
|
135
141
|
readonly "vitest/prefer-to-contain": "warn";
|
|
136
142
|
readonly "vitest/prefer-expect-assertions": "warn";
|
|
137
143
|
readonly "vitest/prefer-to-be": "warn";
|
|
144
|
+
readonly "vitest/padding-around-after-all-blocks": "warn";
|
|
145
|
+
readonly "vitest/padding-around-after-each-blocks": "warn";
|
|
146
|
+
readonly "vitest/padding-around-all": "warn";
|
|
147
|
+
readonly "vitest/padding-around-before-all-blocks": "warn";
|
|
148
|
+
readonly "vitest/padding-around-before-each-blocks": "warn";
|
|
149
|
+
readonly "vitest/padding-around-describe-blocks": "warn";
|
|
150
|
+
readonly "vitest/padding-around-expect-groups": "warn";
|
|
151
|
+
readonly "vitest/padding-around-test-blocks": "warn";
|
|
138
152
|
};
|
|
139
153
|
};
|
|
140
154
|
env: {
|
package/dist/index.d.mts
CHANGED
|
@@ -7,7 +7,6 @@ declare const plugin: {
|
|
|
7
7
|
version: string;
|
|
8
8
|
};
|
|
9
9
|
rules: {
|
|
10
|
-
[x: string]: eslint.Rule.RuleModule;
|
|
11
10
|
"prefer-lowercase-title": eslint.Rule.RuleModule;
|
|
12
11
|
"max-nested-describe": eslint.Rule.RuleModule;
|
|
13
12
|
"no-identical-title": eslint.Rule.RuleModule;
|
|
@@ -60,6 +59,14 @@ declare const plugin: {
|
|
|
60
59
|
"prefer-comparison-matcher": eslint.Rule.RuleModule;
|
|
61
60
|
"prefer-to-contain": eslint.Rule.RuleModule;
|
|
62
61
|
"prefer-expect-assertions": eslint.Rule.RuleModule;
|
|
62
|
+
"padding-around-after-all-blocks": eslint.Rule.RuleModule;
|
|
63
|
+
"padding-around-after-each-blocks": eslint.Rule.RuleModule;
|
|
64
|
+
"padding-around-all": eslint.Rule.RuleModule;
|
|
65
|
+
"padding-around-before-all-blocks": eslint.Rule.RuleModule;
|
|
66
|
+
"padding-around-before-each-blocks": eslint.Rule.RuleModule;
|
|
67
|
+
"padding-around-describe-blocks": eslint.Rule.RuleModule;
|
|
68
|
+
"padding-around-expect-groups": eslint.Rule.RuleModule;
|
|
69
|
+
"padding-around-test-blocks": eslint.Rule.RuleModule;
|
|
63
70
|
};
|
|
64
71
|
configs: {
|
|
65
72
|
'legacy-recommended': {
|
|
@@ -90,7 +97,6 @@ declare const plugin: {
|
|
|
90
97
|
readonly vitest: ESLint.Plugin;
|
|
91
98
|
};
|
|
92
99
|
rules: {
|
|
93
|
-
readonly [x: `vitest/${string}`]: "warn";
|
|
94
100
|
readonly "vitest/prefer-lowercase-title": "warn";
|
|
95
101
|
readonly "vitest/max-nested-describe": "warn";
|
|
96
102
|
readonly "vitest/no-focused-tests": "warn";
|
|
@@ -135,6 +141,14 @@ declare const plugin: {
|
|
|
135
141
|
readonly "vitest/prefer-to-contain": "warn";
|
|
136
142
|
readonly "vitest/prefer-expect-assertions": "warn";
|
|
137
143
|
readonly "vitest/prefer-to-be": "warn";
|
|
144
|
+
readonly "vitest/padding-around-after-all-blocks": "warn";
|
|
145
|
+
readonly "vitest/padding-around-after-each-blocks": "warn";
|
|
146
|
+
readonly "vitest/padding-around-all": "warn";
|
|
147
|
+
readonly "vitest/padding-around-before-all-blocks": "warn";
|
|
148
|
+
readonly "vitest/padding-around-before-each-blocks": "warn";
|
|
149
|
+
readonly "vitest/padding-around-describe-blocks": "warn";
|
|
150
|
+
readonly "vitest/padding-around-expect-groups": "warn";
|
|
151
|
+
readonly "vitest/padding-around-test-blocks": "warn";
|
|
138
152
|
};
|
|
139
153
|
};
|
|
140
154
|
env: {
|
package/dist/index.d.ts
CHANGED
|
@@ -7,7 +7,6 @@ declare const plugin: {
|
|
|
7
7
|
version: string;
|
|
8
8
|
};
|
|
9
9
|
rules: {
|
|
10
|
-
[x: string]: eslint.Rule.RuleModule;
|
|
11
10
|
"prefer-lowercase-title": eslint.Rule.RuleModule;
|
|
12
11
|
"max-nested-describe": eslint.Rule.RuleModule;
|
|
13
12
|
"no-identical-title": eslint.Rule.RuleModule;
|
|
@@ -60,6 +59,14 @@ declare const plugin: {
|
|
|
60
59
|
"prefer-comparison-matcher": eslint.Rule.RuleModule;
|
|
61
60
|
"prefer-to-contain": eslint.Rule.RuleModule;
|
|
62
61
|
"prefer-expect-assertions": eslint.Rule.RuleModule;
|
|
62
|
+
"padding-around-after-all-blocks": eslint.Rule.RuleModule;
|
|
63
|
+
"padding-around-after-each-blocks": eslint.Rule.RuleModule;
|
|
64
|
+
"padding-around-all": eslint.Rule.RuleModule;
|
|
65
|
+
"padding-around-before-all-blocks": eslint.Rule.RuleModule;
|
|
66
|
+
"padding-around-before-each-blocks": eslint.Rule.RuleModule;
|
|
67
|
+
"padding-around-describe-blocks": eslint.Rule.RuleModule;
|
|
68
|
+
"padding-around-expect-groups": eslint.Rule.RuleModule;
|
|
69
|
+
"padding-around-test-blocks": eslint.Rule.RuleModule;
|
|
63
70
|
};
|
|
64
71
|
configs: {
|
|
65
72
|
'legacy-recommended': {
|
|
@@ -90,7 +97,6 @@ declare const plugin: {
|
|
|
90
97
|
readonly vitest: ESLint.Plugin;
|
|
91
98
|
};
|
|
92
99
|
rules: {
|
|
93
|
-
readonly [x: `vitest/${string}`]: "warn";
|
|
94
100
|
readonly "vitest/prefer-lowercase-title": "warn";
|
|
95
101
|
readonly "vitest/max-nested-describe": "warn";
|
|
96
102
|
readonly "vitest/no-focused-tests": "warn";
|
|
@@ -135,6 +141,14 @@ declare const plugin: {
|
|
|
135
141
|
readonly "vitest/prefer-to-contain": "warn";
|
|
136
142
|
readonly "vitest/prefer-expect-assertions": "warn";
|
|
137
143
|
readonly "vitest/prefer-to-be": "warn";
|
|
144
|
+
readonly "vitest/padding-around-after-all-blocks": "warn";
|
|
145
|
+
readonly "vitest/padding-around-after-each-blocks": "warn";
|
|
146
|
+
readonly "vitest/padding-around-all": "warn";
|
|
147
|
+
readonly "vitest/padding-around-before-all-blocks": "warn";
|
|
148
|
+
readonly "vitest/padding-around-before-each-blocks": "warn";
|
|
149
|
+
readonly "vitest/padding-around-describe-blocks": "warn";
|
|
150
|
+
readonly "vitest/padding-around-expect-groups": "warn";
|
|
151
|
+
readonly "vitest/padding-around-test-blocks": "warn";
|
|
138
152
|
};
|
|
139
153
|
};
|
|
140
154
|
env: {
|
package/dist/index.mjs
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { ESLintUtils, AST_NODE_TYPES, AST_TOKEN_TYPES } from '@typescript-eslint/utils';
|
|
2
2
|
import * as path from 'node:path';
|
|
3
|
-
import { isAbsolute, posix
|
|
3
|
+
import { isAbsolute, posix } from 'node:path';
|
|
4
4
|
import ts from 'typescript';
|
|
5
|
-
import { fileURLToPath } from 'node:url';
|
|
6
5
|
import { createRequire } from 'node:module';
|
|
7
6
|
|
|
8
|
-
const version = "1.0.
|
|
7
|
+
const version = "1.0.5";
|
|
9
8
|
|
|
10
9
|
function createEslintRule(rule) {
|
|
11
10
|
const createRule = ESLintUtils.RuleCreator(
|
|
@@ -2518,9 +2517,6 @@ const isBooleanEqualityMatcher = (expectFnCall) => {
|
|
|
2518
2517
|
};
|
|
2519
2518
|
const isInstanceOfBinaryExpression = (node, className) => node.type === AST_NODE_TYPES.BinaryExpression && node.operator === "instanceof" && isSupportedAccessor(node.right, className);
|
|
2520
2519
|
const hasOnlyOneArgument = (call) => call.arguments.length === 1;
|
|
2521
|
-
function getFilename(url) {
|
|
2522
|
-
return parse(basename(fileURLToPath(url))).name;
|
|
2523
|
-
}
|
|
2524
2520
|
|
|
2525
2521
|
const RULE_NAME$t = "prefer-to-be-object";
|
|
2526
2522
|
const preferToBeObject = createEslintRule({
|
|
@@ -4238,7 +4234,7 @@ const createPaddingRule = (name, description, configs, deprecated = false) => {
|
|
|
4238
4234
|
});
|
|
4239
4235
|
};
|
|
4240
4236
|
|
|
4241
|
-
const RULE_NAME$7 =
|
|
4237
|
+
const RULE_NAME$7 = "padding-around-after-all-blocks";
|
|
4242
4238
|
const config$6 = [
|
|
4243
4239
|
{
|
|
4244
4240
|
paddingType: PaddingType.Always,
|
|
@@ -4253,7 +4249,7 @@ const config$6 = [
|
|
|
4253
4249
|
];
|
|
4254
4250
|
const paddingAroundAfterAllBlocks = createPaddingRule(RULE_NAME$7, "Enforce padding around `afterAll` blocks", config$6);
|
|
4255
4251
|
|
|
4256
|
-
const RULE_NAME$6 =
|
|
4252
|
+
const RULE_NAME$6 = "padding-around-after-each-blocks";
|
|
4257
4253
|
const config$5 = [
|
|
4258
4254
|
{
|
|
4259
4255
|
paddingType: PaddingType.Always,
|
|
@@ -4268,7 +4264,7 @@ const config$5 = [
|
|
|
4268
4264
|
];
|
|
4269
4265
|
const paddingAroundAfterEachBlocks = createPaddingRule(RULE_NAME$6, "Enforce padding around `afterEach` blocks", config$5);
|
|
4270
4266
|
|
|
4271
|
-
const RULE_NAME$5 =
|
|
4267
|
+
const RULE_NAME$5 = "padding-around-before-all-blocks";
|
|
4272
4268
|
const config$4 = [
|
|
4273
4269
|
{
|
|
4274
4270
|
paddingType: PaddingType.Always,
|
|
@@ -4283,7 +4279,7 @@ const config$4 = [
|
|
|
4283
4279
|
];
|
|
4284
4280
|
const paddingAroundBeforeAllBlocks = createPaddingRule(RULE_NAME$5, "Enforce padding around `beforeAll` blocks", config$4);
|
|
4285
4281
|
|
|
4286
|
-
const RULE_NAME$4 =
|
|
4282
|
+
const RULE_NAME$4 = "padding-around-before-each-blocks";
|
|
4287
4283
|
const config$3 = [
|
|
4288
4284
|
{
|
|
4289
4285
|
paddingType: PaddingType.Always,
|
|
@@ -4302,7 +4298,7 @@ const paddingAroundBeforeEachBlocks = createPaddingRule(
|
|
|
4302
4298
|
config$3
|
|
4303
4299
|
);
|
|
4304
4300
|
|
|
4305
|
-
const RULE_NAME$3 =
|
|
4301
|
+
const RULE_NAME$3 = "padding-around-describe-blocks";
|
|
4306
4302
|
const config$2 = [
|
|
4307
4303
|
{
|
|
4308
4304
|
paddingType: PaddingType.Always,
|
|
@@ -4329,7 +4325,7 @@ const paddingAroundDescribeBlocks = createPaddingRule(
|
|
|
4329
4325
|
config$2
|
|
4330
4326
|
);
|
|
4331
4327
|
|
|
4332
|
-
const RULE_NAME$2 =
|
|
4328
|
+
const RULE_NAME$2 = "padding-around-expect-groups";
|
|
4333
4329
|
const config$1 = [
|
|
4334
4330
|
{
|
|
4335
4331
|
paddingType: PaddingType.Always,
|
|
@@ -4353,7 +4349,7 @@ const paddingAroundExpectGroups = createPaddingRule(
|
|
|
4353
4349
|
config$1
|
|
4354
4350
|
);
|
|
4355
4351
|
|
|
4356
|
-
const RULE_NAME$1 =
|
|
4352
|
+
const RULE_NAME$1 = "padding-around-test-blocks";
|
|
4357
4353
|
const config = [
|
|
4358
4354
|
{
|
|
4359
4355
|
paddingType: PaddingType.Always,
|
|
@@ -4384,7 +4380,7 @@ const paddingAroundTestBlocks = createPaddingRule(
|
|
|
4384
4380
|
config
|
|
4385
4381
|
);
|
|
4386
4382
|
|
|
4387
|
-
const RULE_NAME =
|
|
4383
|
+
const RULE_NAME = "padding-around-all";
|
|
4388
4384
|
const paddingAroundAll = createPaddingRule(
|
|
4389
4385
|
RULE_NAME,
|
|
4390
4386
|
"Enforce padding around vitest functions",
|