Socket
Socket
Sign inDemoInstall

eslint-plugin-storybook

Package Overview
Dependencies
131
Maintainers
2
Versions
91
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.6.5 to 0.6.6

13

CHANGELOG.md

@@ -0,1 +1,14 @@

# v0.6.6 (Tue Oct 11 2022)
#### 🐛 Bug Fix
- fix: await interactions rule scope. [#100](https://github.com/storybookjs/eslint-plugin-storybook/pull/100) ([@zhyd1997](https://github.com/zhyd1997) [@yannbf](https://github.com/yannbf))
#### Authors: 2
- Yadong Zhang ([@zhyd1997](https://github.com/zhyd1997))
- Yann Braga ([@yannbf](https://github.com/yannbf))
---
# v0.6.5 (Mon Oct 10 2022)

@@ -2,0 +15,0 @@

21

dist/rules/await-interactions.js

@@ -89,2 +89,12 @@ "use strict";

};
const isUserEventFromStorybookImported = (node) => {
return (node.source.value === '@storybook/testing-library' &&
node.specifiers.find((spec) => (0, ast_1.isImportSpecifier)(spec) &&
spec.imported.name === 'userEvent' &&
spec.local.name === 'userEvent') !== undefined);
};
const isExpectFromStorybookImported = (node) => {
return (node.source.value === '@storybook/jest' &&
node.specifiers.find((spec) => (0, ast_1.isImportSpecifier)(spec) && spec.imported.name === 'expect') !== undefined);
};
//----------------------------------------------------------------------

@@ -96,4 +106,13 @@ // Public

*/
let isImportedFromStorybook = true;
let invocationsThatShouldBeAwaited = [];
return {
ImportDeclaration(node) {
isImportedFromStorybook =
isUserEventFromStorybookImported(node) || isExpectFromStorybookImported(node);
},
VariableDeclarator(node) {
isImportedFromStorybook =
isImportedFromStorybook && (0, ast_1.isIdentifier)(node.id) && node.id.name !== 'userEvent';
},
CallExpression(node) {

@@ -107,3 +126,3 @@ var _a;

'Program:exit': function () {
if (invocationsThatShouldBeAwaited.length) {
if (isImportedFromStorybook && invocationsThatShouldBeAwaited.length) {
invocationsThatShouldBeAwaited.forEach(({ node, method }) => {

@@ -110,0 +129,0 @@ const parentFnNode = getClosestFunctionAncestor(node);

2

package.json
{
"name": "eslint-plugin-storybook",
"version": "0.6.5",
"version": "0.6.6",
"description": "Best practice rules for Storybook",

@@ -5,0 +5,0 @@ "keywords": [

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc