diff --git a/.eslintrc.yml b/.eslintrc.yml new file mode 100644 index 000000000..0d67ac5fe --- /dev/null +++ b/.eslintrc.yml @@ -0,0 +1,6 @@ +--- +extends: + - standard +parser: babel-eslint +plugins: + - flowtype diff --git a/package.json b/package.json index c8fb4cce8..d23133537 100644 --- a/package.json +++ b/package.json @@ -28,11 +28,11 @@ "bootstrap-cozy-env": "export cozy_hostname=$cozy_env.cozy-desktop.local && npm run bootstrap-cozy-instance && npm run bootstrap-cozy-hostname", "bootstrap-cozy-hostname": "grep $cozy_hostname /etc/hosts || echo 127.0.0.1 $cozy_hostname | sudo tee -a /etc/hosts", "bootstrap-cozy-instance": "cozy-stack instances add --dev $cozy_hostname:8080", + "eslint": "./node_modules/.bin/eslint './src/**/*.js' './test/**/*.js'", "fauxton": "babel-node ./src/bin/fauxton.js", "flow": "flow status --quiet --show-all-errors", - "lint": "npm run standard && npm run flow", + "lint": "npm run eslint && npm run flow", "repl": "babel-node ./src/bin/repl.js", - "standard": "./node_modules/.bin/standard './src/**/*.js' './test/**/*.js'", "test": "installed-check && npm run test-unit && npm run test-integration", "test-coverage": "installed-check && npm run test-unit-coverage && npm run test-integration", "test-unit": "NODE_ENV=test mocha test/unit/", @@ -43,12 +43,6 @@ "size": "t=\"$(npm pack .)\"; wc -c \"${t}\"; tar tvf \"${t}\"; rm \"${t}\";", "watch": "npm run build -- --watch" }, - "standard": { - "parser": "babel-eslint", - "plugins": [ - "flowtype" - ] - }, "dependencies": { "async": "2.1.4", "bluebird": "^3.4.7", @@ -57,6 +51,7 @@ "commander": "2.9.0", "cozy-client-js": "0.0.7", "cozy-device-sdk": "1.4.0", + "eslint": "^3.15.0", "fs-extra": "^2.0.0", "isomorphic-fetch": "^2.2.1", "lodash.clone": "4.5.0", @@ -89,7 +84,10 @@ "babel-preset-es2016": "^6.22.0", "babel-preset-es2017": "^6.22.0", "del": "2.2.2", + "eslint-config-standard": "^6.2.1", "eslint-plugin-flowtype": "^2.30.0", + "eslint-plugin-promise": "^3.4.1", + "eslint-plugin-standard": "^2.0.1", "faker": "3.1.0", "flow-bin": "^0.38.0", "flow-typed": "^2.0.0", @@ -102,7 +100,6 @@ "pouchdb-server": "^2.0.1", "should": "^11.2.0", "sinon": "^1.17.7", - "source-map-support": "^0.4.11", - "standard": "^8.6.0" + "source-map-support": "^0.4.11" } } diff --git a/yarn.lock b/yarn.lock index d2028cbf2..41aa6ec37 100644 --- a/yarn.lock +++ b/yarn.lock @@ -35,12 +35,16 @@ accepts@~1.3.3: mime-types "~2.1.11" negotiator "0.6.1" -acorn-jsx@^3.0.0, acorn-jsx@^3.0.1: +acorn-jsx@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-3.0.1.tgz#afdf9488fb1ecefc8348f6fb22f464e32a58b36b" dependencies: acorn "^3.0.4" +acorn@4.0.4: + version "4.0.4" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-4.0.4.tgz#17a8d6a7a6c4ef538b814ec9abac2779293bf30a" + acorn@^1.0.3: version "1.2.2" resolved "https://registry.yarnpkg.com/acorn/-/acorn-1.2.2.tgz#c8ce27de0acc76d896d2b1fad3df588d9e82f014" @@ -49,10 +53,6 @@ acorn@^3.0.4, acorn@^3.1.0: version "3.3.0" resolved "https://registry.yarnpkg.com/acorn/-/acorn-3.3.0.tgz#45e37fb39e8da3f25baee3ff5369e2bb5f22017a" -acorn@^4.0.1: - version "4.0.4" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-4.0.4.tgz#17a8d6a7a6c4ef538b814ec9abac2779293bf30a" - after@~0.8.1: version "0.8.2" resolved "https://registry.yarnpkg.com/after/-/after-0.8.2.tgz#fedb394f9f0e02aa9768e702bda23b505fae7e1f" @@ -1240,7 +1240,7 @@ dashdash@^1.12.0, dashdash@^1.14.0: dependencies: assert-plus "^1.0.0" -debug-log@^1.0.0, debug-log@^1.0.1: +debug-log@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/debug-log/-/debug-log-1.0.1.tgz#2307632d4c04382b8df8a32f70b895046d52745f" @@ -1288,17 +1288,6 @@ defined@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/defined/-/defined-1.0.0.tgz#c98d9bcef75674188e110969151199e39b1fa693" -deglob@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/deglob/-/deglob-2.1.0.tgz#4d44abe16ef32c779b4972bd141a80325029a14a" - dependencies: - find-root "^1.0.0" - glob "^7.0.5" - ignore "^3.0.9" - pkg-config "^1.1.0" - run-parallel "^1.1.2" - uniq "^1.0.1" - del@2.2.2, del@^2.0.2: version "2.2.2" resolved "https://registry.yarnpkg.com/del/-/del-2.2.2.tgz#c12c981d067846c84bcaf862cff930d907ffd1a8" @@ -1526,11 +1515,7 @@ escope@^3.6.0: esrecurse "^4.1.0" estraverse "^4.1.1" -eslint-config-standard-jsx@3.2.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/eslint-config-standard-jsx/-/eslint-config-standard-jsx-3.2.0.tgz#c240e26ed919a11a42aa4de8059472b38268d620" - -eslint-config-standard@6.2.1: +eslint-config-standard@^6.2.1: version "6.2.1" resolved "https://registry.yarnpkg.com/eslint-config-standard/-/eslint-config-standard-6.2.1.tgz#d3a68aafc7191639e7ee441e7348739026354292" @@ -1540,24 +1525,17 @@ eslint-plugin-flowtype@^2.30.0: dependencies: lodash "^4.15.0" -eslint-plugin-promise@~3.4.0: - version "3.4.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-promise/-/eslint-plugin-promise-3.4.0.tgz#6ba9048c2df57be77d036e0c68918bc9b4fc4195" +eslint-plugin-promise@^3.4.1: + version "3.4.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-promise/-/eslint-plugin-promise-3.4.1.tgz#6911a9010bf84e17d82e19e0ab0f80ab3ad6db4c" -eslint-plugin-react@~6.7.1: - version "6.7.1" - resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-6.7.1.tgz#1af96aea545856825157d97c1b50d5a8fb64a5a7" - dependencies: - doctrine "^1.2.2" - jsx-ast-utils "^1.3.3" - -eslint-plugin-standard@~2.0.1: +eslint-plugin-standard@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/eslint-plugin-standard/-/eslint-plugin-standard-2.0.1.tgz#3589699ff9c917f2c25f76a916687f641c369ff3" -eslint@~3.10.2: - version "3.10.2" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-3.10.2.tgz#c9a10e8bf6e9d65651204778c503341f1eac3ce7" +eslint@^3.15.0: + version "3.15.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-3.15.0.tgz#bdcc6a6c5ffe08160e7b93c066695362a91e30f2" dependencies: babel-code-frame "^6.16.0" chalk "^1.1.3" @@ -1565,12 +1543,12 @@ eslint@~3.10.2: debug "^2.1.1" doctrine "^1.2.2" escope "^3.6.0" - espree "^3.3.1" + espree "^3.4.0" estraverse "^4.2.0" esutils "^2.0.2" file-entry-cache "^2.0.0" glob "^7.0.3" - globals "^9.2.0" + globals "^9.14.0" ignore "^3.2.0" imurmurhash "^0.1.4" inquirer "^0.12.0" @@ -1589,7 +1567,7 @@ eslint@~3.10.2: require-uncached "^1.0.2" shelljs "^0.7.5" strip-bom "^3.0.0" - strip-json-comments "~1.0.1" + strip-json-comments "~2.0.1" table "^3.7.8" text-table "~0.2.0" user-home "^2.0.0" @@ -1598,11 +1576,11 @@ esmangle-evaluator@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/esmangle-evaluator/-/esmangle-evaluator-1.0.1.tgz#620d866ef4861b3311f75766d52a8572bb3c6336" -espree@^3.3.1: - version "3.3.2" - resolved "https://registry.yarnpkg.com/espree/-/espree-3.3.2.tgz#dbf3fadeb4ecb4d4778303e50103b3d36c88b89c" +espree@^3.4.0: + version "3.4.0" + resolved "https://registry.yarnpkg.com/espree/-/espree-3.4.0.tgz#41656fa5628e042878025ef467e78f125cb86e1d" dependencies: - acorn "^4.0.1" + acorn "4.0.4" acorn-jsx "^3.0.0" esprima-fb@^15001.1.0-dev-harmony-fb: @@ -1833,10 +1811,6 @@ find-cache-dir@^0.1.1: mkdirp "^0.5.1" pkg-dir "^1.0.0" -find-root@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/find-root/-/find-root-1.0.0.tgz#962ff211aab25c6520feeeb8d6287f8f6e95807a" - find-up@^1.0.0, find-up@^1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/find-up/-/find-up-1.1.2.tgz#6b2e9822b1a2ce0a60ab64d610eccad53cb24d0f" @@ -2045,10 +2019,6 @@ get-stdin@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-4.0.1.tgz#b968c6b0a04384324902e8bf1a5df32579a450fe" -get-stdin@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-5.0.1.tgz#122e161591e21ff4c52530305693f20e6393a398" - getpass@^0.1.1: version "0.1.6" resolved "https://registry.yarnpkg.com/getpass/-/getpass-0.1.6.tgz#283ffd9fc1256840875311c1b60e8c40187110e6" @@ -2152,7 +2122,7 @@ glob@~3.1.21: inherits "1" minimatch "~0.2.11" -globals@^9.0.0, globals@^9.2.0: +globals@^9.0.0, globals@^9.14.0: version "9.14.0" resolved "https://registry.yarnpkg.com/globals/-/globals-9.14.0.tgz#8859936af0038741263053b39d0e76ca241e4034" @@ -2305,9 +2275,9 @@ iconv-lite@0.4.13, iconv-lite@^0.4.5, iconv-lite@~0.4.13: version "0.4.13" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.13.tgz#1f88aba4ab0b1508e8312acc39345f36e992e2f2" -ignore@^3.0.9, ignore@^3.2.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.2.0.tgz#8d88f03c3002a0ac52114db25d2c673b0bf1e435" +ignore@^3.2.0: + version "3.2.2" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.2.2.tgz#1c51e1ef53bab6ddc15db4d9ac4ec139eceb3410" immediate@3.0.6, immediate@~3.0.5: version "3.0.6" @@ -2777,13 +2747,6 @@ jsverify@0.7.4: trampa "^1.0.0" typify-parser "^1.1.0" -jsx-ast-utils@^1.3.3: - version "1.3.5" - resolved "https://registry.yarnpkg.com/jsx-ast-utils/-/jsx-ast-utils-1.3.5.tgz#9ba6297198d9f754594d62e59496ffb923778dd4" - dependencies: - acorn-jsx "^3.0.1" - object-assign "^4.1.0" - killable@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/killable/-/killable-1.0.0.tgz#da8b84bd47de5395878f95d64d02f2449fe05e6b" @@ -3585,14 +3548,6 @@ pinkie@^2.0.0: version "2.0.4" resolved "https://registry.yarnpkg.com/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870" -pkg-config@^1.0.1, pkg-config@^1.1.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/pkg-config/-/pkg-config-1.1.1.tgz#557ef22d73da3c8837107766c52eadabde298fe4" - dependencies: - debug-log "^1.0.0" - find-root "^1.0.0" - xtend "^4.0.1" - pkg-dir@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-1.0.0.tgz#7a4b508a8d5bb2d629d447056ff4e9c9314cf3d4" @@ -4291,7 +4246,7 @@ read@1.0.7: dependencies: mute-stream "~0.0.4" -readable-stream@1.0.33, "readable-stream@>=1.0.33-1 <1.1.0-0", readable-stream@^1.0.33: +readable-stream@1.0.33, "readable-stream@>=1.0.33-1 <1.1.0-0": version "1.0.33" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-1.0.33.tgz#3a360dd66c1b1d7fd4705389860eda1d0f61126c" dependencies: @@ -4300,6 +4255,15 @@ readable-stream@1.0.33, "readable-stream@>=1.0.33-1 <1.1.0-0", readable-stream@^ isarray "0.0.1" string_decoder "~0.10.x" +readable-stream@^1.0.33, readable-stream@~1.1.8, readable-stream@~1.1.9: + version "1.1.14" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-1.1.14.tgz#7cf4c54ef648e3813084c636dd2079e166c081d9" + dependencies: + core-util-is "~1.0.0" + inherits "~2.0.1" + isarray "0.0.1" + string_decoder "~0.10.x" + readable-stream@^2.0.0, "readable-stream@^2.0.0 || ^1.1.13", readable-stream@^2.0.2: version "2.2.2" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.2.2.tgz#a9e6fec3c7dda85f8bb1b3ba7028604556fc825e" @@ -4316,15 +4280,6 @@ readable-stream@~0.0.2: version "0.0.4" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-0.0.4.tgz#f32d76e3fb863344a548d79923007173665b3b8d" -readable-stream@~1.1.8, readable-stream@~1.1.9: - version "1.1.14" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-1.1.14.tgz#7cf4c54ef648e3813084c636dd2079e166c081d9" - dependencies: - core-util-is "~1.0.0" - inherits "~2.0.1" - isarray "0.0.1" - string_decoder "~0.10.x" - readable-stream@~2.0.0, readable-stream@~2.0.5: version "2.0.6" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.0.6.tgz#8f90341e68a53ccc928788dacfcd11b36eb9b78e" @@ -4576,10 +4531,6 @@ run-async@^0.1.0: dependencies: once "^1.3.0" -run-parallel@^1.1.2: - version "1.1.6" - resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.1.6.tgz#29003c9a2163e01e2d2dfc90575f2c6c1d61a039" - rx-lite@4.0.8: version "4.0.8" resolved "https://registry.yarnpkg.com/rx-lite/-/rx-lite-4.0.8.tgz#0b1e11af8bc44836f04a6407e92da42467b79444" @@ -4673,8 +4624,8 @@ setprototypeof@1.0.2: resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.0.2.tgz#81a552141ec104b88e89ce383103ad5c66564d08" shelljs@^0.7.5: - version "0.7.5" - resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.7.5.tgz#2eef7a50a21e1ccf37da00df767ec69e30ad0675" + version "0.7.6" + resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.7.6.tgz#379cccfb56b91c8601e4793356eb5382924de9ad" dependencies: glob "^7.0.0" interpret "^1.0.0" @@ -4868,29 +4819,6 @@ sshpk@^1.7.0: jsbn "~0.1.0" tweetnacl "~0.14.0" -standard-engine@~5.2.0: - version "5.2.0" - resolved "https://registry.yarnpkg.com/standard-engine/-/standard-engine-5.2.0.tgz#400660ae5acce8afd4db60ff2214a9190ad790a3" - dependencies: - deglob "^2.0.0" - find-root "^1.0.0" - get-stdin "^5.0.1" - home-or-tmp "^2.0.0" - minimist "^1.1.0" - pkg-config "^1.0.1" - -standard@^8.6.0: - version "8.6.0" - resolved "https://registry.yarnpkg.com/standard/-/standard-8.6.0.tgz#635132be7bfb567c2921005f30f9e350e4752aad" - dependencies: - eslint "~3.10.2" - eslint-config-standard "6.2.1" - eslint-config-standard-jsx "3.2.0" - eslint-plugin-promise "~3.4.0" - eslint-plugin-react "~6.7.1" - eslint-plugin-standard "~2.0.1" - standard-engine "~5.2.0" - "statuses@>= 1.3.1 < 2", statuses@~1.3.0: version "1.3.1" resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.3.1.tgz#faf51b9eb74aaef3b3acf4ad5f61abf24cb7b93e" @@ -4937,10 +4865,14 @@ strip-bom@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3" -strip-json-comments@~1.0.1, strip-json-comments@~1.0.4: +strip-json-comments@~1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-1.0.4.tgz#1e15fbcac97d3ee99bf2d73b4c656b082bbafb91" +strip-json-comments@~2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" + sublevel-pouchdb@1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/sublevel-pouchdb/-/sublevel-pouchdb-1.0.1.tgz#161505db220be6e4e3fdc85a00187c93d55c5966" @@ -5159,10 +5091,6 @@ underscore@~1.6.0: version "1.6.0" resolved "https://registry.yarnpkg.com/underscore/-/underscore-1.6.0.tgz#8b38b10cacdef63337b8b24e4ff86d45aea529a8" -uniq@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/uniq/-/uniq-1.0.1.tgz#b31c5ae8254844a3a8281541ce2b04b865a734ff" - unpipe@1.0.0, unpipe@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec"