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.
This commit is contained in:
Kanagaraj M 2018-03-24 00:11:10 +05:30 committed by Harshavardhana
parent 020cc8b669
commit 1c91c7b54d
8 changed files with 702 additions and 445 deletions

View File

@ -25,7 +25,7 @@ script:
- make test GOFLAGS="-timeout 15m -race -v" - make test GOFLAGS="-timeout 15m -race -v"
- make coverage - make coverage
- node --version - node --version
- cd browser && yarn && yarn test && cd .. - cd browser && yarn && yarn eslint && yarn test && cd ..
after_success: after_success:
- bash <(curl -s https://codecov.io/bash) - bash <(curl -s https://codecov.io/bash)

View File

@ -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 <React.Something /> => <React.Something/>
"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
}
}
}

9
browser/.eslintrc.json Normal file
View File

@ -0,0 +1,9 @@
{
"parser": "babel-eslint",
"plugins": [
"prettier"
],
"rules": {
"prettier/prettier": "error"
}
}

1
browser/.gitignore vendored
View File

@ -18,3 +18,4 @@ release
coverage.txt coverage.txt
node_modules node_modules
production production
yarn-error.log

View File

@ -36,7 +36,7 @@ ReactDOM.render(
<App /> <App />
</Router> </Router>
</Provider>, </Provider>,
document.getElementById("root"), document.getElementById("root")
) )
hideLoader() hideLoader()

View File

@ -58,7 +58,11 @@ export class UploadModal extends React.Component {
return ( return (
<div className="alert alert-info alert--upload animated fadeInUp "> <div className="alert alert-info alert--upload animated fadeInUp ">
<button type="button" className="close close--alt" onClick={showAbortModal}></button> <button
type="button"
className="close close--alt"
onClick={showAbortModal}
/>
<div>{text}</div> <div>{text}</div>
<ProgressBar now={percent} /> <ProgressBar now={percent} />
<div> <div>

View File

@ -7,7 +7,8 @@
"dev": "NODE_ENV=dev webpack-dev-server --devtool cheap-module-eval-source-map --progress --colors --hot --content-base dev", "dev": "NODE_ENV=dev webpack-dev-server --devtool cheap-module-eval-source-map --progress --colors --hot --content-base dev",
"build": "NODE_ENV=dev node build.js", "build": "NODE_ENV=dev node build.js",
"release": "NODE_ENV=production MINIO_UI_BUILD=RELEASE node build.js", "release": "NODE_ENV=production MINIO_UI_BUILD=RELEASE node build.js",
"format": "esformatter -i 'app/**/*.js'" "format": "prettier --write 'app/**/*.js'",
"eslint": "eslint 'app/**/*.js'"
}, },
"jest": { "jest": {
"setupTestFrameworkScriptFile": "./app/js/jest/setup.js", "setupTestFrameworkScriptFile": "./app/js/jest/setup.js",
@ -31,6 +32,7 @@
"async": "^1.5.2", "async": "^1.5.2",
"babel-cli": "^6.14.0", "babel-cli": "^6.14.0",
"babel-core": "^6.14.0", "babel-core": "^6.14.0",
"babel-eslint": "^8.2.2",
"babel-jest": "^22.1.0", "babel-jest": "^22.1.0",
"babel-loader": "^7.1.2", "babel-loader": "^7.1.2",
"babel-plugin-syntax-object-rest-spread": "^6.13.0", "babel-plugin-syntax-object-rest-spread": "^6.13.0",
@ -43,15 +45,15 @@
"css-loader": "^0.23.1", "css-loader": "^0.23.1",
"enzyme": "^3.3.0", "enzyme": "^3.3.0",
"enzyme-adapter-react-16": "^1.1.1", "enzyme-adapter-react-16": "^1.1.1",
"esformatter": "^0.10.0", "eslint": "^4.19.1",
"esformatter-jsx": "^7.4.1", "eslint-plugin-prettier": "^2.6.0",
"esformatter-jsx-ignore": "^1.0.6",
"html-webpack-plugin": "^2.30.1", "html-webpack-plugin": "^2.30.1",
"jest": "^22.1.4", "jest": "^22.1.4",
"jest-enzyme": "^4.0.2", "jest-enzyme": "^4.0.2",
"json-loader": "^0.5.4", "json-loader": "^0.5.4",
"less": "^2.7.1", "less": "^2.7.1",
"less-loader": "^2.2.3", "less-loader": "^2.2.3",
"prettier": "^1.11.1",
"purifycss-webpack-plugin": "^2.0.3", "purifycss-webpack-plugin": "^2.0.3",
"style-loader": "^0.13.1", "style-loader": "^0.13.1",
"url-loader": "^0.5.7", "url-loader": "^0.5.7",

File diff suppressed because it is too large Load Diff