Skip to content

Commit

Permalink
chore: restore React 16 support
Browse files Browse the repository at this point in the history
This restores importing React and the ESLint rule react/react-in-jsx-scope to preserve React 16 compatibility.

This also moves some types around so themes can be exported as a standalone with its own TypeScript config.
  • Loading branch information
WesSouza authored and arturbien committed Aug 5, 2022
1 parent 2eac4e8 commit 64aee8b
Show file tree
Hide file tree
Showing 128 changed files with 240 additions and 174 deletions.
6 changes: 4 additions & 2 deletions .codesandbox/ci.json
@@ -1,5 +1,7 @@
{
"installCommand": "install:codesandbox",
"buildCommand": "build:prod",
"sandboxes": ["react95-template-xkfj0"]
"node": "16",
"sandboxes": [
"react95-template-xkfj0"
]
}
1 change: 0 additions & 1 deletion .eslintrc.js
Expand Up @@ -43,7 +43,6 @@ module.exports = {
'react/jsx-props-no-spreading': 'off',
'react/no-array-index-key': 'off',
'react/prop-types': 'off',
'react/react-in-jsx-scope': 'off',
'react/require-default-props': 'off',
'react/static-property-placement': ['error', 'static public field']
},
Expand Down
1 change: 0 additions & 1 deletion package.json
Expand Up @@ -46,7 +46,6 @@
"lint": "eslint --ext .js,.ts,.tsx src",
"lint:fix": "yarn run lint --fix",
"semantic-release": "semantic-release",
"install:codesandbox": "yarn --ignore-engines",
"cz": "git-cz"
},
"peerDependencies": {
Expand Down
2 changes: 2 additions & 0 deletions src/Anchor/Anchor.spec.tsx
@@ -1,3 +1,5 @@
import React from 'react';

import { render } from '@testing-library/react';

import { Anchor } from './Anchor';
Expand Down
1 change: 1 addition & 0 deletions src/Anchor/Anchor.stories.tsx
@@ -1,4 +1,5 @@
import { ComponentMeta } from '@storybook/react';
import React from 'react';
import styled from 'styled-components';

import { Anchor } from './Anchor';
Expand Down
1 change: 1 addition & 0 deletions src/AppBar/AppBar.spec.tsx
@@ -1,4 +1,5 @@
import { render } from '@testing-library/react';
import React from 'react';

import { AppBar } from './AppBar';

Expand Down
14 changes: 7 additions & 7 deletions src/AppBar/AppBar.stories.tsx
@@ -1,15 +1,15 @@
import React from 'react';
import styled from 'styled-components';
import { ComponentMeta } from '@storybook/react';
import React, { useState } from 'react';
import {
AppBar,
Toolbar,
TextField,
Button,
Divider,
List,
ListItem,
Divider
TextField,
Toolbar
} from 'react95';
import { ComponentMeta } from '@storybook/react';
import styled from 'styled-components';
import logoIMG from '../assets/images/logo.png';

const Wrapper = styled.div`
Expand All @@ -24,7 +24,7 @@ export default {
} as ComponentMeta<typeof AppBar>;

export function Default() {
const [open, setOpen] = React.useState(false);
const [open, setOpen] = useState(false);

return (
<AppBar>
Expand Down
1 change: 1 addition & 0 deletions src/Avatar/Avatar.spec.tsx
@@ -1,4 +1,5 @@
import { render } from '@testing-library/react';
import React from 'react';

import { renderWithTheme, theme } from '../../test/utils';

Expand Down
1 change: 1 addition & 0 deletions src/Avatar/Avatar.stories.tsx
@@ -1,4 +1,5 @@
import { ComponentMeta } from '@storybook/react';
import React from 'react';
import { Avatar } from 'react95';
import styled from 'styled-components';

Expand Down
2 changes: 2 additions & 0 deletions src/Bar/Bar.spec.tsx
@@ -1,3 +1,5 @@
import React from 'react';

import { renderWithTheme } from '../../test/utils';

import { Bar } from './Bar';
Expand Down
1 change: 1 addition & 0 deletions src/Bar/Bar.stories.tsx
@@ -1,4 +1,5 @@
import { ComponentMeta } from '@storybook/react';
import React from 'react';
import { AppBar, Bar, Button, Toolbar } from 'react95';
import styled from 'styled-components';

Expand Down
3 changes: 2 additions & 1 deletion src/Button/Button.spec.tsx
@@ -1,4 +1,5 @@
import { render, fireEvent } from '@testing-library/react';
import { fireEvent, render } from '@testing-library/react';
import React from 'react';

import { renderWithTheme, theme } from '../../test/utils';
import { blockSizes } from '../common/system';
Expand Down
2 changes: 1 addition & 1 deletion src/Button/Button.stories.tsx
@@ -1,5 +1,5 @@
import { ComponentMeta } from '@storybook/react';
import { useState } from 'react';
import React, { useState } from 'react';
import {
Button,
Cutout,
Expand Down
2 changes: 2 additions & 0 deletions src/Checkbox/Checkbox.spec.tsx
@@ -1,3 +1,5 @@
import React from 'react';

import { renderWithTheme } from '../../test/utils';
import { Checkbox } from './Checkbox';

Expand Down
1 change: 1 addition & 0 deletions src/ColorInput/ColorInput.spec.tsx
@@ -1,4 +1,5 @@
import { fireEvent } from '@testing-library/react';
import React from 'react';
import { renderWithTheme } from '../../test/utils';
import { ColorInput } from './ColorInput';

Expand Down
1 change: 1 addition & 0 deletions src/ColorInput/ColorInput.stories.tsx
@@ -1,4 +1,5 @@
import { ComponentMeta } from '@storybook/react';
import React from 'react';
import styled from 'styled-components';

import { ColorInput, Cutout } from 'react95';
Expand Down
1 change: 1 addition & 0 deletions src/Counter/Counter.spec.tsx
@@ -1,4 +1,5 @@
import React from 'react';

import { renderWithTheme } from '../../test/utils';

import { Counter } from './Counter';
Expand Down
2 changes: 1 addition & 1 deletion src/Counter/Counter.stories.tsx
@@ -1,5 +1,5 @@
import { ComponentMeta } from '@storybook/react';
import { useState } from 'react';
import React, { useState } from 'react';
import { Button, Counter, Panel } from 'react95';
import styled from 'styled-components';

Expand Down
1 change: 1 addition & 0 deletions src/Cutout/Cutout.spec.tsx
@@ -1,4 +1,5 @@
import { render } from '@testing-library/react';
import React from 'react';

import { Cutout } from './Cutout';

Expand Down
1 change: 1 addition & 0 deletions src/Cutout/Cutout.stories.tsx
@@ -1,4 +1,5 @@
import { ComponentMeta } from '@storybook/react';
import React from 'react';
import { Cutout, Window, WindowContent } from 'react95';
import styled from 'styled-components';

Expand Down
1 change: 1 addition & 0 deletions src/DatePicker/DatePicker.stories.tsx
@@ -1,5 +1,6 @@
/* eslint-disable camelcase, react/jsx-pascal-case */
import { ComponentMeta } from '@storybook/react';
import React from 'react';
import { DatePicker__UNSTABLE } from 'react95';
import styled from 'styled-components';

Expand Down
2 changes: 1 addition & 1 deletion src/DatePicker/DatePicker.tsx
@@ -1,4 +1,4 @@
import { forwardRef, useCallback, useMemo, useState } from 'react';
import React, { forwardRef, useCallback, useMemo, useState } from 'react';
import styled from 'styled-components';

import { Button } from '../Button/Button';
Expand Down
1 change: 1 addition & 0 deletions src/Desktop/Desktop.spec.tsx
@@ -1,4 +1,5 @@
import React from 'react';

import { renderWithTheme } from '../../test/utils';

import { Desktop } from './Desktop';
Expand Down
6 changes: 3 additions & 3 deletions src/Desktop/Desktop.stories.tsx
@@ -1,7 +1,7 @@
import styled from 'styled-components';

import { Desktop } from 'react95';
import { ComponentMeta } from '@storybook/react';
import React from 'react';
import { Desktop } from 'react95';
import styled from 'styled-components';

const Wrapper = styled.div`
padding: 5rem;
Expand Down
2 changes: 2 additions & 0 deletions src/Divider/Divider.spec.tsx
@@ -1,3 +1,5 @@
import React from 'react';

import { renderWithTheme } from '../../test/utils';

import { Divider } from './Divider';
Expand Down
1 change: 1 addition & 0 deletions src/Divider/Divider.stories.tsx
@@ -1,4 +1,5 @@
import { ComponentMeta } from '@storybook/react';
import React from 'react';
import styled from 'styled-components';

import { Divider, List, ListItem } from 'react95';
Expand Down
2 changes: 2 additions & 0 deletions src/Fieldset/Fieldset.spec.tsx
@@ -1,3 +1,5 @@
import React from 'react';

import { renderWithTheme, theme } from '../../test/utils';

import { Fieldset } from './Fieldset';
Expand Down
2 changes: 1 addition & 1 deletion src/Fieldset/Fieldset.stories.tsx
@@ -1,5 +1,5 @@
import { ComponentMeta } from '@storybook/react';
import { useState } from 'react';
import React, { useState } from 'react';
import { Checkbox, Cutout, Fieldset, Window, WindowContent } from 'react95';
import styled from 'styled-components';

Expand Down
6 changes: 3 additions & 3 deletions src/Hourglass/Hourglass.stories.tsx
@@ -1,7 +1,7 @@
import styled from 'styled-components';

import { Hourglass } from 'react95';
import { ComponentMeta } from '@storybook/react';
import React from 'react';
import { Hourglass } from 'react95';
import styled from 'styled-components';

const Wrapper = styled.div`
padding: 5rem;
Expand Down
2 changes: 1 addition & 1 deletion src/Hourglass/Hourglass.tsx
@@ -1,4 +1,4 @@
import { forwardRef } from 'react';
import React, { forwardRef } from 'react';
import styled from 'styled-components';
import { getSize } from '../common/utils';
import base64hourglass from './base64hourglass';
Expand Down
2 changes: 2 additions & 0 deletions src/List/List.spec.tsx
@@ -1,3 +1,5 @@
import React from 'react';

import { renderWithTheme } from '../../test/utils';

import { List } from './List';
Expand Down
3 changes: 2 additions & 1 deletion src/List/List.stories.tsx
@@ -1,7 +1,8 @@
import { ComponentMeta } from '@storybook/react';
import React from 'react';
import styled from 'styled-components';

import { List, ListItem, Bar, Divider } from 'react95';
import { Bar, Divider, List, ListItem } from 'react95';

const Wrapper = styled.div`
padding: 5rem;
Expand Down
2 changes: 2 additions & 0 deletions src/ListItem/ListItem.spec.tsx
@@ -1,3 +1,5 @@
import React from 'react';

import { renderWithTheme, theme } from '../../test/utils';
import { blockSizes } from '../common/system';
import { ListItem } from './ListItem';
Expand Down
2 changes: 2 additions & 0 deletions src/LoadingIndicator/LoadingIndicator.spec.tsx
@@ -1,3 +1,5 @@
import React from 'react';

import { renderWithTheme } from '../../test/utils';
import { LoadingIndicator } from './LoadingIndicator';

Expand Down
1 change: 1 addition & 0 deletions src/LoadingIndicator/LoadingIndicator.stories.tsx
@@ -1,4 +1,5 @@
import { ComponentMeta } from '@storybook/react';
import React from 'react';
import styled from 'styled-components';

import { LoadingIndicator } from 'react95';
Expand Down
1 change: 1 addition & 0 deletions src/NumberField/NumberField.spec.tsx
@@ -1,4 +1,5 @@
import { fireEvent } from '@testing-library/react';
import React from 'react';

import { renderWithTheme } from '../../test/utils';
import { NumberField } from './NumberField';
Expand Down
1 change: 1 addition & 0 deletions src/NumberField/NumberField.stories.tsx
@@ -1,4 +1,5 @@
import { ComponentMeta } from '@storybook/react';
import React from 'react';
import { Cutout, NumberField } from 'react95';
import styled from 'styled-components';

Expand Down
1 change: 1 addition & 0 deletions src/Panel/Panel.spec.tsx
@@ -1,4 +1,5 @@
import { render } from '@testing-library/react';
import React from 'react';

import { Panel } from './Panel';

Expand Down
1 change: 1 addition & 0 deletions src/Panel/Panel.stories.tsx
@@ -1,4 +1,5 @@
import { ComponentMeta } from '@storybook/react';
import React from 'react';
import { Panel } from 'react95';
import styled from 'styled-components';

Expand Down
2 changes: 2 additions & 0 deletions src/Progress/Progress.spec.tsx
@@ -1,3 +1,5 @@
import React from 'react';

import { renderWithTheme } from '../../test/utils';
import { Progress } from './Progress';

Expand Down
2 changes: 1 addition & 1 deletion src/Progress/Progress.stories.tsx
@@ -1,5 +1,5 @@
import { ComponentMeta } from '@storybook/react';
import { useEffect, useState } from 'react';
import React, { useEffect, useState } from 'react';
import { Progress } from 'react95';
import styled from 'styled-components';

Expand Down
2 changes: 2 additions & 0 deletions src/Radio/Radio.spec.tsx
@@ -1,3 +1,5 @@
import React from 'react';

import { renderWithTheme } from '../../test/utils';
import { Radio } from './Radio';

Expand Down
1 change: 1 addition & 0 deletions src/Select/Select.stories.tsx
@@ -1,6 +1,7 @@
/* eslint-disable no-console */

import { ComponentMeta } from '@storybook/react';
import React from 'react';
import { Cutout, Fieldset, Select, Window, WindowContent } from 'react95';
import styled from 'styled-components';
import { SelectChangeEvent, SelectOption } from './Select.types';
Expand Down
2 changes: 1 addition & 1 deletion src/Slider/Slider.spec.tsx
@@ -1,6 +1,6 @@
// Pretty much straight out copied from https://github.com/mui-org/material-ui 馃槀

import { fireEvent } from '@testing-library/react';
import React from 'react';

import { renderWithTheme, Touch } from '../../test/utils';
import { Slider } from './Slider';
Expand Down
1 change: 1 addition & 0 deletions src/Slider/Slider.stories.tsx
@@ -1,4 +1,5 @@
import { ComponentMeta } from '@storybook/react';
import React from 'react';
import { Cutout, Slider } from 'react95';
import styled from 'styled-components';

Expand Down
4 changes: 2 additions & 2 deletions src/Slider/Slider.tsx
Expand Up @@ -187,10 +187,10 @@ const sharedGrooveStyles = () => css<StyledSliderProps>`
width: 100%;
`}
`;
const StyledGroove = styled(StyledCutout)`
const StyledGroove = styled(StyledCutout)<StyledSliderProps>`
${sharedGrooveStyles()}
`;
const StyledFlatGroove = styled(StyledCutout)`
const StyledFlatGroove = styled(StyledCutout)<StyledSliderProps>`
${sharedGrooveStyles()}
border-left-color: ${({ theme }) => theme.flatLight};
Expand Down
2 changes: 2 additions & 0 deletions src/Tab/Tab.spec.tsx
@@ -1,3 +1,5 @@
import React from 'react';

