diff --git a/.eslintrc.js b/.eslintrc.js index f8754089..a7f0fcf8 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -26,11 +26,9 @@ module.exports = { es6: true, }, parserOptions: { + project: './tsconfig.json', ecmaVersion: 2018, sourceType: 'module', - ecmaFeatures: { - jsx: true, - }, }, rules: { eqeqeq: 'error', @@ -92,8 +90,9 @@ module.exports = { pathGroupsExcludedImportTypes: ['builtin'], }, ], - 'react/jsx-uses-react': 'off', - 'react/react-in-jsx-scope': 'off', + // Disable it until we start supporting `react-jsx` again. + // 'react/jsx-uses-react': 'off', + // 'react/react-in-jsx-scope': 'off', 'sort-imports': [ 'error', { diff --git a/src/DevTools/DevTools.tsx b/src/DevTools/DevTools.tsx index b9bf0ee2..52ded998 100644 --- a/src/DevTools/DevTools.tsx +++ b/src/DevTools/DevTools.tsx @@ -1,4 +1,4 @@ -import { StrictMode, useEffect, useState } from 'react'; +import * as React from 'react'; import { ColorScheme, ColorSchemeProvider, @@ -53,17 +53,18 @@ const DevTools_ = ({ theme: userColorScheme = 'light', options, }: DevToolsProps): JSX.Element => { - const [colorScheme, setColorScheme] = useState(userColorScheme); + const [colorScheme, setColorScheme] = + React.useState(userColorScheme); const setDevToolsOptions = useSetDevToolsOptions(); const toggleColorScheme = (value?: ColorScheme) => setColorScheme(value || (colorScheme === 'dark' ? 'light' : 'dark')); - useEffect(() => { + React.useEffect(() => { setColorScheme(userColorScheme); }, [userColorScheme]); - useEffect(() => { + React.useEffect(() => { // Should we consider caching these options in the future instead of allowing users to change these? setDevToolsOptions(options); }, [setDevToolsOptions, options]); @@ -74,7 +75,7 @@ const DevTools_ = ({ }; return ( - + - + ); }; diff --git a/src/DevTools/Extension/Extension.tsx b/src/DevTools/Extension/Extension.tsx index d4fa7a65..4b872be0 100644 --- a/src/DevTools/Extension/Extension.tsx +++ b/src/DevTools/Extension/Extension.tsx @@ -1,4 +1,4 @@ -import { forwardRef, useEffect } from 'react'; +import * as React from 'react'; import { ActionIcon, Sx } from '@mantine/core'; import { useAtom, useSetAtom } from 'jotai/react'; import { Store } from 'src/types'; @@ -23,7 +23,7 @@ const shellTriggerButtonStyles: Sx = () => ({ }, }); -const ShellTriggerButton = forwardRef((_, ref) => { +const ShellTriggerButton = React.forwardRef((_, ref) => { const setIsShellOpen = useSetAtom(isShellOpenAtom, devtoolsJotaiStoreOptions); return ( @@ -55,7 +55,7 @@ export const Extension = ({ useDevtoolsJotaiStoreOptions(), ); - useEffect(() => { + React.useEffect(() => { // Avoid setting the initial value if the value is found in the local storage if (typeof isShellOpen !== 'boolean') { setIsShellOpen(isInitialOpen); diff --git a/src/DevTools/Extension/components/Shell/Shell.tsx b/src/DevTools/Extension/components/Shell/Shell.tsx index cef90279..a5d94c5a 100644 --- a/src/DevTools/Extension/components/Shell/Shell.tsx +++ b/src/DevTools/Extension/components/Shell/Shell.tsx @@ -1,4 +1,4 @@ -import { useEffect, useRef } from 'react'; +import React, { useEffect, useRef } from 'react'; import { Tabs } from '@mantine/core'; import { useAtomValue } from 'jotai/react'; import { Store } from 'src/types'; diff --git a/src/stories/Default/Demos/Random.tsx b/src/stories/Default/Demos/Random.tsx index a4c49cff..5c7e67ac 100644 --- a/src/stories/Default/Demos/Random.tsx +++ b/src/stories/Default/Demos/Random.tsx @@ -36,8 +36,8 @@ export const Random = () => { // We're not displaying these values on the UI // eslint-disable-next-line @typescript-eslint/no-unused-vars const nestedObject = useAtomValue(nestedObjectAtom, demoStoreOptions); - const text = useAtomValue(textAtom, demoStoreOptions); - const bigint = useAtomValue(bigintAtom, demoStoreOptions); + const _text = useAtomValue(textAtom, demoStoreOptions); + const _bigint = useAtomValue(bigintAtom, demoStoreOptions); // const circular = useAtomValue(circularAtom, demoStoreOptions); // console.log(circular); // eslint-disable-next-line @typescript-eslint/no-unused-vars diff --git a/tsconfig.build.json b/tsconfig.build.json index f02e74b6..930909a6 100644 --- a/tsconfig.build.json +++ b/tsconfig.build.json @@ -2,7 +2,7 @@ "compilerOptions": { "strict": true, "target": "ESNext", - "jsx": "react-jsx", + "jsx": "react", "module": "es2015", "downlevelIteration": true, "esModuleInterop": true, diff --git a/tsup.config.ts b/tsup.config.ts index 12e75752..8c7a4c44 100644 --- a/tsup.config.ts +++ b/tsup.config.ts @@ -26,7 +26,7 @@ const baseConfig: Options = { splitting: true, tsconfig: './tsconfig.build.json', dts: true, - external: ['jotai', 'React'], + external: ['jotai', 'react', 'react-dom'], platform: 'node', outExtension: defaultOutExtension, esbuildPlugins: defaultEsBuildPlugins,