Update eslint and plugins and add some rules to make it pass

old
Javi Velasco 2015-11-21 12:56:57 +01:00
parent af05a71544
commit 1bfd44e60f
6 changed files with 16 additions and 11 deletions

View File

@ -17,6 +17,7 @@
"parser": "babel-eslint", "parser": "babel-eslint",
"plugins": [ "plugins": [
"babel",
"react" "react"
], ],
@ -168,6 +169,7 @@
"operator-linebreak": [2, "after"], "operator-linebreak": [2, "after"],
"padded-blocks": [0], "padded-blocks": [0],
"prefer-const": [2], "prefer-const": [2],
"prefer-spread": [2],
"quote-props": [0], "quote-props": [0],
"radix": [0], "radix": [0],
"semi": [2], "semi": [2],
@ -210,6 +212,7 @@
}], }],
"react/jsx-uses-react": [2], "react/jsx-uses-react": [2],
"react/jsx-uses-vars": [2], "react/jsx-uses-vars": [2],
"react/react-in-jsx-scope": [2] "react/react-in-jsx-scope": [2],
"babel/object-shorthand": [2]
} }
} }

View File

@ -51,8 +51,9 @@ class Button extends React.Component {
}; };
render () { render () {
const {accent, flat, floating, href, icon, label, loading, mini, const {accent, flat, floating, href, icon, label,
primary, raised, ripple, toggle, tooltip, tooltipDelay, ...others} = this.props; loading, mini, primary, raised, ripple, toggle,
tooltip, tooltipDelay, ...others} = this.props; //eslint-disable-line no-redeclare
const element = href ? 'a' : 'button'; const element = href ? 'a' : 'button';
const level = primary ? 'primary' : accent ? 'accent' : 'neutral'; const level = primary ? 'primary' : accent ? 'accent' : 'neutral';
const shape = flat ? 'flat' : raised ? 'raised' : floating ? 'floating' : toggle ? 'toggle' : 'flat'; const shape = flat ? 'flat' : raised ? 'raised' : floating ? 'floating' : toggle ? 'toggle' : 'flat';

View File

@ -28,7 +28,7 @@ class Dropdown extends React.Component {
const client = event.target.getBoundingClientRect(); const client = event.target.getBoundingClientRect();
const screen_height = window.innerHeight || document.documentElement.offsetHeight; const screen_height = window.innerHeight || document.documentElement.offsetHeight;
const up = this.props.auto ? client.top > ((screen_height / 2) + client.height) : false; const up = this.props.auto ? client.top > ((screen_height / 2) + client.height) : false;
this.setState({active: true, up: up}); this.setState({active: true, up});
}; };
handleSelect = (item) => { handleSelect = (item) => {

View File

@ -103,7 +103,7 @@ describe('Slider', function () {
describe('#events', function () { describe('#events', function () {
beforeEach(function () { beforeEach(function () {
onChange = sinon.spy(); onChange = sinon.spy();
props = { min: -500, max: 500, onChange: onChange }; props = { min: -500, max: 500, onChange };
state = { sliderStart: 0, sliderLength: 1000 }; state = { sliderStart: 0, sliderLength: 1000 };
slider = utils.renderComponent(Slider, props, state); slider = utils.renderComponent(Slider, props, state);
slider.handleResize = (event, callback) => { callback(); }; slider.handleResize = (event, callback) => { callback(); };

View File

@ -39,7 +39,7 @@ const Preview = React.createClass({
setTimeout () { setTimeout () {
clearTimeout(this.timeoutID); clearTimeout(this.timeoutID);
this.timeoutID = setTimeout.apply(null, arguments); this.timeoutID = setTimeout(...arguments);
}, },
compileCode () { compileCode () {
@ -72,7 +72,7 @@ const Preview = React.createClass({
const compiledCode = this.compileCode(); const compiledCode = this.compileCode();
/*eslint-disable no-eval*/ /*eslint-disable no-eval*/
const Component = eval(compiledCode).apply(null, scope); const Component = eval(compiledCode)(...scope);
ReactDOM.render(Component, mountNode); ReactDOM.render(Component, mountNode);
if (this.state.error) { if (this.state.error) {
this.setState({error: null}); this.setState({error: null});

View File

@ -1,7 +1,7 @@
{ {
"name": "react-toolbox", "name": "react-toolbox",
"version": "0.12.12", "version": "0.12.12",
"homepage": "www.react-toolbox.com", "homepage": "http://www.react-toolbox.com",
"description": "A set of React components implementing Google's Material Design specification with the power of CSS Modules.", "description": "A set of React components implementing Google's Material Design specification with the power of CSS Modules.",
"author": "React Toolbox Team (http://github.com/react-toolbox)", "author": "React Toolbox Team (http://github.com/react-toolbox)",
"contributors": [ "contributors": [
@ -53,15 +53,16 @@
"autoprefixer": "^6.0.3", "autoprefixer": "^6.0.3",
"babel": "^5.8.23", "babel": "^5.8.23",
"babel-core": "^5.8.23", "babel-core": "^5.8.23",
"babel-eslint": "^4.1.3", "babel-eslint": "^4.1.5",
"babel-loader": "^5.3.2", "babel-loader": "^5.3.2",
"babel-plugin-react-transform": "^1.1.1", "babel-plugin-react-transform": "^1.1.1",
"core-js": "^1.2.6", "core-js": "^1.2.6",
"cpx": "^1.2.1", "cpx": "^1.2.1",
"cross-env": "^1.0.4", "cross-env": "^1.0.4",
"css-loader": "^0.21.0", "css-loader": "^0.21.0",
"eslint": "^1.7.3", "eslint": "^1.10.1",
"eslint-plugin-react": "^3.3.1", "eslint-plugin-babel": "^2.1.1",
"eslint-plugin-react": "^3.10.0",
"expect": "^1.8.0", "expect": "^1.8.0",
"express": "^4.13.3", "express": "^4.13.3",
"extract-text-webpack-plugin": "^0.8.2", "extract-text-webpack-plugin": "^0.8.2",