Skip to content

Commit

Permalink
fix issues reported by eslint and format md files
Browse files Browse the repository at this point in the history
  • Loading branch information
yannbf committed Nov 1, 2024
1 parent b737baa commit 8d281d4
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ This plugin does not support MDX files.
| [`storybook/no-uninstalled-addons`](./docs/rules/no-uninstalled-addons.md) | This rule identifies storybook addons that are invalid because they are either not installed or contain a typo in their name. | | <ul><li>recommended</li><li>flat/recommended</li></ul> |
| [`storybook/prefer-pascal-case`](./docs/rules/prefer-pascal-case.md) | Stories should use PascalCase | 🔧 | <ul><li>recommended</li><li>flat/recommended</li></ul> |
| [`storybook/story-exports`](./docs/rules/story-exports.md) | A story file must contain at least one story export | | <ul><li>recommended</li><li>flat/recommended</li><li>csf</li><li>flat/csf</li></ul> |
| [`storybook/use-storybook-expect`](./docs/rules/use-storybook-expect.md) | Use expect from `@storybook/jest` | 🔧 | <ul><li>addon-interactions</li><li>flat/addon-interactions</li><li>recommended</li><li>flat/recommended</li></ul> |
| [`storybook/use-storybook-expect`](./docs/rules/use-storybook-expect.md) | Use expect from `@storybook/test` or `@storybook/jest` | 🔧 | <ul><li>addon-interactions</li><li>flat/addon-interactions</li><li>recommended</li><li>flat/recommended</li></ul> |
| [`storybook/use-storybook-testing-library`](./docs/rules/use-storybook-testing-library.md) | Do not use testing-library directly on stories | 🔧 | <ul><li>addon-interactions</li><li>flat/addon-interactions</li><li>recommended</li><li>flat/recommended</li></ul> |

<!-- RULES-LIST:END -->
Expand Down
3 changes: 2 additions & 1 deletion lib/rules/no-uninstalled-addons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@ export = createStorybookRule({
const parsedFile = JSON.parse(file)
packageJson.dependencies = parsedFile.dependencies || {}
packageJson.devDependencies = parsedFile.devDependencies || {}
} catch (e) {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
} catch (err) {
throw new Error(
dedent`The provided path in your eslintrc.json - ${path} is not a valid path to a package.json file or your package.json file is not in the same folder as ESLint is running from.
Expand Down
1 change: 1 addition & 0 deletions lib/rules/prefer-pascal-case.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ export = createStorybookRule({
excludeStories: getDescriptor(meta, 'excludeStories'),
includeStories: getDescriptor(meta, 'includeStories'),
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
} catch (err) {
//
}
Expand Down
1 change: 1 addition & 0 deletions lib/rules/story-exports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ export = createStorybookRule({
excludeStories: getDescriptor(meta, 'excludeStories'),
includeStories: getDescriptor(meta, 'includeStories'),
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
} catch (err) {
//
}
Expand Down
2 changes: 0 additions & 2 deletions lib/rules/use-storybook-expect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,13 @@ export = createStorybookRule<TDefaultOptions, string>({
meta: {
type: 'suggestion',
fixable: 'code',
hasSuggestions: true,
schema: [],
docs: {
description: 'Use expect from `@storybook/test` or `@storybook/jest`',
categories: [CategoryId.ADDON_INTERACTIONS, CategoryId.RECOMMENDED],
recommended: 'strict',
},
messages: {
updateImports: 'Update imports',
useExpectFromStorybook:
'Do not use global expect directly in the story. You should import it from `@storybook/test` or `@storybook/jest` instead.',
},
Expand Down
4 changes: 3 additions & 1 deletion tests/integrations/flat-config.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ describe('Integration with flat config', () => {
cp.execSync('pnpm i -f', { stdio: 'inherit' })
})
afterEach(() => {
originalCwd && process.chdir(originalCwd)
if (originalCwd) {
process.chdir(originalCwd)
}
})

it('should work with config', () => {
Expand Down
4 changes: 3 additions & 1 deletion tests/integrations/legacy-config.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ describe('Integration with legacy config', () => {
cp.execSync('pnpm i -f', { stdio: 'inherit' })
})
afterEach(() => {
originalCwd && process.chdir(originalCwd)
if (originalCwd) {
process.chdir(originalCwd)
}
})

it('should work with config', () => {
Expand Down

0 comments on commit 8d281d4

Please sign in to comment.