Skip to content

Commit 74dc133

Browse files
committed
add and address new eslint rules
1 parent 14ca458 commit 74dc133

35 files changed

Lines changed: 142 additions & 75 deletions

.eslintrc

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,23 @@
1616
"import/no-unresolved": 0,
1717
"import/no-named-as-default": 0,
1818
"import/no-named-as-default-member": 0,
19+
"import/no-useless-path-segments": 1,
20+
"import/no-cycle":1,
21+
"import/no-import-module-exports": 1,
1922
"comma-dangle": 0, // not sure why airbnb turned this on. gross!
23+
"default-param-last": 0,
24+
"no-else-return" :0,
2025
"indent": 0,
2126
"no-console": 0,
2227
"no-alert": 0,
28+
"no-import-assign": 2,
29+
"no-promise-executor-return": 1,
30+
"no-restricted-exports": 1,
2331
"no-underscore-dangle": 0,
2432
"no-useless-catch": 2,
33+
"prefer-object-spread": 0,
2534
"max-len": [1, 120, 2, {"ignoreComments": true, "ignoreTemplateLiterals": true}],
35+
"max-classes-per-file": 0,
2636
"quote-props": [1, "as-needed"],
2737
"no-unused-vars": [1, {"vars": "local", "args": "none"}],
2838
"consistent-return": ["error", { "treatUndefinedAsUnspecified": true }],
@@ -36,7 +46,19 @@
3646
{ "ignorePureComponents": true
3747
}],
3848
"class-methods-use-this": 0,
39-
"react/jsx-no-bind": [2, {"allowBind": true, "allowArrowFunctions": true}],
49+
"react/button-has-type": 0,
50+
"react/destructuring-assignment":0,
51+
"react/function-component-definition": 0,
52+
"react/jsx-curly-newline":0,
53+
"react/jsx-fragments":0,
54+
"react/jsx-no-useless-fragment":1,
55+
"react/jsx-one-expression-per-line": 0,
56+
"react/jsx-props-no-spreading": 0,
57+
"react/jsx-wrap-multilines": 0,
58+
"react/jsx-no-bind": [2, {"allowBind": true, "allowArrowFunctions": true, "allowFunctions": true}],
59+
"react/no-deprecated": 1,
60+
"react/no-unused-class-component-methods": 1,
61+
"react/sort-comp": 0,
4062
"no-return-assign": [2, "except-parens"],
4163
"jsx-a11y/anchor-is-valid": [
4264
"error",
@@ -49,6 +71,8 @@
4971
]
5072
}
5173
],
74+
"jsx-a11y/control-has-associated-label": 1,
75+
"jsx-a11y/label-has-associated-control": 1,
5276
"jsx-a11y/label-has-for": [
5377
2,
5478
{

client/common/useKeyDownHandlers.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,7 @@ export const DocumentKeyDown = ({ handlers }) => {
6666
DocumentKeyDown.propTypes = {
6767
handlers: PropTypes.objectOf(PropTypes.func)
6868
};
69+
70+
DocumentKeyDown.defaultProps = {
71+
handlers: {}
72+
};

client/index.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ script.src = 'https://foundation-donate-banner.netlify.app/static/js/main.js';
3535
document.body.appendChild(script);
3636

3737
const App = () => (
38-
<>
38+
<div>
3939
<Router history={browserHistory}>
4040
<SkipLink targetId="play-sketch" text="PlaySketch" />
4141
<Routing />
4242
</Router>
43-
</>
43+
</div>
4444
);
4545

4646
render(

client/modules/IDE/components/AssetList.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ const AssetList = () => {
4646
<th>{t('AssetList.HeaderName')}</th>
4747
<th>{t('AssetList.HeaderSize')}</th>
4848
<th>{t('AssetList.HeaderSketch')}</th>
49-
<th scope="col"></th>
49+
<th aria-label="dropdown" scope="col"></th>
5050
</tr>
5151
</thead>
5252
<tbody>

client/modules/IDE/components/CollectionList/CollectionList.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ const CollectionList = ({
183183
context: mobile ? 'mobile' : ''
184184
})
185185
)}
186-
<th scope="col"></th>
186+
<th aria-label="dropdown" scope="col"></th>
187187
</tr>
188188
</thead>
189189
<tbody>

client/modules/IDE/components/Console.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import ConsoleInput from './ConsoleInput';
99
import UpArrowIcon from '../../../images/up-arrow.svg';
1010
import DownArrowIcon from '../../../images/down-arrow.svg';
1111

12-
import * as IDEActions from '../../IDE/actions/ide';
13-
import * as ConsoleActions from '../../IDE/actions/console';
12+
import * as IDEActions from '../actions/ide';
13+
import * as ConsoleActions from '../actions/console';
1414
import { useDidUpdate } from '../hooks/custom-hooks';
1515
import useHandleMessageEvent from '../hooks/useHandleMessageEvent';
1616
import { listen } from '../../../utils/dispatcher';

client/modules/IDE/components/ConsoleInput.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { useDispatch } from 'react-redux';
55
import { Encode } from 'console-feed';
66

77
import RightArrowIcon from '../../../images/right-arrow.svg';
8-
import { dispatchConsoleEvent } from '../../IDE/actions/console';
8+
import { dispatchConsoleEvent } from '../actions/console';
99
import { dispatchMessage, MessageTypes } from '../../../utils/dispatcher';
1010

1111
// heavily inspired by

client/modules/IDE/components/Editor/index.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ class Editor extends React.Component {
226226
});
227227
}
228228

229+
/* eslint-disable react/no-deprecated */
229230
componentWillUpdate(nextProps) {
230231
// check if files have changed
231232
if (this.props.files[0].id !== nextProps.files[0].id) {

client/modules/IDE/components/Header/MobileNav.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import {
2727
} from '../../actions/ide';
2828
import { logoutUser } from '../../../User/actions';
2929
import { useSketchActions, useWhatPage } from '../../hooks';
30+
// eslint-disable-next-line import/no-cycle
3031
import { CmControllerContext } from '../../pages/IDEView';
3132
import { selectSketchPath } from '../../selectors/project';
3233
import { availableLanguages, languageKeyToLabel } from '../../../../i18n';

client/modules/IDE/components/Header/Nav.jsx

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import {
2727
stopSketch
2828
} from '../../actions/ide';
2929
import { logoutUser } from '../../../User/actions';
30+
// eslint-disable-next-line import/no-cycle
3031
import { CmControllerContext } from '../../pages/IDEView';
3132
import MobileNav from './MobileNav';
3233
import useIsMobile from '../../hooks/useIsMobile';
@@ -37,14 +38,12 @@ const Nav = ({ layout }) => {
3738
return isMobile ? (
3839
<MobileNav />
3940
) : (
40-
<>
41-
<header className="nav__header">
42-
<Menubar>
43-
<LeftLayout layout={layout} />
44-
<UserMenu />
45-
</Menubar>
46-
</header>
47-
</>
41+
<header className="nav__header">
42+
<Menubar>
43+
<LeftLayout layout={layout} />
44+
<UserMenu />
45+
</Menubar>
46+
</header>
4847
);
4948
};
5049

0 commit comments

Comments
 (0)