New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@rushstack/eslint-plugin

Package Overview
Dependencies
Maintainers
3
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rushstack/eslint-plugin - npm Package Compare versions

Comparing version 0.5.0 to 0.6.0

lib/hoist-jest-mock.d.ts

12

CHANGELOG.json

@@ -5,2 +5,14 @@ {

{
"version": "0.6.0",
"tag": "@rushstack/eslint-plugin_v0.6.0",
"date": "Mon, 24 Aug 2020 07:35:20 GMT",
"comments": {
"minor": [
{
"comment": "Add new rule @rushstack/hoist-jest-mock"
}
]
}
},
{
"version": "0.5.0",

@@ -7,0 +19,0 @@ "tag": "@rushstack/eslint-plugin_v0.5.0",

9

CHANGELOG.md
# Change Log - @rushstack/eslint-plugin
This log was last generated on Sat, 22 Aug 2020 05:55:42 GMT and should not be manually modified.
This log was last generated on Mon, 24 Aug 2020 07:35:20 GMT and should not be manually modified.
## 0.6.0
Mon, 24 Aug 2020 07:35:20 GMT
### Minor changes
- Add new rule @rushstack/hoist-jest-mock
## 0.5.0

@@ -6,0 +13,0 @@ Sat, 22 Aug 2020 05:55:42 GMT

11

lib/index.js
"use strict";
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
const hoist_jest_mock_1 = require("./hoist-jest-mock");
const no_new_null_1 = require("./no-new-null");
const no_null_1 = require("./no-null");
const no_new_null_1 = require("./no-new-null");
const no_untyped_underscore_1 = require("./no-untyped-underscore");
const plugin = {
rules: {
// NOTE: The actual ESLint rule name will be "@rushstack/no-null".
// Full name: "@rushstack/hoist-jest-mock"
'hoist-jest-mock': hoist_jest_mock_1.hoistJestMock,
// Full name: "@rushstack/no-new-null"
'no-new-null': no_new_null_1.noNewNullRule,
// Full name: "@rushstack/no-null"
'no-null': no_null_1.noNullRule,
'no-new-null': no_new_null_1.noNewNullRule,
// Full name: "@rushstack/no-untyped-underscore"
'no-untyped-underscore': no_untyped_underscore_1.noUntypedUnderscoreRule

@@ -13,0 +18,0 @@ }

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
Object.defineProperty(exports, "__esModule", { value: true });
const experimental_utils_1 = require("@typescript-eslint/experimental-utils");

@@ -6,0 +6,0 @@ const no_new_null_1 = require("./no-new-null");

{
"name": "@rushstack/eslint-plugin",
"version": "0.5.0",
"version": "0.6.0",
"description": "An ESLint plugin providing supplementary rules for use with the @rushstack/eslint-config package",

@@ -27,3 +27,3 @@ "repository": {

"devDependencies": {
"@microsoft/rush-stack-compiler-3.9": "0.4.4",
"@microsoft/rush-stack-compiler-3.9": "0.4.8",
"@types/eslint": "7.2.0",

@@ -33,3 +33,3 @@ "@types/estree": "0.0.44",

"@types/node": "10.17.13",
"@rushstack/heft": "0.5.1",
"@rushstack/heft": "0.6.5",
"@typescript-eslint/experimental-utils": "3.4.0",

@@ -36,0 +36,0 @@ "@typescript-eslint/parser": "3.4.0",

@@ -8,2 +8,44 @@ # @rushstack/eslint-plugin

## `@rushstack/hoist-jest-mock`
Require Jest module mocking APIs to be called before any other statements in their code block.
#### Rule Details
Jest module mocking APIs such as "jest.mock()" must be called before the associated module is imported, otherwise
they will have no effect. Transpilers such as `ts-jest` and `babel-jest` automatically "hoist" these calls, however
this can produce counterintuitive behavior. Instead, the `hoist-jest-mocks` lint rule simply requires developers
to write the statements in the correct order.
The following APIs are affected: 'jest.mock()', 'jest.unmock()', 'jest.enableAutomock()', 'jest.disableAutomock()',
'jest.deepUnmock()'.
For technical background, please read the Jest documentation here: https://jestjs.io/docs/en/es6-class-mocks
#### Examples
The following patterns are considered problems when `@rushstack/hoist-jest-mock` is enabled:
```ts
import * as file from './file';
jest.mock('./file'); // error
test("example", () => {
const file2: typeof import('./file2') = require('./file2');
jest.mock('./file2'); // error
});
```
The following patterns are NOT considered problems:
```ts
jest.mock('./file'); // okay, because mock() is first
import * as file from './file';
test("example", () => {
jest.mock('./file2'); // okay, because mock() is first within the test() code block
const file2: typeof import('./file2') = require('./file2');
});
```
## `@rushstack/no-new-null`

@@ -178,2 +220,1 @@

```

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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