Skip to content

Commit

Permalink
Eslint add plugin react + react-hooks and move plugins to root of pro…
Browse files Browse the repository at this point in the history
…ject (#1493)

* Adding react to eslint config and adding plugins to the root of the repo
  • Loading branch information
oliverabrahams authored May 31, 2024
1 parent e50c109 commit 9105894
Show file tree
Hide file tree
Showing 6 changed files with 411 additions and 253 deletions.
15 changes: 14 additions & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,18 @@ module.exports = {
},
},
],
extends: ['plugin:storybook/recommended'],
rules: {
'react/no-unknown-property': ['error', { ignore: ['css'] }],
},
extends: [
'plugin:storybook/recommended',
'plugin:react/recommended',
'plugin:react/jsx-runtime',
'plugin:react-hooks/recommended',
],
settings: {
react: {
version: 'detect',
},
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const ExpandingWrapper: FC<ExpandingWrapperProps> = ({

useEffect(() => {
disableTabbingWhenCollapsed && setTabIndex(name, isExpanded);
}, [disableTabbingWhenCollapsed, isExpanded]);
}, [disableTabbingWhenCollapsed, isExpanded, name]);

useEffect(() => {
expandCallback?.(isExpanded);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ const propertiesCss = css`

export const TypographyPresets = () => (
<ul css={listCss}>
{Object.entries(presets).map(([preset, styles]) => {
{Object.entries(presets).map(([preset, styles], index) => {
const token = typographyPresets[preset as Preset];
return (
<li>
<li key={`preset-${index}`}>
<span css={presetNameCss}>{preset}</span>
<span css={specimenCss}>
<dl css={propertiesCss}>
Expand All @@ -71,7 +71,7 @@ export const TypographyPresets = () => (
${styles}
`}
>
For facts' sake
For facts&apos; sake
</span>
</span>
</li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export const AccordionRow = ({

useEffect(() => {
setIsBrowser(true);
});
}, []);

if (isBrowser) {
return (
Expand Down
11 changes: 8 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,16 @@
"@guardian/prettier": "workspace:*",
"@manypkg/get-packages": "2.2.0",
"@types/node": "20.12.11",
"@typescript-eslint/parser": "6.21.0",
"@typescript-eslint/eslint-plugin": "7.3.1",
"@typescript-eslint/parser": "7.3.1",
"colorette": "2.0.20",
"eslint": "8.56.0",
"eslint-plugin-storybook": "^0.6.15",
"fast-glob": "^3.3.2",
"eslint-plugin-eslint-comments": "3.2.0",
"eslint-plugin-import": "2.29.1",
"eslint-plugin-react": "7.34.1",
"eslint-plugin-react-hooks": "4.6.2",
"eslint-plugin-storybook": "0.6.15",
"fast-glob": "3.3.2",
"husky": "9.0.6",
"lint-staged": "15.2.0",
"prettier": "3.2.2",
Expand Down
Loading

0 comments on commit 9105894

Please sign in to comment.