Fix Storybook React runtime

This commit is contained in:
Koen Vlaswinkel
2024-01-05 11:09:53 +01:00
parent 50df8cd376
commit 38a3778fe1
4 changed files with 15 additions and 1 deletions

View File

@@ -182,5 +182,17 @@ module.exports = {
"@typescript-eslint/no-var-requires": "off", "@typescript-eslint/no-var-requires": "off",
}, },
}, },
{
files: [".storybook/**/*.tsx"],
parserOptions: {
project: resolve(__dirname, ".storybook/tsconfig.json"),
},
rules: {
...baseConfig.rules,
// Storybook doesn't use the automatic JSX runtime in the addon yet, so we need to allow
// `React` to be imported.
"import/no-namespace": ["error", { ignore: ["react"] }],
},
},
], ],
}; };

View File

@@ -5,7 +5,7 @@
"target": "es6", "target": "es6",
"outDir": "out", "outDir": "out",
"lib": ["ES2021", "dom"], "lib": ["ES2021", "dom"],
"jsx": "react-jsx", "jsx": "react",
"sourceMap": true, "sourceMap": true,
"rootDir": "..", "rootDir": "..",
"strict": true, "strict": true,

View File

@@ -1,3 +1,4 @@
import * as React from "react";
import { FunctionComponent, useCallback } from "react"; import { FunctionComponent, useCallback } from "react";
import { useGlobals } from "@storybook/manager-api"; import { useGlobals } from "@storybook/manager-api";

View File

@@ -1,3 +1,4 @@
import * as React from "react";
import { addons, types } from "@storybook/manager-api"; import { addons, types } from "@storybook/manager-api";
import { ThemeSelector } from "./ThemeSelector"; import { ThemeSelector } from "./ThemeSelector";