diff --git a/.eslintrc.js b/.eslintrc.js index 63009638d..c55d198af 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -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'); diff --git a/client/src/components/Breadcrumb/Breadcrumb.js b/client/src/components/Breadcrumb/Breadcrumb.js index 93c3aa093..b86513990 100644 --- a/client/src/components/Breadcrumb/Breadcrumb.js +++ b/client/src/components/Breadcrumb/Breadcrumb.js @@ -84,6 +84,6 @@ function mapStateToProps(state) { }; } -export { Breadcrumb }; +export { Breadcrumb as Component }; export default connect(mapStateToProps)(Breadcrumb); diff --git a/client/src/components/Breadcrumb/tests/breadcrumb-test.js b/client/src/components/Breadcrumb/tests/breadcrumb-test.js index 2acbd6273..0759192b5 100644 --- a/client/src/components/Breadcrumb/tests/breadcrumb-test.js +++ b/client/src/components/Breadcrumb/tests/breadcrumb-test.js @@ -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; diff --git a/client/src/components/CheckboxField/CheckboxField.js b/client/src/components/CheckboxField/CheckboxField.js index ba8353e2c..35ee056c5 100644 --- a/client/src/components/CheckboxField/CheckboxField.js +++ b/client/src/components/CheckboxField/CheckboxField.js @@ -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 ; + return ; }; export default CheckboxField; diff --git a/client/src/components/FormAction/FormAction.js b/client/src/components/FormAction/FormAction.js index 510ccacf6..3eb7c45d0 100644 --- a/client/src/components/FormAction/FormAction.js +++ b/client/src/components/FormAction/FormAction.js @@ -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, diff --git a/client/src/components/GridField/GridField.js b/client/src/components/GridField/GridField.js index facc35a03..711976f75 100644 --- a/client/src/components/GridField/GridField.js +++ b/client/src/components/GridField/GridField.js @@ -31,8 +31,6 @@ class GridField extends Component { } componentDidMount() { - super.componentDidMount(); - const data = this.props.data; this.props.actions.fetchRecords( @@ -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'); } }, }), }; diff --git a/client/src/components/GridField/GridFieldAction.js b/client/src/components/GridField/GridFieldAction.js index 0a23b0013..277735acb 100644 --- a/client/src/components/GridField/GridFieldAction.js +++ b/client/src/components/GridField/GridFieldAction.js @@ -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, }; diff --git a/client/src/components/ListGroup/ListGroupItem.js b/client/src/components/ListGroup/ListGroupItem.js index 010f78c81..f95809691 100644 --- a/client/src/components/ListGroup/ListGroupItem.js +++ b/client/src/components/ListGroup/ListGroupItem.js @@ -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; diff --git a/client/src/components/Toolbar/Toolbar.js b/client/src/components/Toolbar/Toolbar.js index 1308221a3..bf4a53a19 100644 --- a/client/src/components/Toolbar/Toolbar.js +++ b/client/src/components/Toolbar/Toolbar.js @@ -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,