Skip to content

Commit 07b2c4d

Browse files
WesSouzaarturbien
authored andcommitted
chore: fix ESLint issues after version upgrade
- class-methods-use-this required DatePicker update convertDateToState to be static - no-console was disabled on tests and stories - jsx-a11y/label-has-associated-control removed duplicate rule - prettier/prettier auto-fixed many components due to Prettier upgrade - react/function-component-definition auto-fixed many components - react/jsx-fragments auto-fixed Select.spec with <> - react/jsx-no-useless-fragment auto-fixed Select to remove useless Fragment - react/jsx-props-no-spreading was turned off - react/no-unused-prop-types was ignored on Tree and useForkRef - react/static-property-placement was set up to our use case
1 parent f2c10fb commit 07b2c4d

Some content is hidden

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

48 files changed

+969
-823
lines changed

.eslintrc.js

+15-13
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module.exports = {
2-
extends: ['airbnb', 'plugin:prettier/recommended', 'prettier/react'],
3-
parser: 'babel-eslint',
2+
extends: ['airbnb', 'plugin:prettier/recommended'],
3+
parser: '@babel/eslint-parser',
44
plugins: ['react', 'prettier'],
55
env: {
66
browser: true,
@@ -10,19 +10,21 @@ module.exports = {
1010
rules: {
1111
'import/no-unresolved': ['error', { ignore: ['react95'] }],
1212
'import/no-extraneous-dependencies': ['error', { devDependencies: true }],
13-
'react/jsx-filename-extension': [1, { extensions: ['.js', '.jsx'] }],
14-
'jsx-a11y/label-has-associated-control': [
15-
'error',
16-
{
17-
required: {
18-
some: ['nesting', 'id']
19-
}
20-
}
21-
],
2213
'jsx-a11y/label-has-associated-control': ['error', { assert: 'either' }],
2314
'jsx-a11y/label-has-for': 'off',
2415
'prettier/prettier': 'error',
16+
'react/forbid-prop-types': 'off',
17+
'react/jsx-filename-extension': [1, { extensions: ['.js', '.jsx'] }],
18+
'react/jsx-props-no-spreading': 'off',
2519
'react/no-array-index-key': 'off',
26-
'react/forbid-prop-types': 'off'
27-
}
20+
'react/static-property-placement': ['error', 'static public field']
21+
},
22+
overrides: [
23+
{
24+
files: ['*.spec.@(js|jsx)', '*.stories.@(js|jsx)'],
25+
rules: {
26+
'no-console': 'off'
27+
}
28+
}
29+
]
2830
};

package-lock.json

+85-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
"devDependencies": {
5757
"@babel/cli": "^7.18.9",
5858
"@babel/core": "^7.18.9",
59+
"@babel/eslint-parser": "^7.18.9",
5960
"@babel/plugin-proposal-class-properties": "^7.18.6",
6061
"@babel/plugin-transform-runtime": "^7.18.9",
6162
"@babel/preset-env": "^7.18.9",
@@ -66,7 +67,6 @@
6667
"@testing-library/jest-dom": "^5.16.4",
6768
"@testing-library/react": "^12.1.5",
6869
"@types/jest": "^28.1.6",
69-
"babel-eslint": "^10.1.0",
7070
"babel-loader": "^8.2.5",
7171
"babel-plugin-styled-components": "^2.0.7",
7272
"commitizen": "^4.2.5",

src/Anchor/Anchor.stories.js

+11-9
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,17 @@ export default {
1414
decorators: [story => <Wrapper>{story()}</Wrapper>]
1515
};
1616

17-
export const Default = () => (
18-
<h1>
19-
Everybody likes
20-
<Anchor href='https://expensive.toys' target='_blank'>
21-
{' '}
22-
https://expensive.toys
23-
</Anchor>
24-
</h1>
25-
);
17+
export function Default() {
18+
return (
19+
<h1>
20+
Everybody likes
21+
<Anchor href='https://expensive.toys' target='_blank'>
22+
{' '}
23+
https://expensive.toys
24+
</Anchor>
25+
</h1>
26+
);
27+
}
2628

2729
Default.story = {
2830
name: 'default'

src/AppBar/AppBar.stories.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const Wrapper = styled.div`
2121
background: ${({ theme }) => theme.desktopBackground};
2222
`;
2323

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

2727
return (
@@ -76,7 +76,7 @@ export const Default = () => {
7676
</Toolbar>
7777
</AppBar>
7878
);
79-
};
79+
}
8080

8181
Default.story = {
8282
name: 'default'

src/Avatar/Avatar.stories.js

+16-14
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,22 @@ export default {
1919
const imageSrc =
2020
'https://sphoto.nasza-klasa.pl/33278012/1/square/2658174fbd.jpeg?v=1';
2121

22-
export const Default = () => (
23-
<div style={{ display: 'inline-flex' }}>
24-
<Avatar size={50} src={imageSrc} />
25-
<Avatar noBorder size={50} src={imageSrc} />
26-
<Avatar size={50} style={{ background: 'palevioletred' }}>
27-
AK
28-
</Avatar>
29-
<Avatar square size={50}>
30-
<span role='img' aria-label='🚀'>
31-
🚀
32-
</span>
33-
</Avatar>
34-
</div>
35-
);
22+
export function Default() {
23+
return (
24+
<div style={{ display: 'inline-flex' }}>
25+
<Avatar size={50} src={imageSrc} />
26+
<Avatar noBorder size={50} src={imageSrc} />
27+
<Avatar size={50} style={{ background: 'palevioletred' }}>
28+
AK
29+
</Avatar>
30+
<Avatar square size={50}>
31+
<span role='img' aria-label='🚀'>
32+
🚀
33+
</span>
34+
</Avatar>
35+
</div>
36+
);
37+
}
3638

3739
Default.story = {
3840
name: 'default'

src/Bar/Bar.stories.js

+14-12
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,20 @@ const Wrapper = styled.div`
1313
background: ${({ theme }) => theme.desktopBackground};
1414
`;
1515

16-
export const Default = () => (
17-
<AppBar>
18-
<Toolbar>
19-
<Bar size={35} />
20-
<Button variant='menu'>Edit</Button>
21-
<Button variant='menu' disabled>
22-
Save
23-
</Button>
24-
<Bar size={35} />
25-
</Toolbar>
26-
</AppBar>
27-
);
16+
export function Default() {
17+
return (
18+
<AppBar>
19+
<Toolbar>
20+
<Bar size={35} />
21+
<Button variant='menu'>Edit</Button>
22+
<Button variant='menu' disabled>
23+
Save
24+
</Button>
25+
<Bar size={35} />
26+
</Toolbar>
27+
</AppBar>
28+
);
29+
}
2830

2931
Default.story = {
3032
name: 'default'

src/Button/Button.js

+6-5
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,12 @@ export const StyledButton = styled.button`
8585
${createBoxStyles()};
8686
border: none;
8787
${isDisabled && createDisabledTextStyles()}
88-
${active &&
89-
createHatchedBackground({
90-
mainColor: theme.material,
91-
secondaryColor: theme.borderLightest
92-
})}
88+
${active
89+
? createHatchedBackground({
90+
mainColor: theme.material,
91+
secondaryColor: theme.borderLightest
92+
})
93+
: ''}
9394
&:before {
9495
box-sizing: border-box;
9596
content: '';

0 commit comments

Comments
 (0)