Skip to content

Commit

Permalink
Merge branch 'master' of github.com:prettier/prettier into next
Browse files Browse the repository at this point in the history
* 'master' of github.com:prettier/prettier: (31 commits)
  Bump jest-watch-typeahead from 0.4.0 to 0.4.2 (#6923)
  Bump unified from 8.4.1 to 8.4.2 (#6927)
  refactoring: Babel's error recovery superseded option combinations (#6930)
  Update `fsevents` in yarn.lock (#6909)
  Run CI on the `next` branch
  Fix bin permissions (#6902)
  Add missing headings to changelog
  Fix code block in changelog
  Bump Prettier dependency to 1.19.1
  Release 1.19.1
  Quick-fix for stdin being broken in 1.19.0 (#6894)
  Fix `since` version for `vueIndentScriptAndStyle` (#6897)
  Remove out-of-date comment
  fix formatting of union type as arrow function return type (#6896)
  Try to fix some code blocks in 1.19.0 blog post
  Blog post, changelog and docs for 1.19 (#6787)
  Bump Prettier dependency to 1.19.0
  Release 1.19.0
  prettier 1.19.0-beta.1
  deduplicate entries in yarn.lock - part 2 (#6884)
  ...
  • Loading branch information
lipis committed Nov 12, 2019
2 parents ae1d9af + 1a419c0 commit f7c772f
Show file tree
Hide file tree
Showing 77 changed files with 2,313 additions and 1,645 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/formatting.md
Expand Up @@ -26,7 +26,7 @@ Tip! Don't write this stuff manually.
-->

**Prettier 1.18.2**
**Prettier 1.19.1**
[Playground link](https://prettier.io/playground/#.....)
```sh
# Options (if any):
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/integration.md
Expand Up @@ -19,7 +19,7 @@ BEFORE SUBMITTING AN ISSUE:
-->

**Environments:**
- Prettier Version: 1.18.2
- Prettier Version: 1.19.1
- Running Prettier via: <!-- CLI, Node.js API, Browser API, etc. -->
- Runtime: <!-- Node.js v6, Chrome v67, etc. -->
- Operating System: <!-- Windows, Linux, macOS, etc. -->
Expand Down
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Expand Up @@ -5,7 +5,7 @@

- [ ] I’ve added tests to confirm my change works.
- [ ] (If changing the API or CLI) I’ve documented the changes I’ve made (in the `docs/` directory)
- [ ] (If the change is user-facing) I’ve added my changes to the `CHANGELOG.unreleased.md` file following the template.
- [ ] (If the change is user-facing) I’ve added my changes to `changelog_unreleased/*/pr-XXXX.md` file following `changelog_unreleased/TEMPLATE.md`.
- [ ] I’ve read the [contributing guidelines](https://github.com/prettier/prettier/blob/master/CONTRIBUTING.md).

**[Try the playground for this PR](https://prettier.io/playground-redirect)**
50 changes: 50 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,53 @@
# 1.19.1

[diff](https://github.com/prettier/prettier/compare/1.19.0...1.19.1)

### CLI

#### Fix `--stdin` regression in 1.19.0 ([#6894](https://github.com/prettier/prettier/pull/6894) by [@lydell](https://github.com/lydell))

<!-- prettier-ignore -->
```
// Prettier stable
$ echo "test" | prettier --stdin --parser babel
[error] regeneratorRuntime is not defined
// Prettier master
$ echo "test" | prettier --stdin --parser babel
test;
```

### TypeScript

#### Fix formatting of union type as arrow function return type ([#6896](https://github.com/prettier/prettier/pull/6896) by [@thorn0](https://github.com/thorn0))

<!-- prettier-ignore -->
```jsx
// Input
export const getVehicleDescriptor = async (
vehicleId: string,
): Promise<Collections.Parts.PrintedCircuitBoardAssembly['attributes'] | undefined> => {}

// Prettier stable
export const getVehicleDescriptor = async (
vehicleId: string
): Promise<| Collections.Parts.PrintedCircuitBoardAssembly["attributes"]
| undefined> => {};

// Prettier master
export const getVehicleDescriptor = async (
vehicleId: string
): Promise<
Collections.Parts.PrintedCircuitBoardAssembly["attributes"] | undefined
> => {};
```

# 1.19.0

[diff](https://github.com/prettier/prettier/compare/1.18.2...1.19.0)

🔗 [Release Notes](https://prettier.io/blog/2019/11/09/1.19.0.html)

# 1.18.2

[diff](https://github.com/prettier/prettier/compare/1.18.1...1.18.2)
Expand Down
1 change: 1 addition & 0 deletions azure-pipelines.yml
@@ -1,5 +1,6 @@
trigger:
- master
- next
- release-*

variables:
Expand Down
39 changes: 39 additions & 0 deletions changelog_unreleased/TEMPLATE.md
@@ -0,0 +1,39 @@
<!--
1. Choose a folder based on which language your PR is for.
- For JavaScript, choose `javascript/` etc.
- For TypeScript specific syntax, choose `typescript/`.
- If your PR applies to multiple languages, such as TypeScript/Flow, choose one folder and mention which languages it applies to.
2. In your chosen folder, create a file with your PR number: `pr-XXXX.md`. For example: `typescript/pr-6728.md`.
3. Copy the content below and paste it in your new file.
4. Fill in a title, the PR number and your user name.
5. Optionally write a description. Many times it’s enough with just sample code.
6. Change ```jsx to your language. For example, ```yaml.
7. Change the `// Input` and `// Prettier` comments to the comment syntax of your language. For example, `# Input`.
8. Choose some nice input example code. Paste it along with the output before and after your PR.
-->

#### Title ([#XXXX](https://github.com/prettier/prettier/pull/XXXX) by [@user](https://github.com/user))

Optional description if it makes sense.

<!-- prettier-ignore -->
```jsx
// Input
(foo ?? baz) || baz;

// Prettier stable
foo ?? baz || baz;

// Prettier master
(foo ?? baz) || baz;
```
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
5 changes: 4 additions & 1 deletion cspell.json
Expand Up @@ -288,6 +288,7 @@
"React's",
"readline",
"readlines",
"rebalance",
"rebeccapurple",
"recurse",
"recurses",
Expand Down Expand Up @@ -337,6 +338,7 @@
"superset",
"supertypes",
"swac",
"systemjs",
"tdeekens",
"templating",
"tempy",
Expand All @@ -362,6 +364,7 @@
"unparenthesized",
"unparseable",
"unpause",
"unpkg",
"unrestrict",
"untracked",
"valourous",
Expand Down Expand Up @@ -396,4 +399,4 @@
"ve{2,}r{2,}y",
"ve+r+y+long\\w*"
]
}
}
22 changes: 12 additions & 10 deletions docs/browser.md
Expand Up @@ -3,7 +3,7 @@ id: browser
title: Browser
---

Run Prettier in the browser with the `standalone.js` UMD bundle shipped in the NPM package (starting in version 1.13). The new UMD bundle only formats the code and has no support for config files, ignore files, CLI usage, or automatic loading of plugins.
Run Prettier in the browser with the `standalone.js` UMD bundle shipped in the NPM package (starting in version 1.13). The UMD bundle only formats the code and has no support for config files, ignore files, CLI usage, or automatic loading of plugins.

### `prettier.format(code, options)`

Expand All @@ -15,12 +15,14 @@ See [Usage](#usage) below for examples.

### Global

<!-- prettier-ignore -->
```html
<script src="https://unpkg.com/prettier@1.13.0/standalone.js"></script>
<script src="https://unpkg.com/prettier@1.13.0/parser-graphql.js"></script>
<script type="text/javascript">
prettier.format("query { }", { parser: "graphql", plugins: prettierPlugins });
<script src="https://unpkg.com/prettier@1.19.1/standalone.js"></script>
<script src="https://unpkg.com/prettier@1.19.1/parser-graphql.js"></script>
<script>
prettier.format("query { }", {
parser: "graphql",
plugins: prettierPlugins
});
</script>
```

Expand All @@ -40,8 +42,8 @@ prettier.format("query { }", {

```js
define([
"https://unpkg.com/prettier@1.13.0/standalone.js",
"https://unpkg.com/prettier@1.13.0/parser-graphql.js"
"https://unpkg.com/prettier@1.19.1/standalone.js",
"https://unpkg.com/prettier@1.19.1/parser-graphql.js"
], (prettier, ...plugins) => {
prettier.format("query { }", { parser: "graphql", plugins });
});
Expand All @@ -60,7 +62,7 @@ This syntax doesn't necessarily work in the browser, but it can be used when bun
### Worker

```js
importScripts("https://unpkg.com/prettier@1.13.0/standalone.js");
importScripts("https://unpkg.com/prettier@1.13.0/parser-graphql.js");
importScripts("https://unpkg.com/prettier@1.19.1/standalone.js");
importScripts("https://unpkg.com/prettier@1.19.1/parser-graphql.js");
prettier.format("query { }", { parser: "graphql", plugins: prettierPlugins });
```
2 changes: 1 addition & 1 deletion docs/integrating-with-linters.md
Expand Up @@ -124,7 +124,7 @@ Then in `tslint.json`:

### Disable formatting rules

[`stylelint-config-prettier`](https://github.com/prettier/stylelint-config-prettier) is a config that disables rules that conflict with Prettier. Add it to your `devDependencies`, then extend from it within your `.stylelintrc` configuration. Make sure to put it last in the `extends` array, so it gets the chance to override other configs.
[`stylelint-config-prettier`](https://github.com/prettier/stylelint-config-prettier) is a config that disables rules that conflict with Prettier. Add it to your [`devDependencies`], then extend from it within your `.stylelintrc` configuration. Make sure to put it last in the `extends` array, so it gets the chance to override other configs.

```bash
yarn add --dev stylelint-config-prettier
Expand Down
6 changes: 4 additions & 2 deletions docs/rationale.md
Expand Up @@ -132,9 +132,11 @@ One final thing: TC39 has [not yet decided if decorators come before or after `e

```js
@decorator
export class Foo { }
export class Foo {}

export @decorator class Foo { }
export
@decorator
class Foo {}
```

### Semicolons
Expand Down
22 changes: 11 additions & 11 deletions package.json
@@ -1,6 +1,6 @@
{
"name": "prettier",
"version": "1.18.2",
"version": "1.20.0-dev",
"description": "Prettier is an opinionated code formatter",
"bin": {
"prettier": "./bin/prettier.js"
Expand All @@ -16,7 +16,7 @@
"dependencies": {
"@angular/compiler": "8.2.13",
"@babel/code-frame": "7.5.5",
"@babel/parser": "7.7.2",
"@babel/parser": "7.7.3",
"@glimmer/syntax": "0.41.0",
"@iarna/toml": "2.2.3",
"@typescript-eslint/typescript-estree": "2.6.1",
Expand All @@ -35,8 +35,8 @@
"esutils": "2.0.3",
"find-parent-dir": "0.3.0",
"find-project-root": "1.1.1",
"flow-parser": "0.111.1",
"get-stream": "5.1.0",
"flow-parser": "0.111.3",
"get-stream": "4.1.0",
"globby": "6.1.0",
"graphql": "14.5.8",
"html-element-attributes": "2.2.0",
Expand Down Expand Up @@ -69,19 +69,19 @@
"string-width": "4.1.0",
"typescript": "3.7.2",
"unicode-regex": "3.0.0",
"unified": "8.4.1",
"unified": "8.4.2",
"vnopts": "1.0.2",
"yaml-unist-parser": "1.1.1"
},
"devDependencies": {
"@babel/core": "7.7.0",
"@babel/core": "7.7.2",
"@babel/preset-env": "7.7.1",
"@rollup/plugin-alias": "2.2.0",
"@rollup/plugin-replace": "2.2.0",
"@rollup/plugin-replace": "2.2.1",
"babel-loader": "8.0.6",
"benchmark": "2.1.4",
"builtin-modules": "3.1.0",
"codecov": "codecov/codecov-node#e427d900309adb50746a39a50aa7d80071a5ddd0",
"codecov": "3.6.1",
"cross-env": "6.0.3",
"eslint": "6.6.0",
"eslint-config-prettier": "6.5.0",
Expand All @@ -94,9 +94,9 @@
"jest-junit": "9.0.0",
"jest-snapshot-serializer-ansi": "1.0.0",
"jest-snapshot-serializer-raw": "1.1.0",
"jest-watch-typeahead": "0.4.0",
"jest-watch-typeahead": "0.4.2",
"mkdirp": "0.5.1",
"prettier": "1.18.2",
"prettier": "1.19.1",
"prettylint": "1.0.0",
"rimraf": "3.0.0",
"rollup": "1.26.3",
Expand Down Expand Up @@ -130,6 +130,6 @@
"build": "node --max-old-space-size=3072 ./scripts/build/build.js",
"build-docs": "node ./scripts/build-docs.js",
"check-deps": "node ./scripts/check-deps.js",
"spellcheck": "npx -p cspell@4.0.31 cspell {bin,scripts,src}/**/*.js {docs,website/blog}/**/*.md CHANGELOG.unreleased.md"
"spellcheck": "npx -p cspell@4.0.31 cspell {bin,scripts,src}/**/*.js {docs,website/blog,changelog_unreleased}/**/*.md"
}
}
2 changes: 1 addition & 1 deletion scripts/build/build.js
Expand Up @@ -99,7 +99,7 @@ async function run(params) {
await execa("rm", ["-rf", ".cache"]);
}

const bundleCache = new Cache(".cache/", "v18");
const bundleCache = new Cache(".cache/", "v19");
await bundleCache.load();

console.log(chalk.inverse(" Building packages "));
Expand Down
19 changes: 10 additions & 9 deletions scripts/build/rollup-plugins/executable.js
Expand Up @@ -6,13 +6,17 @@ const path = require("path");
module.exports = function() {
let banner;
let entry;
let file;

return {
name: "executable",

options(options) {
entry = path.resolve(options.input);
return options;
options(inputOptions) {
entry = path.resolve(inputOptions.input);
},

generateBundle(outputOptions) {
file = outputOptions.file;
},

load(id) {
Expand All @@ -36,12 +40,9 @@ module.exports = function() {
}
},

writeBundle(bundle) {
if (banner) {
const files = Object.keys(bundle);
files.forEach(file => {
fs.chmodSync(bundle[file].facadeModuleId, 0o755 & ~process.umask());
});
writeBundle() {
if (banner && file) {
fs.chmodSync(file, 0o755 & ~process.umask());
}
}
};
Expand Down
2 changes: 0 additions & 2 deletions scripts/release/README.md
Expand Up @@ -3,8 +3,6 @@
## Usage

```sh
# set environment variable GITHUB_API_TOKEN if it's a patch release
# since we need to get merged PRs from GitHub to generate changelog
node ./scripts/release/release.js --version NEW_VERSION
```

Expand Down
2 changes: 1 addition & 1 deletion scripts/release/steps/update-changelog.js
Expand Up @@ -57,7 +57,7 @@ module.exports = async function({ version, previousVersion }) {
dedent(chalk`
{yellow.bold A manual step is necessary.}
You can copy the entries from {bold CHANGELOG.unreleased.md} to {bold CHANGELOG.md}
You can copy the entries from {bold changelog_unreleased/*/pr-*.md} to {bold CHANGELOG.md}
and update it accordingly.
You don't need to commit the file, the script will take care of that.
Expand Down
5 changes: 5 additions & 0 deletions scripts/release/steps/update-version.js
Expand Up @@ -16,6 +16,11 @@ async function bump({ version }) {
content.replace(/^(- Prettier Version: ).*?$/m, `$1${version}`)
);

// Update unpkg link in docs
processFile("docs/browser.md", content =>
content.replace(/(\/\/unpkg\.com\/prettier@)(?:.*?)\//g, `$1${version}/`)
);

await execa("yarn", ["update-stable-docs"], {
cwd: "./website"
});
Expand Down
3 changes: 2 additions & 1 deletion src/language-css/printer-postcss.js
Expand Up @@ -593,7 +593,8 @@ function genericPrint(path, options, print) {
(isAdditionNode(iNode) || isSubtractionNode(iNode)) &&
i === 0 &&
(iNextNode.type === "value-number" || iNextNode.isHex) &&
(parentParentNode && isColorAdjusterFuncNode(parentParentNode)) &&
parentParentNode &&
isColorAdjusterFuncNode(parentParentNode) &&
!hasEmptyRawBefore(iNextNode);

const requireSpaceBeforeOperator =
Expand Down

0 comments on commit f7c772f

Please sign in to comment.