Skip to content

Commit

Permalink
Fixed linting errors and turned some of the newer ones off temporarily
Browse files Browse the repository at this point in the history
  • Loading branch information
Christopher Joe committed Sep 19, 2017
1 parent f607547 commit 52b6cf5
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 99 deletions.
87 changes: 1 addition & 86 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,86 +1 @@
const todo = {
"react/jsx-filename-extension": [
"off"
],
"react/require-default-props": [
"off"
],
"react/prop-types": [
"off"
],
"comma-dangle": [
"off"
],
"arrow-parens": [
"off"
],
"indent": [
"off"
],
"jsx-a11y/iframe-has-title": [
"off"
],
};

module.exports = {
"extends": "airbnb",
"env": {
"jasmine": true
},
"rules": Object.assign({},
todo,
{
"no-underscore-dangle": [
"off",
{
"allow": [
"_t"
],
"allowAfterThis": true
}
],
"no-unused-vars": [
"error",
{
"vars": "local"
}
],
"react/no-danger": [
"error"
],
"react/forbid-prop-types": [
"off"
],
"import/prefer-default-export": [
"off"
],
"import/first": [
"off"
],
"class-methods-use-this": [
"off"
],
"no-useless-escape": [
"off"
],
}),
"settings": {
"import/extensions": [
".js",
".jsx"
],
"import/resolver": {
"node": {
"extensions": [
".js",
".jsx"
],
"moduleDirectory": [
".",
"client/src",
"node_modules"
]
}
}
}
};
module.exports = require('@silverstripe/webpack-config/.eslintrc');
2 changes: 1 addition & 1 deletion client/src/components/Breadcrumb/Breadcrumb.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,6 @@ function mapStateToProps(state) {
};
}

export { Breadcrumb };
export { Breadcrumb as Component };

export default connect(mapStateToProps)(Breadcrumb);
2 changes: 1 addition & 1 deletion client/src/components/Breadcrumb/tests/breadcrumb-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ jest.unmock('../Breadcrumb');
// FYI: Changing these to import statements broke jest's automocking
import React from 'react';
import ReactTestUtils from 'react-addons-test-utils';
import { Breadcrumb } from '../Breadcrumb';
import { Component as Breadcrumb } from '../Breadcrumb';

describe('BreadcrumbsComponent', () => {
let props = null;
Expand Down
4 changes: 2 additions & 2 deletions client/src/components/CheckboxField/CheckboxField.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import React from 'react';
import OptionField from '../OptionsetField/OptionField';
import fieldHolder from 'components/FieldHolder/FieldHolder';

const CheckboxField = () => {
const CheckboxField = (props) => {
// Build standard checkbox with fieldholder
const FieldHolder = fieldHolder(OptionField);

// set to not show field holder labels, as checkbox already generates a label
return <FieldHolder {...this.props} type="checkbox" hideLabels />;
return <FieldHolder {...props} type="checkbox" hideLabels />;
};

export default CheckboxField;
2 changes: 1 addition & 1 deletion client/src/components/FormAction/FormAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ FormAction.propTypes = {
id: React.PropTypes.string,
name: React.PropTypes.string,
onClick: React.PropTypes.func,
handleClick: () => { throw new Error('no longer used'); },
handleClick: (props) => { if (props.handleClick) { throw new Error('handleClick: no longer used'); } },
title: React.PropTypes.string,
type: React.PropTypes.string,
loading: React.PropTypes.bool,
Expand Down
6 changes: 2 additions & 4 deletions client/src/components/GridField/GridField.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ class GridField extends Component {
}

componentDidMount() {
super.componentDidMount();

const data = this.props.data;

this.props.actions.fetchRecords(
Expand Down Expand Up @@ -165,9 +163,9 @@ GridField.propTypes = {
headerColumns: React.PropTypes.array,
collectionReadEndpoint: React.PropTypes.object,
onDrillDown: React.PropTypes.func,
handleDrillDown: () => { throw new Error('no longer used'); },
handleDrillDown: (props) => { if (props.handleDrillDown) { throw new Error('handleDrillDown: no longer used'); } },
onEditRecord: React.PropTypes.func,
handleEditRecord: () => { throw new Error('no longer used'); },
handleEditRecord: (props) => { if (props.handleEditRecord) { throw new Error('handleEditRecord: no longer used'); } },
}),
};

Expand Down
2 changes: 1 addition & 1 deletion client/src/components/GridField/GridFieldAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class GridFieldAction extends Component {
}

GridFieldAction.PropTypes = {
handleClick: () => { throw new Error('no longer used'); },
handleClick: (props) => { if (props.handleClick) { throw new Error('handleClick: no longer used'); } },
Click: React.PropTypes.func.isRequired,
};

Expand Down
4 changes: 2 additions & 2 deletions client/src/components/ListGroup/ListGroupItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ class ListGroupItem extends Component {

ListGroupItem.propTypes = {
onClickArg: React.PropTypes.any,
handleClickArg: () => { throw new Error('no longer used'); },
handleClickArg: (props) => { if (props.handleClickArg) { throw new Error('handleClickArg: no longer used'); } },
onClick: React.PropTypes.func,
handleClick: () => { throw new Error('no longer used'); },
handleClick: (props) => { if (props.handleClick) { throw new Error('handleClick: no longer used'); } },
};

export default ListGroupItem;
2 changes: 1 addition & 1 deletion client/src/components/Toolbar/Toolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class Toolbar extends Component {
}

Toolbar.propTypes = {
handleBackButtonClick: () => { throw new Error('no longer used'); },
handleBackButtonClick: (props) => { if (props.handleBackButtonClick) { throw new Error('handleBackButtonClick: no longer used'); } },
onBackButtonClick: PropTypes.func,
showBackButton: PropTypes.bool,
breadcrumbs: PropTypes.array,
Expand Down

0 comments on commit 52b6cf5

Please sign in to comment.