Skip to content

Commit

Permalink
eslint rule adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
raclim committed Aug 14, 2024
1 parent 7c69e61 commit cc494fe
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 25 deletions.
26 changes: 25 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,24 @@
"import/namespace": 0,
"import/no-unresolved": 0,
"import/no-named-as-default": 0,
"import/no-cycle":1,
"import/no-import-module-exports": 1,
"import/no-named-as-default-member": 0,
"import/no-useless-path-segments": 1,
"comma-dangle": 0, // not sure why airbnb turned this on. gross!
"default-param-last": 0,
"no-else-return" :0,
"indent": 0,
"no-console": 0,
"no-alert": 0,
"no-import-assign": 2,
"no-promise-executor-return": 1,
"no-restricted-exports": 1,
"no-underscore-dangle": 0,
"no-useless-catch": 2,
"prefer-object-spread": 0,
"max-len": [1, 120, 2, {"ignoreComments": true, "ignoreTemplateLiterals": true}],
"max-classes-per-file": 0,
"quote-props": [1, "as-needed"],
"no-unused-vars": [1, {"vars": "local", "args": "none"}],
"consistent-return": ["error", { "treatUndefinedAsUnspecified": true }],
Expand All @@ -36,7 +46,19 @@
{ "ignorePureComponents": true
}],
"class-methods-use-this": 0,
"react/jsx-no-bind": [2, {"allowBind": true, "allowArrowFunctions": true}],
"react/button-has-type": 0,
"react/destructuring-assignment":0,
"react/function-component-definition": 0,
"react/jsx-curly-newline":0,
"react/jsx-fragments":0,
"react/jsx-no-useless-fragment":1,
"react/jsx-one-expression-per-line": 0,
"react/jsx-props-no-spreading": 0,
"react/jsx-wrap-multilines": 0,
"react/jsx-no-bind": [2, {"allowBind": true, "allowArrowFunctions": true, "allowFunctions": true}],
"react/no-deprecated": 1,
"react/no-unused-class-component-methods": 1,
"react/sort-comp": 0,
"no-return-assign": [2, "except-parens"],
"jsx-a11y/anchor-is-valid": [
"error",
Expand All @@ -49,6 +71,8 @@
]
}
],
"jsx-a11y/control-has-associated-label": 1,
"jsx-a11y/label-has-associated-control": 1,
"jsx-a11y/label-has-for": [
2,
{
Expand Down
6 changes: 6 additions & 0 deletions client/common/useKeyDownHandlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ export default function useKeyDownHandlers(keyHandlers) {
*/
const handlers = useRef(keyHandlers);

console.log('handlers: ', handlers);

useEffect(() => {
handlers.current = mapKeys(keyHandlers, (value, key) => key?.toLowerCase());
}, [keyHandlers]);
Expand Down Expand Up @@ -66,3 +68,7 @@ export const DocumentKeyDown = ({ handlers }) => {
DocumentKeyDown.propTypes = {
handlers: PropTypes.objectOf(PropTypes.func)
};

DocumentKeyDown.defaultProps = {
handlers: {} // Provide a default empty object for handlers
};
8 changes: 4 additions & 4 deletions client/modules/IDE/components/FileNode.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -460,9 +460,7 @@ function mapStateToProps(state, ownProps) {
});
}

function mapDispatchToProps(dispatch) {
return bindActionCreators(Object.assign(FileActions, IDEActions), dispatch);
}
const mapDispatchToProps = { ...FileActions, ...IDEActions };

const TranslatedFileNode = withTranslation()(FileNode);

Expand All @@ -471,4 +469,6 @@ const ConnectedFileNode = connect(
mapDispatchToProps
)(TranslatedFileNode);

export { TranslatedFileNode as FileNode, ConnectedFileNode as default };
export { TranslatedFileNode as FileNode };

export default ConnectedFileNode;
29 changes: 12 additions & 17 deletions client/modules/IDE/components/SketchList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,8 @@ class SketchListRowBase extends React.Component {
{this.props.t('SketchList.DropdownAddToCollection')}
</MenuItem>

{/*
<MenuItem onClick={this.handleSketchShare}>
Share
</MenuItem>
*/}
<MenuItem onClick={this.handleSketchShare}>Share</MenuItem>

<MenuItem hideIf={!userIsOwner} onClick={this.handleSketchDelete}>
{this.props.t('SketchList.DropdownDelete')}
</MenuItem>
Expand Down Expand Up @@ -185,18 +182,16 @@ class SketchListRowBase extends React.Component {
);

return (
<React.Fragment>
<tr
className="sketches-table__row"
key={sketch.id}
onClick={this.handleRowClick}
>
<th scope="row">{name}</th>
<td>{formatDateCell(sketch.createdAt, mobile)}</td>
<td>{formatDateCell(sketch.updatedAt, mobile)}</td>
{this.renderDropdown()}
</tr>
</React.Fragment>
<tr
className="sketches-table__row"
key={sketch.id}
onClick={this.handleRowClick}
>
<th scope="row">{name}</th>
<td>{formatDateCell(sketch.createdAt, mobile)}</td>
<td>{formatDateCell(sketch.updatedAt, mobile)}</td>
{this.renderDropdown()}
</tr>
);
}
}
Expand Down
2 changes: 2 additions & 0 deletions client/store.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint-disable import/no-import-module-exports */

import { configureStore } from '@reduxjs/toolkit';
import listenerMiddleware from './middleware';
import DevTools from './modules/App/components/DevTools';
Expand Down
6 changes: 4 additions & 2 deletions client/test-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

// eslint-disable-next-line import/no-extraneous-dependencies
import { render } from '@testing-library/react';
import React from 'react';
import React, { useMemo } from 'react';
import PropTypes from 'prop-types';
import { Provider } from 'react-redux';
import { Router } from 'react-router-dom';
Expand All @@ -34,9 +34,11 @@ export * from '@testing-library/react';

const ResponsiveProvider = ({ children, mobile, deviceWidth }) => {
const width = deviceWidth ?? (mobile ? 400 : 1000);
const contextValue = useMemo(() => ({ width }), [width]);

return (
// eslint-disable-next-line react/jsx-filename-extension
<ResponsiveContext.Provider value={{ width }}>
<ResponsiveContext.Provider value={contextValue}>
{children}
</ResponsiveContext.Provider>
);
Expand Down
2 changes: 1 addition & 1 deletion server/domain-objects/Project.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export function toApi(model) {
* - each file/folder gets a generated BSON-ID
* - each folder has a `children` array containing the IDs of it's children
*/
function transformFilesInner(tree = {}, parentNode) {
function transformFilesInner(parentNode, tree = {}) {
const files = [];
const errors = [];

Expand Down

0 comments on commit cc494fe

Please sign in to comment.