Skip to content

Commit 4048f9c

Browse files
committed
feat: use flat version of eslint-plugin-storybook, export plugin storybook and next
1 parent 8f333be commit 4048f9c

File tree

3 files changed

+117
-294
lines changed

3 files changed

+117
-294
lines changed

packages/eslint-config/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
"eslint-plugin-react": "7.37.2",
4646
"eslint-plugin-react-compiler": "0.0.0-experimental-fa06e2c-20241016",
4747
"eslint-plugin-react-hooks": "5.0.0",
48-
"eslint-plugin-storybook": "0.10.1",
48+
"eslint-plugin-storybook": "0.11.0",
4949
"globals": "15.11.0",
5050
"typescript-eslint": "8.12.1"
5151
},

packages/eslint-config/src/config.ts

+8-7
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ import globals from "globals";
1818
// @ts-expect-error no types for this
1919
import pluginJsxA11y from "eslint-plugin-jsx-a11y";
2020
// @ts-expect-error no types for this
21-
import PluginNext from "@next/eslint-plugin-next";
21+
import pluginNext from "@next/eslint-plugin-next";
22+
import pluginStorybook from 'eslint-plugin-storybook'
2223

2324
// re-export
2425
export {
@@ -34,6 +35,8 @@ export {
3435
pluginReactHooks,
3536
pluginTypescriptEslint,
3637
pluginJsxA11y,
38+
pluginNext,
39+
pluginStorybook,
3740
};
3841

3942
const flatCompat = new eslintrc.FlatCompat();
@@ -123,7 +126,7 @@ export const react = () => [
123126
'jsx-a11y': pluginJsxA11y,
124127
},
125128
rules: {
126-
...pluginReact.configs.flat.recommended.rules as Linter.RulesRecord,
129+
...pluginReact.configs.flat!.recommended.rules as Linter.RulesRecord,
127130
"react/self-closing-comp": "error",
128131
"react/react-in-jsx-scope": "off",
129132
"react/jsx-no-target-blank": "off",
@@ -159,10 +162,10 @@ export const react = () => [
159162
] satisfies Linter.Config[];
160163

161164
/**
162-
* NOTE: eslint-plugin-nextがv9対応していないが@next/eslint-plugin-nextを利用して回避する
165+
* NOTE: eslint-plugin-nextのリリースが頻繁ではないので@next/eslint-plugin-nextを利用して回避する
163166
*/
164167
export const nextJs = () => {
165-
const patchedPluginNext = compat.fixupPluginRules(PluginNext);
168+
const patchedPluginNext = compat.fixupPluginRules(pluginNext);
166169

167170
return [
168171
// ...compat.fixupConfigRules(
@@ -182,9 +185,7 @@ export const nextJs = () => {
182185
};
183186

184187
export const storybook = () => [
185-
...compat.fixupConfigRules(
186-
flatCompat.extends("plugin:storybook/recommended")
187-
),
188+
...pluginStorybook.configs['flat/recommended'],
188189
];
189190

190191
export const imports = () => [

0 commit comments

Comments
 (0)