From c7c1d2e7a4234caadc0d72873d2cedf01db5b3c9 Mon Sep 17 00:00:00 2001 From: Lucas Azzola Date: Tue, 5 Dec 2017 21:14:03 +1100 Subject: [PATCH] Upgrade Prettier to Prettier 1.9 (#3395) * Upgrade to prettier@1.9.0 * Run eslint --fix * Run prettylint --fix * Fix playground with editorconfig script --- .prettierrc | 3 --- CHANGELOG.md | 2 +- docs/ignore.md | 2 +- package.json | 2 +- scripts/build/build-docs.js | 16 ++++------------ scripts/build/build.js | 4 +--- scripts/sync-flow-tests.js | 4 +--- src/cli-util.js | 8 ++------ website/static/worker.js | 3 ++- yarn.lock | 6 +++--- 10 files changed, 16 insertions(+), 34 deletions(-) delete mode 100644 .prettierrc diff --git a/.prettierrc b/.prettierrc deleted file mode 100644 index 3684c7cb..00000000 --- a/.prettierrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "proseWrap": false -} diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c8e858d..4df87222 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -315,7 +315,7 @@ Lots of small fixes, mainly for TypeScript. * [JSX] Break if opening element breaks (#942) * Parenthesize function expressions in expression position (#941) * update the README to add a pre-commit hook (#944) -* Fix #951: properly parenthesize \** expressions (#952) +* Fix #951: properly parenthesize \*\* expressions (#952) * [WIP] TypeScript Parser (#915) * Do not break long `describe` calls (#953) * Recursively find leading comments inside ReturnStatements (#955) diff --git a/docs/ignore.md b/docs/ignore.md index 568d0d99..a64b32b1 100644 --- a/docs/ignore.md +++ b/docs/ignore.md @@ -46,7 +46,7 @@ matrix(
{/* prettier-ignore */} -
; + ``` ## CSS diff --git a/package.json b/package.json index fd423a64..240ac45e 100644 --- a/package.json +++ b/package.json @@ -66,7 +66,7 @@ "eslint-plugin-react": "7.1.0", "jest": "21.1.0", "mkdirp": "0.5.1", - "prettier": "1.8.2", + "prettier": "1.9.0", "prettylint": "1.0.0", "rimraf": "2.6.2", "rollup": "0.41.6", diff --git a/scripts/build/build-docs.js b/scripts/build/build-docs.js index f1ed25e0..e02d5547 100644 --- a/scripts/build/build-docs.js +++ b/scripts/build/build-docs.js @@ -40,21 +40,15 @@ shell.mkdir("-p", docs); shell.echo("Bundling docs index..."); shell.cp(`${prettierPath}/index.js`, `${docs}/index.js`); shell.exec( - `node_modules/babel-cli/bin/babel.js ${docs}/index.js --out-file ${ - docs - }/index.js --presets=es2015` + `node_modules/babel-cli/bin/babel.js ${docs}/index.js --out-file ${docs}/index.js --presets=es2015` ); shell.echo("Bundling docs babylon..."); shell.exec( - `rollup -c scripts/build/rollup.docs.config.js --environment filepath:parser-babylon.js -i ${ - prettierPath - }/parser-babylon.js` + `rollup -c scripts/build/rollup.docs.config.js --environment filepath:parser-babylon.js -i ${prettierPath}/parser-babylon.js` ); shell.exec( - `node_modules/babel-cli/bin/babel.js ${docs}/parser-babylon.js --out-file ${ - docs - }/parser-babylon.js --presets=es2015` + `node_modules/babel-cli/bin/babel.js ${docs}/parser-babylon.js --out-file ${docs}/parser-babylon.js --presets=es2015` ); for (const parser of parsers) { @@ -63,9 +57,7 @@ for (const parser of parsers) { } shell.echo(`Bundling docs ${parser}...`); shell.exec( - `rollup -c scripts/build/rollup.docs.config.js --environment filepath:parser-${ - parser - }.js -i ${prettierPath}/parser-${parser}.js` + `rollup -c scripts/build/rollup.docs.config.js --environment filepath:parser-${parser}.js -i ${prettierPath}/parser-${parser}.js` ); } diff --git a/scripts/build/build.js b/scripts/build/build.js index 1943c6ca..d3d8c7bf 100755 --- a/scripts/build/build.js +++ b/scripts/build/build.js @@ -47,9 +47,7 @@ for (const parser of parsers) { } shell.echo(`Bundling lib ${parser}...`); shell.exec( - `rollup -c scripts/build/rollup.parser.config.js --environment parser:${ - parser - }` + `rollup -c scripts/build/rollup.parser.config.js --environment parser:${parser}` ); } diff --git a/scripts/sync-flow-tests.js b/scripts/sync-flow-tests.js index eff00165..02d38813 100644 --- a/scripts/sync-flow-tests.js +++ b/scripts/sync-flow-tests.js @@ -38,9 +38,7 @@ function syncTests(syncDir) { throw new Error( [ "Couldn't find any files to copy.", - `Please make sure that \`${ - syncDir - }\` exists and contains the flow tests.` + `Please make sure that \`${syncDir}\` exists and contains the flow tests.` ].join("\n") ); } diff --git a/src/cli-util.js b/src/cli-util.js index d363a640..50e401b9 100644 --- a/src/cli-util.js +++ b/src/cli-util.js @@ -506,9 +506,7 @@ function getOptionWithLevenSuggestion(options, optionName) { if (suggestedOptionNameContainer !== undefined) { const suggestedOptionName = suggestedOptionNameContainer.value; logger.warn( - `Unknown option name "${optionName}", did you mean "${ - suggestedOptionName - }"?` + `Unknown option name "${optionName}", did you mean "${suggestedOptionName}"?` ); return options[suggestedOptionNameContainer.index]; @@ -701,9 +699,7 @@ function normalizeConfig(type, rawConfig, options) { : `with value \`${rawValue}\``; const redirectName = getRedirectName(option, choice); consoleWarn( - `\`${optionName}\` ${ - warningDescription - } is deprecated. Prettier now treats it as: \`${redirectName}\`.` + `\`${optionName}\` ${warningDescription} is deprecated. Prettier now treats it as: \`${redirectName}\`.` ); return choice.redirect; } diff --git a/website/static/worker.js b/website/static/worker.js index d3b7ce78..f4554c61 100644 --- a/website/static/worker.js +++ b/website/static/worker.js @@ -11,7 +11,8 @@ self.Buffer = { } }; // eslint-disable-next-line -fs = module$1 = module = path = os = crypto = {}; +module$1 = module = path = os = crypto = {}; +self.fs = { readFile: function() {} }; // eslint-disable-next-line no-undef os.homedir = function() { return "/home/prettier"; diff --git a/yarn.lock b/yarn.lock index 944cc915..6292a6a0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3490,9 +3490,9 @@ 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" +prettier@1.9.0: + version "1.9.0" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.9.0.tgz#1a7205bdb6126b30cf8c0a7b2b86997162e1ee3e" pretty-format@^21.1.0: version "21.1.0"