Skip to content

Commit

Permalink
Merge pull request #165 from storybookjs/yann/fix-storybook-jest-rule
Browse files Browse the repository at this point in the history
use-storybook-expect: remove auto fix suggestion
  • Loading branch information
yannbf authored Sep 26, 2024
2 parents eef5e25 + 991522a commit ecbb48e
Show file tree
Hide file tree
Showing 6 changed files with 4,435 additions and 3,546 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ jobs:
- name: Prepare repository
run: git fetch --unshallow --tags

- uses: pnpm/action-setup@v3
- uses: pnpm/action-setup@v4
with:
version: 8
version: 9
run_install: true

- name: Create Release
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ jobs:
- uses: actions/checkout@v2


- uses: pnpm/action-setup@v3
- uses: pnpm/action-setup@v4
with:
version: 8
version: 9
run_install: true

- name: Run tests
Expand Down
21 changes: 2 additions & 19 deletions lib/rules/use-storybook-expect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ export = createStorybookRule<TDefaultOptions, string>({
hasSuggestions: true,
schema: [],
docs: {
description: 'Use expect from `@storybook/jest`',
description: 'Use expect from `@storybook/test` or `@storybook/jest`',
categories: [CategoryId.ADDON_INTERACTIONS, CategoryId.RECOMMENDED],
recommended: 'error',
},
messages: {
updateImports: 'Update imports',
useExpectFromStorybook:
'Do not use expect from jest directly in the story. You should use from `@storybook/jest` instead.',
'Do not use global expect directly in the story. You should import it from `@storybook/test` or `@storybook/jest` instead.',
},
},

Expand Down Expand Up @@ -82,23 +82,6 @@ export = createStorybookRule<TDefaultOptions, string>({
context.report({
node,
messageId: 'useExpectFromStorybook',
fix: function (fixer) {
return fixer.insertTextAfterRange(
[0, 0],
"import { expect } from '@storybook/jest';\n"
)
},
suggest: [
{
messageId: 'updateImports',
fix: function (fixer) {
return fixer.insertTextAfterRange(
[0, 0],
"import { expect } from '@storybook/jest';\n"
)
},
},
],
})
})
}
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,14 @@
"ts-dedent": "^2.2.0"
},
"devDependencies": {
"@auto-it/released": "^11.0.4",
"@auto-it/released": "^11.2.1",
"@types/eslint": "^8.56.2",
"@types/jest": "^29.5.12",
"@types/node": "^18.19.17",
"@types/requireindex": "^1.2.4",
"@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/parser": "^5.62.0",
"auto": "^11.0.4",
"auto": "^11.2.1",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-eslint-plugin": "^5.3.0",
Expand Down
Loading

0 comments on commit ecbb48e

Please sign in to comment.