import { renderWithTheme } from '../../test/utils';
import { Tab } from './Tab';

Expand Down
2 changes: 2 additions & 0 deletions src/TabBody/TabBody.spec.tsx
@@ -1,3 +1,5 @@
import React from 'react';

import { renderWithTheme } from '../../test/utils';
import { TabBody } from './TabBody';

Expand Down
2 changes: 2 additions & 0 deletions src/Table/Table.spec.tsx
@@ -1,3 +1,5 @@
import React from 'react';

import { renderWithTheme } from '../../test/utils';

import { Table } from './Table';
Expand Down
1 change: 1 addition & 0 deletions src/Table/Table.stories.tsx
@@ -1,4 +1,5 @@
import { ComponentMeta } from '@storybook/react';
import React from 'react';
import {
Table,
TableBody,
Expand Down
3 changes: 2 additions & 1 deletion src/Tabs/Tabs.spec.tsx
@@ -1,7 +1,8 @@
import { fireEvent } from '@testing-library/react';
import React from 'react';

import { renderWithTheme } from '../../test/utils';
import { Tab } from '..';
import { renderWithTheme } from '../../test/utils';
import { Tabs } from './Tabs';

describe('<Tabs />', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/Tabs/Tabs.stories.tsx
@@ -1,5 +1,5 @@
import { ComponentMeta } from '@storybook/react';
import { useState } from 'react';
import React, { useState } from 'react';
import {
Anchor,
Checkbox,
Expand Down
2 changes: 1 addition & 1 deletion src/TextField/TextField.stories.tsx
@@ -1,5 +1,5 @@
import { ComponentMeta } from '@storybook/react';
import { useState } from 'react';
import React, { useState } from 'react';
import { Button, Cutout, TextField } from 'react95';
import styled from 'styled-components';

Expand Down
1 change: 1 addition & 0 deletions src/Toolbar/Toolbar.spec.tsx
@@ -1,4 +1,5 @@
import { render } from '@testing-library/react';
import React from 'react';

import { Toolbar } from './Toolbar';

Expand Down
1 change: 1 addition & 0 deletions src/Tooltip/Tooltip.spec.tsx
@@ -1,4 +1,5 @@
import { fireEvent, render, waitFor } from '@testing-library/react';
import React from 'react';

import { Tooltip, TooltipProps } from './Tooltip';

Expand Down

0 comments on commit 64aee8b

Please sign in to comment.