diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 000000000000..5bcb6fe81f16 --- /dev/null +++ b/.eslintignore @@ -0,0 +1,3 @@ +dist +coverage +node_modules diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 000000000000..a8be29392b99 --- /dev/null +++ b/.eslintrc @@ -0,0 +1,29 @@ +{ + "extends": [ + "./node_modules/eslint-config-airbnb-base/rules/es6.js" + ], + "plugins": [ + "prettier" + ], + "parser": "babel-eslint", + "parserOptions": { + "sourceType": "module" + }, + "env": { + "es6": true, + "node": true + }, + "rules": { + "strict": 0, + "prettier/prettier": ["warn", { + "printWidth": 100, + "tabWidth": 2, + "bracketSpacing": true, + # "trailingComma": "es5", + "singleQuote": true + }], + "quotes": ["warn", "single"], + "arrow-parens": ["warn", "as-needed"] + # "comma-dangle": ["warn", "always"] + } +} diff --git a/.travis.yml b/.travis.yml index e46e1e64aa4c..96fafb253c71 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,6 +9,6 @@ node_js: - "5" before_install: ./scripts/travis/before_install.sh after_success: ./scripts/travis/after_success.sh -script: npm run test +script: npm run lint && npm run test git: depth: 1 diff --git a/package.json b/package.json index 0c2b60079f0f..a7c795807332 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,16 @@ { "devDependencies": { - "lerna": "2.0.0-beta.38" + "babel-eslint": "^7.2.1", + "eslint": "^3.19.0", + "eslint-config-airbnb-base": "^11.1.2", + "eslint-plugin-import": "^2.2.0", + "eslint-plugin-prettier": "^2.0.1", + "lerna": "2.0.0-beta.38", + "prettier": "^0.22.0" }, "scripts": { "postinstall": "lerna bootstrap", - "test": "lerna run test" + "test": "lerna run test", + "lint": "eslint ." } } diff --git a/packages/addon-knobs/.eslintrc b/packages/addon-knobs/.eslintrc deleted file mode 100644 index 4b01e776c82c..000000000000 --- a/packages/addon-knobs/.eslintrc +++ /dev/null @@ -1,17 +0,0 @@ -{ - "extends": "airbnb", - "rules": { - "arrow-body-style": 0, - "prefer-arrow-callback": 0, - "func-names": 0, - "react/jsx-no-bind": 0, - "react/jsx-uses-react": 1, - "react/prefer-stateless-function": 0 - }, - "parserOptions": { - "ecmaVersion": 6, - "ecmaFeatures": { - "experimentalObjectRestSpread": true - } - } -} diff --git a/packages/addon-knobs/example/stories/index.js b/packages/addon-knobs/example/stories/index.js index 7ddebd23ea20..b2a3759431c1 100644 --- a/packages/addon-knobs/example/stories/index.js +++ b/packages/addon-knobs/example/stories/index.js @@ -1,25 +1,13 @@ import React from 'react'; import { storiesOf } from '@kadira/storybook'; import moment from 'moment'; -import { - withKnobs, - number, - object, - boolean, - text, - select, - date, - array, - color, -} from '../../src'; +import { withKnobs, number, object, boolean, text, select, date, array, color } from '../../src'; const stories = storiesOf('Example of Knobs', module); stories.addDecorator(withKnobs); -stories.add('simple example', () => ( - -)); +stories.add('simple example', () => ); stories.add('with all knobs', () => { const name = text('Name', 'Tom Cary'); @@ -28,31 +16,31 @@ stories.add('with all knobs', () => { const bold = boolean('Bold', false); const selectedColor = color('Color', 'black'); const favoriteNumber = number('Favorite Number', 42); - const comfortTemp = number('Comfort Temp', 72, {range:true, min: 60, max: 90, step: 1}); + const comfortTemp = number('Comfort Temp', 72, { range: true, min: 60, max: 90, step: 1 }); const passions = array('Passions', ['Fishing', 'Skiing']); const customStyle = object('Style', { fontFamily: 'Arial', - padding: 20, + padding: 20 }); const style = { ...customStyle, - fontWeight: bold ? 800: 400, - favoriteNumber: favoriteNumber, - color: selectedColor, + fontWeight: bold ? 800 : 400, + favoriteNumber, + color: selectedColor }; return (
- I'm {name} and I was born on "{moment(dob).format("DD MMM YYYY")}" + I'm {name} and I was born on "{moment(dob).format('DD MMM YYYY')}" I like:

My favorite number is {favoriteNumber}.

My most comfortable room temperature is {comfortTemp} degrees Fahrenheit.

); -}) +}); stories.add('dates Knob', () => { const today = date('today'); @@ -60,44 +48,44 @@ stories.add('dates Knob', () => { const myDob = date('My DOB', new Date('July 07 1993')); return ( -