Socket
Socket
Sign inDemoInstall

eslint-plugin-jest

Package Overview
Dependencies
Maintainers
11
Versions
325
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-jest - npm Package Compare versions

Comparing version 27.2.3 to 27.4.0

docs/rules/no-confusing-set-timeout.md

10

docs/rules/valid-title.md

@@ -128,3 +128,4 @@ # Enforce valid titles (`valid-title`)

A `describe` / `test` block should not contain accidentalSpace
A `describe` / `test` block should not contain accidentalSpace, but can be
turned off via the `ignoreSpaces` option:

@@ -165,2 +166,3 @@ Examples of **incorrect** code for this rule

interface Options {
ignoreSpaces?: boolean;
ignoreTypeOfDescribeName?: boolean;

@@ -173,2 +175,8 @@ disallowedWords?: string[];

#### `ignoreSpaces`
Default: `false`
When enabled, the leading and trailing spaces won't be checked.
#### `ignoreTypeOfDescribeName`

@@ -175,0 +183,0 @@

4

lib/rules/expect-expect.js

@@ -23,3 +23,5 @@ "use strict";

return patterns.some(p => new RegExp(`^${p.split('.').map(x => {
if (x === '**') return '[a-z\\d\\.]*';
if (x === '**') {
return '[a-z\\d\\.]*';
}
return x.replace(/\*/gu, '[a-z\\d]*');

@@ -26,0 +28,0 @@ }).join('\\.')}(\\.|$)`, 'ui').test(nodeName));

@@ -39,3 +39,5 @@ "use strict";

const returnStmt = body.find(t => t.type === _utils.AST_NODE_TYPES.ReturnStatement);
if (!returnStmt) return;
if (!returnStmt) {
return;
}
context.report({

@@ -49,5 +51,9 @@ messageId: 'noReturnValue',

const testCallExpressions = (0, _utils2.getTestCallExpressionsFromDeclaredVariables)(declaredVariables, context);
if (testCallExpressions.length === 0) return;
if (testCallExpressions.length === 0) {
return;
}
const returnStmt = node.body.body.find(t => t.type === _utils.AST_NODE_TYPES.ReturnStatement);
if (!returnStmt) return;
if (!returnStmt) {
return;
}
context.report({

@@ -54,0 +60,0 @@ messageId: 'noReturnValue',

@@ -59,3 +59,5 @@ "use strict";

fix(fixer) {
if (!moduleName) return [];
if (!moduleName) {
return [];
}
return [fixer.insertTextAfter(callee, `<typeof import(${moduleName.raw})>`)];

@@ -62,0 +64,0 @@ }

@@ -64,5 +64,9 @@ "use strict";

} = node;
if (left.type !== _utils.AST_NODE_TYPES.MemberExpression) return;
if (left.type !== _utils.AST_NODE_TYPES.MemberExpression) {
return;
}
const jestFnCall = getJestFnCall(right);
if (!jestFnCall) return;
if (!jestFnCall) {
return;
}
context.report({

@@ -69,0 +73,0 @@ node,

@@ -66,3 +66,3 @@ "use strict";

}
(_baseSelectors$Member = baseSelectors.MemberExpression) === null || _baseSelectors$Member === void 0 ? void 0 : _baseSelectors$Member.call(baseSelectors, node);
(_baseSelectors$Member = baseSelectors.MemberExpression) === null || _baseSelectors$Member === void 0 || _baseSelectors$Member.call(baseSelectors, node);
}

@@ -69,0 +69,0 @@ };

@@ -71,2 +71,6 @@ "use strict";

properties: {
ignoreSpaces: {
type: 'boolean',
default: false
},
ignoreTypeOfDescribeName: {

@@ -105,2 +109,3 @@ type: 'boolean',

defaultOptions: [{
ignoreSpaces: false,
ignoreTypeOfDescribeName: false,

@@ -110,2 +115,3 @@ disallowedWords: []

create(context, [{
ignoreSpaces,
ignoreTypeOfDescribeName,

@@ -165,3 +171,3 @@ disallowedWords = [],

}
if (title.trim().length !== title.length) {
if (ignoreSpaces === false && title.trim().length !== title.length) {
context.report({

@@ -168,0 +174,0 @@ messageId: 'accidentalSpace',

{
"name": "eslint-plugin-jest",
"version": "27.2.3",
"version": "27.4.0",
"description": "ESLint rules for Jest",

@@ -48,4 +48,3 @@ "keywords": [

"proseWrap": "always",
"singleQuote": true,
"trailingComma": "all"
"singleQuote": true
},

@@ -109,11 +108,9 @@ "release": {

"@commitlint/config-conventional": "^17.0.3",
"@schemastore/package": "^0.0.8",
"@schemastore/package": "^0.0.10",
"@semantic-release/changelog": "^6.0.0",
"@semantic-release/git": "^10.0.0",
"@tsconfig/node14": "^14.1.0",
"@types/dedent": "^0.7.0",
"@types/eslint": "^8.4.6",
"@types/jest": "^29.0.0",
"@types/node": "^14.18.26",
"@types/prettier": "^2.0.0",
"@typescript-eslint/eslint-plugin": "^5.0.0",

@@ -123,5 +120,5 @@ "@typescript-eslint/parser": "^5.0.0",

"babel-plugin-replace-ts-export-assignment": "^0.0.2",
"dedent": "^0.7.0",
"eslint": "^6.0.0 || ^7.0.0 || ^8.0.0",
"eslint-config-prettier": "^8.3.0",
"dedent": "^1.5.0",
"eslint": "^7.0.0 || ^8.0.0",
"eslint-config-prettier": "^9.0.0",
"eslint-doc-generator": "^1.0.0",

@@ -132,3 +129,3 @@ "eslint-plugin-eslint-comments": "^3.1.2",

"eslint-plugin-node": "^11.0.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-prettier": "^5.0.0",
"eslint-remote-tester": "^3.0.0",

@@ -143,3 +140,3 @@ "eslint-remote-tester-repositories": "~1.0.0",

"pinst": "^3.0.0",
"prettier": "^2.0.5",
"prettier": "^3.0.0",
"rimraf": "^5.0.0",

@@ -164,3 +161,3 @@ "semantic-release": "^21.0.0",

},
"packageManager": "yarn@3.6.1",
"packageManager": "yarn@3.6.3",
"engines": {

@@ -167,0 +164,0 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0"

@@ -223,2 +223,3 @@ <div align="center">

| [no-conditional-in-test](docs/rules/no-conditional-in-test.md) | Disallow conditional logic in tests | | | | | |
| [no-confusing-set-timeout](docs/rules/no-confusing-set-timeout.md) | Disallow confusing usages of jest.setTimeout | | | | | |
| [no-deprecated-functions](docs/rules/no-deprecated-functions.md) | Disallow use of deprecated functions | βœ… | | πŸ”§ | | |

@@ -225,0 +226,0 @@ | [no-disabled-tests](docs/rules/no-disabled-tests.md) | Disallow disabled tests | | βœ… | | | |

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚑️ by Socket Inc