From 518d1e092cf17a943cdb34b0551f7cf412e9a9a7 Mon Sep 17 00:00:00 2001 From: Tobias Koppers Date: Wed, 15 Nov 2017 13:52:01 +0100 Subject: [PATCH] replace js-beautify with prettier --- .editorconfig | 4 +++ .eslintrc.js | 31 +++------------- .prettierrc | 4 +++ package.json | 10 +++--- yarn.lock | 98 ++++++++++++++------------------------------------- 5 files changed, 45 insertions(+), 102 deletions(-) create mode 100644 .prettierrc diff --git a/.editorconfig b/.editorconfig index 012966bd94e..7228de4053b 100644 --- a/.editorconfig +++ b/.editorconfig @@ -12,6 +12,10 @@ max_line_length = 233 indent_style = space indent_size = 2 +[.prettierrc] +indent_style = space +indent_size = 2 + [*.yml] indent_style = space indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js index dece7c39fd9..12149e7f6d5 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,6 +1,9 @@ module.exports = { "root": true, - "plugins": ["node"], + "plugins": [ + "prettier", + "node" + ], "extends": ["eslint:recommended", "plugin:node/recommended"], "env": { "node": true, @@ -9,7 +12,7 @@ module.exports = { }, "parserOptions": { "ecmaVersion": 2017 }, "rules": { - "quotes": ["error", "double"], + "prettier/prettier": "error", "no-undef": "error", "no-extra-semi": "error", "semi": "error", @@ -21,36 +24,12 @@ module.exports = { "brace-style": "error", "eol-last": "error", "no-extra-bind": "warn", - "no-empty": "off", - "no-multiple-empty-lines": "error", - "no-multi-spaces": "error", "no-process-exit": "warn", - "space-in-parens": "error", - "no-trailing-spaces": "error", "no-use-before-define": "off", "no-unused-vars": ["error", { "args": "none" }], - "key-spacing": "error", - "space-infix-ops": "error", "no-unsafe-negation": "error", "no-loop-func": "warn", - "space-before-function-paren": ["error", "never"], - "space-before-blocks": "error", - "object-curly-spacing": ["error", "always"], "indent": "off", - "keyword-spacing": ["error", { - "after": false, - "overrides": { - "const": { "after": true }, - "try": { "after": true }, - "else": { "after": true }, - "throw": { "after": true }, - "case": { "after": true }, - "return": { "after": true }, - "finally": { "after": true }, - "do": { "after": true }, - "of": { "after": true } - } - }], "no-console": "off", "valid-jsdoc": "error", "node/no-unsupported-features": "error", diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 00000000000..d2702b8a1b4 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,4 @@ +{ + "tabWidth": 2, + "useTabs": true +} diff --git a/package.json b/package.json index ced0fbaf238..09ed831a583 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,6 @@ "webpack-sources": "^1.0.1" }, "devDependencies": { - "beautify-lint": "^1.0.3", "benchmark": "^2.1.1", "bundle-loader": "~0.5.0", "codacy-coverage": "^2.0.1", @@ -37,6 +36,7 @@ "es6-promise-polyfill": "^1.1.1", "eslint": "^4.3.0", "eslint-plugin-node": "^5.1.1", + "eslint-plugin-prettier": "^2.3.1", "express": "~4.13.1", "file-loader": "^1.1.6", "glob": "^7.1.2", @@ -44,13 +44,13 @@ "istanbul": "^0.4.5", "jade": "^1.11.0", "jade-loader": "~0.8.0", - "js-beautify": "^1.5.10", "json-loader": "^0.5.7", "less": "^2.5.1", "less-loader": "^4.0.3", "lodash": "^4.17.4", "mocha": "^3.2.0", "mocha-lcov-reporter": "^1.0.0", + "prettier": "^1.8.2", "raw-loader": "~0.5.0", "react": "^15.2.1", "react-dom": "^15.2.1", @@ -101,10 +101,10 @@ "circleci:lint": "npm run lint-files", "build:examples": "cd examples && node buildAll.js", "pretest": "npm run lint-files", - "lint-files": "npm run lint && npm run beautify-lint && npm run schema-lint", + "lint-files": "npm run lint && npm run schema-lint", "lint": "eslint lib bin hot buildin \"test/*.js\" \"test/**/webpack.config.js\" \"examples/**/webpack.config.js\"", "fix": "npm run lint -- --fix", - "beautify-lint": "beautify-lint \"lib/**/*.js\" \"hot/**/*.js\" \"bin/**/*.js\" \"benchmark/*.js\" \"test/*.js\" \"test/**/webpack.config.js\" \"examples/**/webpack.config.js\"", + "pretty-files": "prettier \"lib/**.*\" \"bin/**.*\" \"hot/**.*\" \"buildin/**.*\" \"test/*.js\" \"test/**/webpack.config.js\" \"examples/**/webpack.config.js\" --write", "schema-lint": "mocha test/*.lint.js --opts test/lint-mocha.opts", "benchmark": "mocha --max-old-space-size=4096 --harmony --trace-deprecation test/*.benchmark.js -R spec", "cover": "npm run cover:init && npm run cover:all && npm run cover:report", @@ -114,6 +114,6 @@ "cover:unit": "node --max-old-space-size=4096 --harmony --trace-deprecation ./node_modules/istanbul/lib/cli.js cover --report none node_modules/mocha/bin/_mocha -- test/*.unittest.js", "cover:report": "istanbul report", "cover:report-min": "istanbul report --report lcovonly", - "publish-patch": "npm run lint && npm run beautify-lint && mocha && npm version patch && git push && git push --tags && npm publish" + "publish-patch": "npm run lint && mocha && npm version patch && git push && git push --tags && npm publish" } } diff --git a/yarn.lock b/yarn.lock index f1048374a9e..745dc02aad8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -244,7 +244,7 @@ async-each@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/async-each/-/async-each-1.0.1.tgz#19d386a1d9edc6e7c1c85d388aedbcc56d33602d" -async@1.x, async@^1.4.0, async@^1.5.0: +async@1.x, async@^1.4.0: version "1.5.2" resolved "https://registry.yarnpkg.com/async/-/async-1.5.2.tgz#ec6a61ae56480c0c3cb241c95618e20892f9672a" @@ -323,15 +323,6 @@ bcrypt-pbkdf@^1.0.0: dependencies: tweetnacl "^0.14.3" -beautify-lint@^1.0.3: - version "1.0.4" - resolved "https://registry.yarnpkg.com/beautify-lint/-/beautify-lint-1.0.4.tgz#954b10f0bcd0a93dd17d0ed519b8996b701247db" - dependencies: - async "^1.5.0" - diff "^2.2.1" - glob "^6.0.1" - js-beautify "^1.5.10" - benchmark@^2.1.1: version "2.1.4" resolved "https://registry.yarnpkg.com/benchmark/-/benchmark-2.1.4.tgz#09f3de31c916425d498cc2ee565a0ebf3c2a5629" @@ -357,7 +348,7 @@ bluebird@^2.3, bluebird@^2.9.x: version "2.11.0" resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-2.11.0.tgz#534b9033c022c9579c56ba3b3e5a5caafbb650e1" -bluebird@^3.0.5, bluebird@^3.5.0: +bluebird@^3.5.0: version "3.5.1" resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.5.1.tgz#d9551f9de98f1fcda1e683d17ee91a0602ee2eb9" @@ -811,13 +802,6 @@ concat-stream@^1.5.0, concat-stream@^1.6.0: readable-stream "^2.2.2" typedarray "^0.0.6" -config-chain@~1.1.5: - version "1.1.11" - resolved "https://registry.yarnpkg.com/config-chain/-/config-chain-1.1.11.tgz#aba09747dfbe4c3e70e766a6e41586e1859fc6f2" - dependencies: - ini "^1.3.4" - proto-list "~1.2.1" - console-browserify@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/console-browserify/-/console-browserify-1.1.0.tgz#f0241c45730a9fc6323b206dbf38edc741d0bb10" @@ -1176,10 +1160,6 @@ diff@3.2.0: version "3.2.0" resolved "https://registry.yarnpkg.com/diff/-/diff-3.2.0.tgz#c9ce393a4b7cbd0b058a725c93df299027868ff9" -diff@^2.2.1: - version "2.2.3" - resolved "https://registry.yarnpkg.com/diff/-/diff-2.2.3.tgz#60eafd0d28ee906e4e8ff0a52c1229521033bf99" - diff@^3.1.0: version "3.4.0" resolved "https://registry.yarnpkg.com/diff/-/diff-3.4.0.tgz#b1d85507daf3964828de54b37d0d73ba67dda56c" @@ -1217,16 +1197,6 @@ ecc-jsbn@~0.1.1: dependencies: jsbn "~0.1.0" -editorconfig@^0.13.2: - version "0.13.3" - resolved "https://registry.yarnpkg.com/editorconfig/-/editorconfig-0.13.3.tgz#e5219e587951d60958fd94ea9a9a008cdeff1b34" - dependencies: - bluebird "^3.0.5" - commander "^2.9.0" - lru-cache "^3.2.0" - semver "^5.1.0" - sigmund "^1.0.1" - ee-first@1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d" @@ -1315,6 +1285,13 @@ eslint-plugin-node@^5.1.1: resolve "^1.3.3" semver "5.3.0" +eslint-plugin-prettier@^2.3.1: + version "2.3.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-2.3.1.tgz#e7a746c67e716f335274b88295a9ead9f544e44d" + dependencies: + fast-diff "^1.1.1" + jest-docblock "^21.0.0" + eslint-scope@^3.7.1: version "3.7.1" resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-3.7.1.tgz#3d63c3edfda02e06e01a452ad88caacc7cdcb6e8" @@ -1533,6 +1510,10 @@ fast-deep-equal@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-1.0.0.tgz#96256a3bc975595eb36d82e9929d060d893439ff" +fast-diff@^1.1.1: + version "1.1.2" + resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.1.2.tgz#4b62c42b8e03de3f848460b639079920695d0154" + fast-json-stable-stringify@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz#d5142c0caee6b1189f87d3a76111064f86c8bbf2" @@ -1812,16 +1793,6 @@ glob@^5.0.15: once "^1.3.0" path-is-absolute "^1.0.0" -glob@^6.0.1: - version "6.0.4" - resolved "https://registry.yarnpkg.com/glob/-/glob-6.0.4.tgz#0f08860f6a155127b2fadd4f9ce24b1aab6e4d22" - dependencies: - inflight "^1.0.4" - inherits "2" - minimatch "2 || 3" - once "^1.3.0" - path-is-absolute "^1.0.0" - glob@^7.0.3, glob@^7.0.5, glob@^7.1.2: version "7.1.2" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15" @@ -2102,9 +2073,9 @@ inherits@2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.1.tgz#b17d08d326b4423e568eff719f91b0b1cbdf69f1" -ini@^1.3.4, ini@~1.3.0: - version "1.3.5" - resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.5.tgz#eee25f56db1c9ec6085e0c22778083f596abf927" +ini@~1.3.0: + version "1.3.4" + resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.4.tgz#0537cb79daf59b59a1a517dff706c86ec039162e" inquirer@^3.0.6: version "3.3.0" @@ -2399,6 +2370,10 @@ jade@^1.11.0: void-elements "~2.0.1" with "~4.0.0" +jest-docblock@^21.0.0: + version "21.2.0" + resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-21.2.0.tgz#51529c3b30d5fd159da60c27ceedc195faf8d414" + joi@^6.4.x: version "6.10.1" resolved "https://registry.yarnpkg.com/joi/-/joi-6.10.1.tgz#4d50c318079122000fe5f16af1ff8e1917b77e06" @@ -2412,15 +2387,6 @@ js-base64@^2.1.9: version "2.4.0" resolved "https://registry.yarnpkg.com/js-base64/-/js-base64-2.4.0.tgz#9e566fee624751a1d720c966cd6226d29d4025aa" -js-beautify@^1.5.10: - version "1.7.5" - resolved "https://registry.yarnpkg.com/js-beautify/-/js-beautify-1.7.5.tgz#69d9651ef60dbb649f65527b53674950138a7919" - dependencies: - config-chain "~1.1.5" - editorconfig "^0.13.2" - mkdirp "~0.5.0" - nopt "~3.0.1" - js-tokens@^3.0.0, js-tokens@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b" @@ -2687,12 +2653,6 @@ loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.3.1: dependencies: js-tokens "^3.0.0" -lru-cache@^3.2.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-3.2.0.tgz#71789b3b7f5399bec8565dda38aa30d2a097efee" - dependencies: - pseudomap "^1.0.1" - lru-cache@^4.0.1, lru-cache@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.1.1.tgz#622e32e82488b49279114a4f9ecf45e7cd6bba55" @@ -3005,7 +2965,7 @@ node-pre-gyp@^0.6.39: tar "^2.2.1" tar-pack "^3.4.0" -nopt@3.x, nopt@~3.0.1: +nopt@3.x: version "3.0.6" resolved "https://registry.yarnpkg.com/nopt/-/nopt-3.0.6.tgz#c6465dbf08abcd4db359317f79ac68a646b28ff9" dependencies: @@ -3547,6 +3507,10 @@ preserve@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b" +prettier@^1.8.2: + version "1.8.2" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.8.2.tgz#bff83e7fd573933c607875e5ba3abbdffb96aeb8" + process-nextick-args@~1.0.6: version "1.0.7" resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-1.0.7.tgz#150e20b756590ad3f91093f25a4f2ad8bff30ba3" @@ -3589,10 +3553,6 @@ prop-types@^15.5.10: loose-envify "^1.3.1" object-assign "^4.1.1" -proto-list@~1.2.1: - version "1.2.4" - resolved "https://registry.yarnpkg.com/proto-list/-/proto-list-1.2.4.tgz#212d5bfe1318306a420f6402b8e26ff39647a849" - proxy-addr@~1.0.10: version "1.0.10" resolved "https://registry.yarnpkg.com/proxy-addr/-/proxy-addr-1.0.10.tgz#0d40a82f801fc355567d2ecb65efe3f077f121c5" @@ -3604,7 +3564,7 @@ prr@~1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/prr/-/prr-1.0.1.tgz#d3fc114ba06995a45ec6893f484ceb1d78f5f476" -pseudomap@^1.0.1, pseudomap@^1.0.2: +pseudomap@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3" @@ -4024,7 +3984,7 @@ semver@5.3.0: version "5.3.0" resolved "https://registry.yarnpkg.com/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f" -semver@^5.1.0, semver@^5.3.0: +semver@^5.3.0: version "5.4.1" resolved "https://registry.yarnpkg.com/semver/-/semver-5.4.1.tgz#e059c09d8571f0540823733433505d3a2f00b18e" @@ -4165,10 +4125,6 @@ should@^11.1.1: should-type-adaptors "^1.0.1" should-util "^1.0.0" -sigmund@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/sigmund/-/sigmund-1.0.1.tgz#3ff21f198cad2175f9f3b781853fd94d0d19b590" - signal-exit@^3.0.0, signal-exit@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d"