Skip to content

Commit 64aee8b

Browse files
WesSouzaarturbien
authored andcommitted
chore: restore React 16 support
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.
1 parent 2eac4e8 commit 64aee8b

File tree

128 files changed

+240
-174
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

128 files changed

+240
-174
lines changed

.codesandbox/ci.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
{
2-
"installCommand": "install:codesandbox",
32
"buildCommand": "build:prod",
4-
"sandboxes": ["react95-template-xkfj0"]
3+
"node": "16",
4+
"sandboxes": [
5+
"react95-template-xkfj0"
6+
]
57
}

.eslintrc.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ module.exports = {
4343
'react/jsx-props-no-spreading': 'off',
4444
'react/no-array-index-key': 'off',
4545
'react/prop-types': 'off',
46-
'react/react-in-jsx-scope': 'off',
4746
'react/require-default-props': 'off',
4847
'react/static-property-placement': ['error', 'static public field']
4948
},

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
"lint": "eslint --ext .js,.ts,.tsx src",
4747
"lint:fix": "yarn run lint --fix",
4848
"semantic-release": "semantic-release",
49-
"install:codesandbox": "yarn --ignore-engines",
5049
"cz": "git-cz"
5150
},
5251
"peerDependencies": {

src/Anchor/Anchor.spec.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import React from 'react';
2+
13
import { render } from '@testing-library/react';
24

35
import { Anchor } from './Anchor';

src/Anchor/Anchor.stories.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { ComponentMeta } from '@storybook/react';
2+
import React from 'react';
23
import styled from 'styled-components';
34

45
import { Anchor } from './Anchor';

src/AppBar/AppBar.spec.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { render } from '@testing-library/react';
2+
import React from 'react';
23

34
import { AppBar } from './AppBar';
45

src/AppBar/AppBar.stories.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
import React from 'react';
2-
import styled from 'styled-components';
1+
import { ComponentMeta } from '@storybook/react';
2+
import React, { useState } from 'react';
33
import {
44
AppBar,
5-
Toolbar,
6-
TextField,
75
Button,
6+
Divider,
87
List,
98
ListItem,
10-
Divider
9+
TextField,
10+
Toolbar
1111
} from 'react95';
12-
import { ComponentMeta } from '@storybook/react';
12+
import styled from 'styled-components';
1313
import logoIMG from '../assets/images/logo.png';
1414

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

2626
export function Default() {
27-
const [open, setOpen] = React.useState(false);
27+
const [open, setOpen] = useState(false);
2828

2929
return (
3030
<AppBar>

src/Avatar/Avatar.spec.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { render } from '@testing-library/react';
2+
import React from 'react';
23

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

src/Avatar/Avatar.stories.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { ComponentMeta } from '@storybook/react';
2+
import React from 'react';
23
import { Avatar } from 'react95';
34
import styled from 'styled-components';
45

src/Bar/Bar.spec.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import React from 'react';
2+
13
import { renderWithTheme } from '../../test/utils';
24

35
import { Bar } from './Bar';

src/Bar/Bar.stories.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { ComponentMeta } from '@storybook/react';
2+
import React from 'react';
23
import { AppBar, Bar, Button, Toolbar } from 'react95';
34
import styled from 'styled-components';
45

src/Button/Button.spec.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { render, fireEvent } from '@testing-library/react';
1+
import { fireEvent, render } from '@testing-library/react';
2+
import React from 'react';
23

34
import { renderWithTheme, theme } from '../../test/utils';
45
import { blockSizes } from '../common/system';

src/Button/Button.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { ComponentMeta } from '@storybook/react';
2-
import { useState } from 'react';
2+
import React, { useState } from 'react';
33
import {
44
Button,
55
Cutout,

src/Checkbox/Checkbox.spec.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import React from 'react';
2+
13
import { renderWithTheme } from '../../test/utils';
24
import { Checkbox } from './Checkbox';
35

src/ColorInput/ColorInput.spec.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { fireEvent } from '@testing-library/react';
2+
import React from 'react';
23
import { renderWithTheme } from '../../test/utils';
34
import { ColorInput } from './ColorInput';
45

src/ColorInput/ColorInput.stories.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { ComponentMeta } from '@storybook/react';
2+
import React from 'react';
23
import styled from 'styled-components';
34

45
import { ColorInput, Cutout } from 'react95';

src/Counter/Counter.spec.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React from 'react';
2+
23
import { renderWithTheme } from '../../test/utils';
34

45
import { Counter } from './Counter';

src/Counter/Counter.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { ComponentMeta } from '@storybook/react';
2-
import { useState } from 'react';
2+
import React, { useState } from 'react';
33
import { Button, Counter, Panel } from 'react95';
44
import styled from 'styled-components';
55

src/Cutout/Cutout.spec.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { render } from '@testing-library/react';
2+
import React from 'react';
23

34
import { Cutout } from './Cutout';
45

src/Cutout/Cutout.stories.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { ComponentMeta } from '@storybook/react';
2+
import React from 'react';
23
import { Cutout, Window, WindowContent } from 'react95';
34
import styled from 'styled-components';
45

src/DatePicker/DatePicker.stories.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/* eslint-disable camelcase, react/jsx-pascal-case */
22
import { ComponentMeta } from '@storybook/react';
3+
import React from 'react';
34
import { DatePicker__UNSTABLE } from 'react95';
45
import styled from 'styled-components';
56

src/DatePicker/DatePicker.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { forwardRef, useCallback, useMemo, useState } from 'react';
1+
import React, { forwardRef, useCallback, useMemo, useState } from 'react';
22
import styled from 'styled-components';
33

44
import { Button } from '../Button/Button';

src/Desktop/Desktop.spec.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React from 'react';
2+
23
import { renderWithTheme } from '../../test/utils';
34

45
import { Desktop } from './Desktop';

src/Desktop/Desktop.stories.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import styled from 'styled-components';
2-
3-
import { Desktop } from 'react95';
41
import { ComponentMeta } from '@storybook/react';
2+
import React from 'react';
3+
import { Desktop } from 'react95';
4+
import styled from 'styled-components';
55

66
const Wrapper = styled.div`
77
padding: 5rem;

src/Divider/Divider.spec.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import React from 'react';
2+
13
import { renderWithTheme } from '../../test/utils';
24

35
import { Divider } from './Divider';

src/Divider/Divider.stories.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { ComponentMeta } from '@storybook/react';
2+
import React from 'react';
23
import styled from 'styled-components';
34

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

src/Fieldset/Fieldset.spec.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import React from 'react';
2+
13
import { renderWithTheme, theme } from '../../test/utils';
24

35
import { Fieldset } from './Fieldset';

src/Fieldset/Fieldset.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { ComponentMeta } from '@storybook/react';
2-
import { useState } from 'react';
2+
import React, { useState } from 'react';
33
import { Checkbox, Cutout, Fieldset, Window, WindowContent } from 'react95';
44
import styled from 'styled-components';
55

src/Hourglass/Hourglass.stories.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import styled from 'styled-components';
2-
3-
import { Hourglass } from 'react95';
41
import { ComponentMeta } from '@storybook/react';
2+
import React from 'react';
3+
import { Hourglass } from 'react95';
4+
import styled from 'styled-components';
55

66
const Wrapper = styled.div`
77
padding: 5rem;

src/Hourglass/Hourglass.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { forwardRef } from 'react';
1+
import React, { forwardRef } from 'react';
22
import styled from 'styled-components';
33
import { getSize } from '../common/utils';
44
import base64hourglass from './base64hourglass';

src/List/List.spec.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import React from 'react';
2+
13
import { renderWithTheme } from '../../test/utils';
24

35
import { List } from './List';

src/List/List.stories.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { ComponentMeta } from '@storybook/react';
2+
import React from 'react';
23
import styled from 'styled-components';
34

4-
import { List, ListItem, Bar, Divider } from 'react95';
5+
import { Bar, Divider, List, ListItem } from 'react95';
56

67
const Wrapper = styled.div`
78
padding: 5rem;

src/ListItem/ListItem.spec.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import React from 'react';
2+
13
import { renderWithTheme, theme } from '../../test/utils';
24
import { blockSizes } from '../common/system';
35
import { ListItem } from './ListItem';

src/LoadingIndicator/LoadingIndicator.spec.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import React from 'react';
2+
13
import { renderWithTheme } from '../../test/utils';
24
import { LoadingIndicator } from './LoadingIndicator';
35

src/LoadingIndicator/LoadingIndicator.stories.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { ComponentMeta } from '@storybook/react';
2+
import React from 'react';
23
import styled from 'styled-components';
34

45
import { LoadingIndicator } from 'react95';

src/NumberField/NumberField.spec.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { fireEvent } from '@testing-library/react';
2+
import React from 'react';
23

34
import { renderWithTheme } from '../../test/utils';
45
import { NumberField } from './NumberField';

src/NumberField/NumberField.stories.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { ComponentMeta } from '@storybook/react';
2+
import React from 'react';
23
import { Cutout, NumberField } from 'react95';
34
import styled from 'styled-components';
45

src/Panel/Panel.spec.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { render } from '@testing-library/react';
2+
import React from 'react';
23

34
import { Panel } from './Panel';
45

src/Panel/Panel.stories.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { ComponentMeta } from '@storybook/react';
2+
import React from 'react';
23
import { Panel } from 'react95';
34
import styled from 'styled-components';
45

src/Progress/Progress.spec.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import React from 'react';
2+
13
import { renderWithTheme } from '../../test/utils';
24
import { Progress } from './Progress';
35

src/Progress/Progress.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { ComponentMeta } from '@storybook/react';
2-
import { useEffect, useState } from 'react';
2+
import React, { useEffect, useState } from 'react';
33
import { Progress } from 'react95';
44
import styled from 'styled-components';
55

src/Radio/Radio.spec.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import React from 'react';
2+
13
import { renderWithTheme } from '../../test/utils';
24
import { Radio } from './Radio';
35

src/Select/Select.stories.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/* eslint-disable no-console */
22

33
import { ComponentMeta } from '@storybook/react';
4+
import React from 'react';
45
import { Cutout, Fieldset, Select, Window, WindowContent } from 'react95';
56
import styled from 'styled-components';
67
import { SelectChangeEvent, SelectOption } from './Select.types';

src/Slider/Slider.spec.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Pretty much straight out copied from https://github.com/mui-org/material-ui 😂
2-
32
import { fireEvent } from '@testing-library/react';
3+
import React from 'react';
44

55
import { renderWithTheme, Touch } from '../../test/utils';
66
import { Slider } from './Slider';

src/Slider/Slider.stories.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { ComponentMeta } from '@storybook/react';
2+
import React from 'react';
23
import { Cutout, Slider } from 'react95';
34
import styled from 'styled-components';
45

src/Slider/Slider.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,10 +187,10 @@ const sharedGrooveStyles = () => css<StyledSliderProps>`
187187
width: 100%;
188188
`}
189189
`;
190-
const StyledGroove = styled(StyledCutout)`
190+
const StyledGroove = styled(StyledCutout)<StyledSliderProps>`
191191
${sharedGrooveStyles()}
192192
`;
193-
const StyledFlatGroove = styled(StyledCutout)`
193+
const StyledFlatGroove = styled(StyledCutout)<StyledSliderProps>`
194194
${sharedGrooveStyles()}
195195
196196
border-left-color: ${({ theme }) => theme.flatLight};

src/Tab/Tab.spec.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import React from 'react';
2+
13
import { renderWithTheme } from '../../test/utils';
24
import { Tab } from './Tab';
35

src/TabBody/TabBody.spec.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import React from 'react';
2+
13
import { renderWithTheme } from '../../test/utils';
24
import { TabBody } from './TabBody';
35

src/Table/Table.spec.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import React from 'react';
2+
13
import { renderWithTheme } from '../../test/utils';
24

35
import { Table } from './Table';

src/Table/Table.stories.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { ComponentMeta } from '@storybook/react';
2+
import React from 'react';
23
import {
34
Table,
45
TableBody,

src/Tabs/Tabs.spec.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { fireEvent } from '@testing-library/react';
2+
import React from 'react';
23

3-
import { renderWithTheme } from '../../test/utils';
44
import { Tab } from '..';
5+
import { renderWithTheme } from '../../test/utils';
56
import { Tabs } from './Tabs';
67

78
describe('<Tabs />', () => {

src/Tabs/Tabs.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { ComponentMeta } from '@storybook/react';
2-
import { useState } from 'react';
2+
import React, { useState } from 'react';
33
import {
44
Anchor,
55
Checkbox,

src/TextField/TextField.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { ComponentMeta } from '@storybook/react';
2-
import { useState } from 'react';
2+
import React, { useState } from 'react';
33
import { Button, Cutout, TextField } from 'react95';
44
import styled from 'styled-components';
55

src/Toolbar/Toolbar.spec.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { render } from '@testing-library/react';
2+
import React from 'react';
23

34
import { Toolbar } from './Toolbar';
45

src/Tooltip/Tooltip.spec.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { fireEvent, render, waitFor } from '@testing-library/react';
2+
import React from 'react';
23

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

0 commit comments

Comments
 (0)