eslint-plugin-storybook
Advanced tools
Comparing version 0.6.13 to 0.6.15
@@ -0,1 +1,25 @@ | ||
# v0.6.15 (Sun Oct 08 2023) | ||
#### 🐛 Bug Fix | ||
- no-uninstalled-addons: support satisfies operator and default reexport [#139](https://github.com/storybookjs/eslint-plugin-storybook/pull/139) ([@hjoelh](https://github.com/hjoelh)) | ||
#### Authors: 1 | ||
- Joel ([@hjoelh](https://github.com/hjoelh)) | ||
--- | ||
# v0.6.14 (Wed Sep 20 2023) | ||
#### 🐛 Bug Fix | ||
- use-storybook-expect: allow storybook/test imports [#141](https://github.com/storybookjs/eslint-plugin-storybook/pull/141) ([@yannbf](https://github.com/yannbf)) | ||
#### Authors: 1 | ||
- Yann Braga ([@yannbf](https://github.com/yannbf)) | ||
--- | ||
# v0.6.13 (Thu Jul 20 2023) | ||
@@ -2,0 +26,0 @@ |
@@ -15,2 +15,3 @@ "use strict"; | ||
const ast_1 = require("../utils/ast"); | ||
const utils_1 = require("../utils"); | ||
module.exports = (0, create_storybook_rule_1.createStorybookRule)({ | ||
@@ -167,2 +168,8 @@ name: 'no-uninstalled-addons', | ||
} | ||
function findAddonsPropAndReport(node) { | ||
const addonsProp = node.properties.find((prop) => (0, ast_1.isProperty)(prop) && (0, ast_1.isIdentifier)(prop.key) && prop.key.name === 'addons'); | ||
if ((addonsProp === null || addonsProp === void 0 ? void 0 : addonsProp.value) && (0, ast_1.isArrayExpression)(addonsProp.value)) { | ||
reportUninstalledAddons(addonsProp.value); | ||
} | ||
} | ||
//---------------------------------------------------------------------- | ||
@@ -174,15 +181,10 @@ // Public | ||
if ((0, ast_1.isObjectExpression)(node.right)) { | ||
const addonsProp = node.right.properties.find((prop) => (0, ast_1.isProperty)(prop) && (0, ast_1.isIdentifier)(prop.key) && prop.key.name === 'addons'); | ||
if (addonsProp && addonsProp.value && (0, ast_1.isArrayExpression)(addonsProp.value)) { | ||
reportUninstalledAddons(addonsProp.value); | ||
} | ||
findAddonsPropAndReport(node.right); | ||
} | ||
}, | ||
ExportDefaultDeclaration: function (node) { | ||
if ((0, ast_1.isObjectExpression)(node.declaration)) { | ||
const addonsProp = node.declaration.properties.find((prop) => (0, ast_1.isProperty)(prop) && (0, ast_1.isIdentifier)(prop.key) && prop.key.name === 'addons'); | ||
if (addonsProp && addonsProp.value && (0, ast_1.isArrayExpression)(addonsProp.value)) { | ||
reportUninstalledAddons(addonsProp.value); | ||
} | ||
} | ||
const meta = (0, utils_1.getMetaObjectExpression)(node, context); | ||
if (!meta) | ||
return null; | ||
findAddonsPropAndReport(meta); | ||
}, | ||
@@ -189,0 +191,0 @@ ExportNamedDeclaration: function (node) { |
@@ -33,3 +33,5 @@ "use strict"; | ||
const isExpectFromStorybookImported = (node) => { | ||
return (node.source.value === '@storybook/jest' && | ||
const { value: packageName } = node.source; | ||
const usesExpectFromStorybook = packageName === '@storybook/jest' || packageName === '@storybook/test'; | ||
return (usesExpectFromStorybook && | ||
node.specifiers.find((spec) => (0, ast_1.isImportSpecifier)(spec) && spec.imported.name === 'expect')); | ||
@@ -36,0 +38,0 @@ }; |
{ | ||
"name": "eslint-plugin-storybook", | ||
"version": "0.6.13", | ||
"version": "0.6.15", | ||
"description": "Best practice rules for Storybook", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
107732
1651