From 1c91c7b54d0513071af16524872a139d0716a411 Mon Sep 17 00:00:00 2001 From: Kanagaraj M Date: Sat, 24 Mar 2018 00:11:10 +0530 Subject: [PATCH] added eslint prettier check to travis (#5701) - "yarn eslint" will throw the error if there are any formatting issues - "yarn format" will format the js file based on the project's prettier configuration. --- .travis.yml | 2 +- browser/.esformatter | 23 - browser/.eslintrc.json | 9 + browser/.gitignore | 1 + browser/app/index.js | 2 +- browser/app/js/uploads/UploadModal.js | 6 +- browser/package.json | 10 +- browser/yarn.lock | 1094 +++++++++++++++---------- 8 files changed, 702 insertions(+), 445 deletions(-) delete mode 100644 browser/.esformatter create mode 100644 browser/.eslintrc.json diff --git a/.travis.yml b/.travis.yml index 68127dc8d..aae9bc621 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,7 +25,7 @@ script: - make test GOFLAGS="-timeout 15m -race -v" - make coverage - node --version -- cd browser && yarn && yarn test && cd .. +- cd browser && yarn && yarn eslint && yarn test && cd .. after_success: - bash <(curl -s https://codecov.io/bash) diff --git a/browser/.esformatter b/browser/.esformatter deleted file mode 100644 index 1677d7c4b..000000000 --- a/browser/.esformatter +++ /dev/null @@ -1,23 +0,0 @@ -{ - "plugins": [ - "esformatter-jsx" - ], - // Copied from https://github.com/royriojas/esformatter-jsx - "jsx": { - "formatJSX": true, //Duh! that's the default - "attrsOnSameLineAsTag": false, // move each attribute to its own line - "maxAttrsOnTag": 3, // if lower or equal than 3 attributes, they will be kept on a single line - "firstAttributeOnSameLine": true, // keep the first attribute in the same line as the tag - "formatJSXExpressions": true, // default true, if false jsxExpressions won't be recursively formatted - "JSXExpressionsSingleLine": true, // default true, if false the JSXExpressions might span several lines - "alignWithFirstAttribute": false, // do not align attributes with the first tag - "spaceInJSXExpressionContainers": " ", // default to one space. Make it empty if you don't like spaces between JSXExpressionContainers - "removeSpaceBeforeClosingJSX": false, // default false. if true => - "closingTagOnNewLine": false, // default false. if true attributes on multiple lines will close the tag on a new line - "JSXAttributeQuotes": "", // possible values "single" or "double". Leave it as empty string if you don't want to modify the attributes' quotes - "htmlOptions": { - // put here the options for js-beautify.html - } - } -} - diff --git a/browser/.eslintrc.json b/browser/.eslintrc.json new file mode 100644 index 000000000..840ea3286 --- /dev/null +++ b/browser/.eslintrc.json @@ -0,0 +1,9 @@ +{ + "parser": "babel-eslint", + "plugins": [ + "prettier" + ], + "rules": { + "prettier/prettier": "error" + } +} \ No newline at end of file diff --git a/browser/.gitignore b/browser/.gitignore index 6e4ed66d7..55d2f946f 100644 --- a/browser/.gitignore +++ b/browser/.gitignore @@ -18,3 +18,4 @@ release coverage.txt node_modules production +yarn-error.log diff --git a/browser/app/index.js b/browser/app/index.js index 50fb8b693..cde035071 100644 --- a/browser/app/index.js +++ b/browser/app/index.js @@ -36,7 +36,7 @@ ReactDOM.render( , - document.getElementById("root"), + document.getElementById("root") ) hideLoader() diff --git a/browser/app/js/uploads/UploadModal.js b/browser/app/js/uploads/UploadModal.js index 8c38691b5..3cda6c6e8 100644 --- a/browser/app/js/uploads/UploadModal.js +++ b/browser/app/js/uploads/UploadModal.js @@ -58,7 +58,11 @@ export class UploadModal extends React.Component { return (
- +