diff --git a/.editorconfig b/.editorconfig index 58db51158..d18a28ff4 100644 --- a/.editorconfig +++ b/.editorconfig @@ -12,7 +12,7 @@ insert_final_newline = true indent_size = 4 insert_final_newline = false -[website/blog/*.md] +[{,website/blog/,changelog_unreleased/**/}*.md] trim_trailing_whitespace = false [tests/{**/__snapshots__/*, tests/format/**/*}] diff --git a/.eslintrc.js b/.eslintrc.js index 562538ab6..b2932680e 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -4,7 +4,7 @@ const { isCI } = require("ci-info"); module.exports = { root: true, env: { - es2020: true, + es2021: true, node: true, }, extends: ["eslint:recommended", "prettier"], @@ -89,7 +89,7 @@ module.exports = { }, ], - "import/extensions": ["error", "always", { ignorePackages: true }], + "import/extensions": ["error", "ignorePackages"], "import/no-extraneous-dependencies": [ "error", { @@ -118,6 +118,8 @@ module.exports = { "unicorn/new-for-builtins": "error", "unicorn/no-array-for-each": "error", "unicorn/no-array-push-push": "error", + "unicorn/no-new-array": "error", + "unicorn/no-useless-length-check": "error", "unicorn/no-useless-undefined": "error", "unicorn/prefer-array-flat": [ "error", @@ -126,12 +128,15 @@ module.exports = { }, ], "unicorn/prefer-array-flat-map": "error", + "unicorn/prefer-array-some": "error", "unicorn/prefer-includes": "error", "unicorn/prefer-number-properties": "error", "unicorn/prefer-optional-catch-binding": "error", "unicorn/prefer-regexp-test": "error", "unicorn/prefer-spread": "error", "unicorn/prefer-string-slice": "error", + "unicorn/prefer-string-starts-ends-with": "error", + "unicorn/prefer-type-error": "error", }, overrides: [ { @@ -168,6 +173,7 @@ module.exports = { alwaysAwait: true, }, ], + "jest/prefer-to-be": "error", }, }, { diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs index 9423d6060..17a8b818f 100644 --- a/.git-blame-ignore-revs +++ b/.git-blame-ignore-revs @@ -5,6 +5,8 @@ # See https://git-scm.com/docs/git-blame#Documentation/git-blame.txt---ignore-revs-fileltfilegt # Prettier bump after release +# 2.4.1 +2b5b22056e7e180ba52b04c849b6e8a1e26d87d1 # 2.4.0 ef514b9b5c817cf5105bac31a59e88cbdbdf189b # 2.3.2 diff --git a/.github/ISSUE_TEMPLATE/formatting.md b/.github/ISSUE_TEMPLATE/formatting.md index 4d1086e84..0e49a3b9a 100644 --- a/.github/ISSUE_TEMPLATE/formatting.md +++ b/.github/ISSUE_TEMPLATE/formatting.md @@ -26,7 +26,7 @@ Don't fill the form below manually! Let a program create a report for you: --> -**Prettier 2.4.0** +**Prettier 2.4.1** [Playground link](https://prettier.io/playground/#.....) ```sh diff --git a/.github/ISSUE_TEMPLATE/integration.md b/.github/ISSUE_TEMPLATE/integration.md index 392f0594a..ad20de82a 100644 --- a/.github/ISSUE_TEMPLATE/integration.md +++ b/.github/ISSUE_TEMPLATE/integration.md @@ -20,7 +20,7 @@ BEFORE SUBMITTING AN ISSUE: **Environments:** -- Prettier Version: 2.4.0 +- Prettier Version: 2.4.1 - Running Prettier via: - Runtime: - Operating System: diff --git a/.github/workflows/dev-package-test.yml b/.github/workflows/dev-package-test.yml index dd3b770f2..e2e8f0e4d 100644 --- a/.github/workflows/dev-package-test.yml +++ b/.github/workflows/dev-package-test.yml @@ -34,7 +34,7 @@ jobs: uses: actions/checkout@v2.3.4 - name: Setup Node.js - uses: actions/setup-node@v2.4.0 + uses: actions/setup-node@v2.4.1 with: node-version: ${{ matrix.node }} cache: "yarn" diff --git a/.github/workflows/dev-test.yml b/.github/workflows/dev-test.yml index e2380b568..de595426e 100644 --- a/.github/workflows/dev-test.yml +++ b/.github/workflows/dev-test.yml @@ -19,13 +19,13 @@ jobs: - "macos-latest" - "windows-latest" node: - - "16.8.0" + - "16" - "14" - "12" include: # only enable coverage on the fastest job - os: "ubuntu-latest" - node: "16.8.0" + node: "16" ENABLE_CODE_COVERAGE: true FULL_TEST: true CHECK_TEST_PARSERS: true @@ -48,7 +48,7 @@ jobs: fetch-depth: 2 - name: Setup Node.js - uses: actions/setup-node@v2.4.0 + uses: actions/setup-node@v2.4.1 with: node-version: ${{ matrix.node }} cache: "yarn" @@ -65,7 +65,7 @@ jobs: run: yarn test --maxWorkers=2 - name: Upload Coverage - uses: codecov/codecov-action@v2.0.3 + uses: codecov/codecov-action@v2.1.0 if: ${{ matrix.ENABLE_CODE_COVERAGE }} with: fail_ci_if_error: true @@ -77,7 +77,7 @@ jobs: PRETTIER_FALLBACK_RESOLVE: true - name: Upload Coverage (PRETTIER_FALLBACK_RESOLVE) - uses: codecov/codecov-action@v2.0.3 + uses: codecov/codecov-action@v2.1.0 if: ${{ matrix.ENABLE_CODE_COVERAGE }} with: fail_ci_if_error: true diff --git a/.github/workflows/eslint-rules.yml b/.github/workflows/eslint-rules.yml index 718ab4a71..b2069847d 100644 --- a/.github/workflows/eslint-rules.yml +++ b/.github/workflows/eslint-rules.yml @@ -19,7 +19,7 @@ jobs: uses: actions/checkout@v2.3.4 - name: Setup Node.js - uses: actions/setup-node@v2.4.0 + uses: actions/setup-node@v2.4.1 with: cache: "yarn" diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 2e9dd613c..5b68332be 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -17,7 +17,7 @@ jobs: uses: actions/checkout@v2.3.4 - name: Setup Node.js - uses: actions/setup-node@v2.4.0 + uses: actions/setup-node@v2.4.1 with: cache: "yarn" diff --git a/.github/workflows/lock.yml b/.github/workflows/lock.yml index 6f8df0eff..5207ea059 100644 --- a/.github/workflows/lock.yml +++ b/.github/workflows/lock.yml @@ -8,13 +8,13 @@ jobs: lock: runs-on: ubuntu-latest steps: - - uses: dessant/lock-threads@v2 + - uses: dessant/lock-threads@v3 with: # https://github.com/dessant/lock-threads github-token: ${{ github.token }} - issue-lock-inactive-days: "90" - issue-exclude-created-before: "" - issue-exclude-labels: "keep-unlocked, status:awaiting response" - issue-lock-labels: "locked-due-to-inactivity" - issue-lock-comment: "" + issue-inactive-days: "90" + exclude-issue-created-before: "" + exclude-any-issue-labels: "keep-unlocked, status:awaiting response" + add-issue-labels: "locked-due-to-inactivity" + issue-comment: "" issue-lock-reason: "resolved" diff --git a/.github/workflows/mark-issue-duplicate.yml b/.github/workflows/mark-issue-duplicate.yml index 388785f29..353fba50f 100644 --- a/.github/workflows/mark-issue-duplicate.yml +++ b/.github/workflows/mark-issue-duplicate.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest if: ${{ !github.event.issue.pull_request && startsWith(github.event.comment.body, 'Duplicate of ') }} steps: - - uses: actions-cool/issues-helper@v2.4.0 + - uses: actions-cool/issues-helper@v2.4.3 with: actions: "mark-duplicate" token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/prod-test.yml b/.github/workflows/prod-test.yml index e313a7aeb..b6cb06b1a 100644 --- a/.github/workflows/prod-test.yml +++ b/.github/workflows/prod-test.yml @@ -17,7 +17,7 @@ jobs: uses: actions/checkout@v2.3.4 - name: Setup Node.js - uses: actions/setup-node@v2.4.0 + uses: actions/setup-node@v2.4.1 with: cache: "yarn" @@ -63,7 +63,7 @@ jobs: uses: actions/checkout@v2.3.4 - name: Setup Node.js - uses: actions/setup-node@v2.4.0 + uses: actions/setup-node@v2.4.1 with: cache: "yarn" @@ -89,13 +89,13 @@ jobs: - "macos-latest" - "windows-latest" node: - - "16.8.0" + - "16" - "14" - "12" - "10" include: - os: "ubuntu-latest" - node: "16.8.0" + node: "16" FULL_TEST: true exclude: - os: "macos-latest" @@ -116,7 +116,7 @@ jobs: uses: actions/checkout@v2.3.4 - name: Setup Node.js - uses: actions/setup-node@v2.4.0 + uses: actions/setup-node@v2.4.1 with: node-version: ${{ matrix.node }} cache: "yarn" diff --git a/.github/workflows/release-script-test.yml b/.github/workflows/release-script-test.yml index 52470aae7..def825458 100644 --- a/.github/workflows/release-script-test.yml +++ b/.github/workflows/release-script-test.yml @@ -23,7 +23,7 @@ jobs: uses: actions/checkout@v2.3.4 - name: Setup Node.js - uses: actions/setup-node@v2.4.0 + uses: actions/setup-node@v2.4.1 with: version: "14" cache: "yarn" diff --git a/CHANGELOG.md b/CHANGELOG.md index 34fccfd16..f5dbcfdf4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,25 @@ +# 2.4.1 + +[diff](https://github.com/prettier/prettier/compare/2.4.0...2.4.1) + +#### Fix wildcard syntax in `@forward` ([#11482](https://github.com/prettier/prettier/pull/11482)) ([#11487](https://github.com/prettier/prettier/pull/11487) by [@niksy](https://github.com/niksy)) + + +```scss +// Input +@forward "library" as btn-*; + +// Prettier 2.4.0 +@forward "library" as btn- *; + +// Prettier 2.4.1 +@forward "library" as btn-*; +``` + +#### Add new CLI option `debug-print-ast` ([#11514](https://github.com/prettier/prettier/pull/11514) by [@sosukesuzuki](https://github.com/sosukesuzuki)) + +A new `--debug-print-ast` CLI flag for debugging. + # 2.4.0 [diff](https://github.com/prettier/prettier/compare/2.3.2...2.4.0) @@ -289,6 +311,7 @@ const foo = call<{ #### Fix order of `override` modifiers ([#10961](https://github.com/prettier/prettier/pull/10961) by [@sosukesuzuki](https://github.com/sosukesuzuki)) + ```ts // Input class Foo extends Bar { @@ -297,7 +320,7 @@ class Foo extends Bar { // Prettier stable class Foo extends Bar { - abstract override foo: string; + override abstract foo: string; } // Prettier main diff --git a/changelog_unreleased/cli/11514.md b/changelog_unreleased/cli/11514.md new file mode 100644 index 000000000..cc6ed95ac --- /dev/null +++ b/changelog_unreleased/cli/11514.md @@ -0,0 +1,3 @@ +#### Add new CLI option `debug-print-ast` (#11514 by @sosukesuzuki) + +A new `--debug-print-ast` CLI flag for debugging. diff --git a/changelog_unreleased/handlebars/11524.md b/changelog_unreleased/handlebars/11524.md new file mode 100644 index 000000000..09d8fd6c4 --- /dev/null +++ b/changelog_unreleased/handlebars/11524.md @@ -0,0 +1,14 @@ +#### Uses the opposite quote type for quotes inside mustache statements in attributes (#11524 by @bmaehr) + + +```hbs +{{!-- Input --}} +
+ +{{!-- Prettier main --}} +
+ +{{!-- Prettier stable --}} +
+ +``` diff --git a/changelog_unreleased/javascript/11593.md b/changelog_unreleased/javascript/11593.md new file mode 100644 index 000000000..2369da27a --- /dev/null +++ b/changelog_unreleased/javascript/11593.md @@ -0,0 +1,15 @@ +#### Fix parentheses around sequence expression as body of arrow chain (#11593 by @bakkot) + +The required parentheses around sequence expressions as the body of arrow functions were dropped for chained arrows, causing incorrect code to be generated. Now they are included. + + +```jsx +// Input +const f = () => () => (0, 1); + +// Prettier stable +const f = () => () => 0, 1; + +// Prettier main +const f = () => () => (0, 1); +``` diff --git a/changelog_unreleased/scss/11487.md b/changelog_unreleased/scss/11487.md new file mode 100644 index 000000000..f562cf488 --- /dev/null +++ b/changelog_unreleased/scss/11487.md @@ -0,0 +1,13 @@ +#### Fix wildcard syntax in `@forward` (#11482) (#11487 by @niksy) + + +```scss +// Input +@forward "library" as btn-*; + +// Prettier stable +@forward "library" as btn- *; + +// Prettier main +@forward "library" as btn-*; +``` diff --git a/docs/browser.md b/docs/browser.md index 8c650329e..0a741f408 100644 --- a/docs/browser.md +++ b/docs/browser.md @@ -32,8 +32,8 @@ See below for examples. ### Global ```html - - + + - + +