From 79147139ceccd5a5c64adc3ad934d8d472185d63 Mon Sep 17 00:00:00 2001 From: David Inga Date: Wed, 15 Feb 2017 17:41:46 +0100 Subject: [PATCH] eslint, removed webpack and added gulp with babel task --- .babelrc | 2 +- .eslintignore | 3 + .eslintrc | 24 +- .jscsrc | 44 - .npmignore | 5 + components/Globe/index.jsx | 3 +- components/Modal/index.jsx | 45 +- components/Spinner/index.jsx | 2 +- gulpfile.js | 13 + package.json | 41 +- postcss.config.js | 7 - webpack.config.js | 76 - yarn.lock | 5329 ---------------------------------- 13 files changed, 62 insertions(+), 5532 deletions(-) delete mode 100644 .jscsrc create mode 100644 .npmignore create mode 100644 gulpfile.js delete mode 100644 postcss.config.js delete mode 100644 webpack.config.js delete mode 100644 yarn.lock diff --git a/.babelrc b/.babelrc index d065274..bd4454f 100644 --- a/.babelrc +++ b/.babelrc @@ -1,3 +1,3 @@ { - "presets": ["es2015", "es2016", "react"] + "presets": ["latest", "react"] } diff --git a/.eslintignore b/.eslintignore index 3c3629e..3266c50 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1 +1,4 @@ node_modules +stories +dist +*.js diff --git a/.eslintrc b/.eslintrc index c689452..f49f1a9 100644 --- a/.eslintrc +++ b/.eslintrc @@ -14,28 +14,8 @@ }, "sourceType": "module" }, - "extends": "airbnb", + "extends": "vizzuality", "rules": { - "no-console": ["error", { - "allow": ["warn", "error", "info"] - }], - "comma-dangle": ["error", { - "arrays": "only-multiline", - "objects": "only-multiline", - "imports": "never", - "exports": "never", - "functions": "ignore", - }], - "no-restricted-properties": ["error", { - "object": "arguments", - "property": "callee", - "message": "arguments.callee is deprecated", - }, { - "property": "__defineGetter__", - "message": "Please use Object.defineProperty instead.", - }, { - "property": "__defineSetter__", - "message": "Please use Object.defineProperty instead.", - }], + "jsx-a11y/no-static-element-interactions": 0 } } diff --git a/.jscsrc b/.jscsrc deleted file mode 100644 index aa75a22..0000000 --- a/.jscsrc +++ /dev/null @@ -1,44 +0,0 @@ -{ - "disallowKeywords": ["with"], - "disallowKeywordsOnNewLine": ["else"], - "disallowMixedSpacesAndTabs": true, - "disallowMultipleVarDecl": "exceptUndefined", - "disallowNewlineBeforeBlockStatements": true, - "disallowQuotedKeysInObjects": true, - "disallowSpaceAfterObjectKeys": true, - "disallowSpaceAfterPrefixUnaryOperators": true, - "disallowSpacesInFunction": { - "beforeOpeningRoundBrace": true - }, - "disallowSpacesInsideParentheses": true, - "disallowTrailingWhitespace": true, - "maximumLineLength": 80, - "requireCamelCaseOrUpperCaseIdentifiers": false, - "requireCapitalizedComments": true, - "requireCapitalizedConstructors": true, - "requireCurlyBraces": true, - "requireSpaceAfterKeywords": [ - "if", - "else", - "for", - "while", - "do", - "switch", - "case", - "return", - "try", - "catch", - "typeof" - ], - "requireSpaceAfterLineComment": true, - "requireSpaceAfterBinaryOperators": true, - "requireSpaceBeforeBinaryOperators": true, - "requireSpaceBeforeBlockStatements": true, - "requireSpaceBeforeObjectValues": true, - "requireSpacesInFunction": { - "beforeOpeningCurlyBrace": true - }, - "validateIndentation": 2, - "validateLineBreaks": "LF", - "validateQuoteMarks": "'" -} diff --git a/.npmignore b/.npmignore new file mode 100644 index 0000000..d48643e --- /dev/null +++ b/.npmignore @@ -0,0 +1,5 @@ +.eslintrc* +.editorconfig +.storybook +components +stories diff --git a/components/Globe/index.jsx b/components/Globe/index.jsx index dc4db75..1f444eb 100644 --- a/components/Globe/index.jsx +++ b/components/Globe/index.jsx @@ -1,10 +1,9 @@ -import './style.scss'; - import React from 'react'; import * as THREE from 'three'; import orbitControl from 'three-orbit-controls'; import earthImage from './images/earth-clouds.jpg'; import earthBumpImage from './images/earth-bump.jpg'; +import './style.scss'; const Control = orbitControl(THREE); diff --git a/components/Modal/index.jsx b/components/Modal/index.jsx index e554c52..bdffbbe 100644 --- a/components/Modal/index.jsx +++ b/components/Modal/index.jsx @@ -1,6 +1,5 @@ -import './style.scss'; - import React, { Component } from 'react'; +import './style.scss'; class Modal extends Component { @@ -13,7 +12,7 @@ class Modal extends Component { } componentWillMount() { - this._setConfig(); + this.setConfig(); } componentDidMount() { @@ -21,19 +20,26 @@ class Modal extends Component { // disables scroll window when modal is visible document.querySelector('body').style.overflow = 'hidden'; - this._setEventListeners(); + this.setEventListeners(); } } componentDidUpdate(prevProps, nextProps) { - if (!nextProps.visibility) this._removeEventListeners(); + if (!nextProps.visibility) this.removeEventListeners(); } - _setConfig() { + onKeyDown(event) { + // 27 => ESC key + if (event.keyCode !== 27) return; + + this.closeModal(); + } + + setConfig() { // needs to be initialiazed and have a global scope inside the component // because of adding/removing event - const onKeyDown= (e) => { - this._onKeyDown(e); + const onKeyDown = (e) => { + this.onKeyDown(e); }; this.config = { @@ -41,22 +47,15 @@ class Modal extends Component { }; } - _setEventListeners() { + setEventListeners() { document.addEventListener('keydown', this.config.onKeyDown); } - _removeEventListeners() { + removeEventListeners() { document.removeEventListener('keydown', this.config.onKeyDown); } - _onKeyDown(event) { - // 27 => ESC key - if (event.keyCode !== 27) return; - - this._closeModal(); - } - - _closeModal() { + closeModal() { // enables scroll window when modal is invisible document.querySelector('body').style.overflow = null; @@ -70,15 +69,15 @@ class Modal extends Component { {this.props.veil &&
this._closeModal()} + onClick={() => this.closeModal()} />}
{this.props.closeable &&
this._closeModal()} + className={this.props.cssClasses.btnClose} + onClick={() => this.closeModal()} />}
@@ -87,8 +86,8 @@ class Modal extends Component { {this.props.hasFooter &&