diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 84c7056e5..cef29130e 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -4,7 +4,7 @@ const { isCI } = require("ci-info"); module.exports = { root: true, env: { - es2021: true, + es2022: true, node: true, }, parserOptions: { @@ -42,9 +42,6 @@ module.exports = { "error", // `!foo === bar` and `!foo !== bar` 'BinaryExpression[operator=/^[!=]==$/] > UnaryExpression.left[operator="!"]', - // `(() => (foo ? bar : baz))()` - // TODO: Remove this when https://github.com/sindresorhus/eslint-plugin-unicorn/issues/1730 get implemented - 'CallExpression[callee.type="ArrowFunctionExpression"][callee.body.type="ConditionalExpression"]', ], "no-return-await": "error", "no-unneeded-ternary": "error", @@ -135,6 +132,7 @@ module.exports = { "unicorn/no-array-for-each": "error", "unicorn/no-array-push-push": "error", "unicorn/no-new-array": "error", + "unicorn/no-unreadable-iife": "error", "unicorn/no-useless-length-check": "error", "unicorn/no-useless-promise-resolve-reject": "error", "unicorn/no-useless-undefined": "error", @@ -149,6 +147,7 @@ module.exports = { "unicorn/prefer-includes": "error", "unicorn/prefer-json-parse-buffer": "error", "unicorn/prefer-module": "error", + "unicorn/prefer-native-coercion-functions": "error", "unicorn/prefer-node-protocol": "error", "unicorn/prefer-number-properties": "error", "unicorn/prefer-optional-catch-binding": "error", @@ -174,6 +173,12 @@ module.exports = { }, }, // CommonJS modules + { + files: ["scripts/**/*.mjs"], + rules: { + "unicorn/prefer-top-level-await": "error", + }, + }, { files: [ "**/*.cjs", diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs index 59c5329f1..a1c6ec65b 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.6.2 +e2d9e9139d34043c8e6c45cda2777de013340e2e # 2.6.1 678fe1562dc1347fc0539334ee5cbaea79ea8af7 # 2.6.0 diff --git a/.github/ISSUE_TEMPLATE/formatting.md b/.github/ISSUE_TEMPLATE/formatting.md index 933be908f..d1b763348 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.6.1** +**Prettier 2.6.2** [Playground link](https://prettier.io/playground/#.....) ```sh diff --git a/.github/ISSUE_TEMPLATE/integration.md b/.github/ISSUE_TEMPLATE/integration.md index be0385ced..9034f876b 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.6.1 +- Prettier Version: 2.6.2 - Running Prettier via: - Runtime: - Operating System: diff --git a/.github/workflows/check-sizes.yml b/.github/workflows/check-sizes.yml new file mode 100644 index 000000000..68b1bd877 --- /dev/null +++ b/.github/workflows/check-sizes.yml @@ -0,0 +1,26 @@ +name: Check Sizes + +on: + pull_request: + +jobs: + check-sizes: + name: Check Sizes + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + cache: "yarn" + + # This step calls `git reset` + # It should be the last step + - name: Check Sizes + uses: preactjs/compressed-size-action@2.5.0 + with: + repo-token: "${{ secrets.GITHUB_TOKEN }}" + pattern: "./dist/**/*" + compression: none diff --git a/.github/workflows/dev-package-test.yml b/.github/workflows/dev-package-test.yml index 3da079dd4..b3941fe37 100644 --- a/.github/workflows/dev-package-test.yml +++ b/.github/workflows/dev-package-test.yml @@ -21,7 +21,7 @@ jobs: - "ubuntu-latest" node: # Run tests on minimal version we support - - "12" + - "14" NPM_CLIENT: - "yarn" - "npm" diff --git a/.github/workflows/dev-test.yml b/.github/workflows/dev-test.yml index c1768f374..0b14f7932 100644 --- a/.github/workflows/dev-test.yml +++ b/.github/workflows/dev-test.yml @@ -19,21 +19,20 @@ jobs: - "macos-latest" - "windows-latest" node: - - "16.10.0" + - "16" - "14" - - "12" include: # only enable coverage on the fastest job - os: "ubuntu-latest" - node: "16.10.0" + node: "16" ENABLE_CODE_COVERAGE: true FULL_TEST: true CHECK_TEST_PARSERS: true - exclude: - - os: "macos-latest" - node: "14" - - os: "windows-latest" - node: "14" + # exclude: + # - os: "macos-latest" + # node: "14" + # - os: "windows-latest" + # node: "14" env: ENABLE_CODE_COVERAGE: ${{ matrix.ENABLE_CODE_COVERAGE }} FULL_TEST: ${{ matrix.FULL_TEST }} @@ -43,9 +42,6 @@ jobs: steps: - name: Checkout uses: actions/checkout@v3 - # `codecov/codecov-action` require depth to be at least `2`, see #10219 - with: - fetch-depth: 2 - name: Setup Node.js uses: actions/setup-node@v3 diff --git a/.github/workflows/prevent-file-change.yml b/.github/workflows/prevent-file-change.yml new file mode 100644 index 000000000..da740ab60 --- /dev/null +++ b/.github/workflows/prevent-file-change.yml @@ -0,0 +1,17 @@ +name: Prevent File change + +on: + pull_request: + paths: + - "website/data/users.yml" + +jobs: + prevent-add-users: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Prevent file change + uses: xalvarez/prevent-file-change-action@v1 + with: + githubToken: ${{ secrets.GITHUB_TOKEN }} + pattern: website/data/users.yml diff --git a/.github/workflows/prod-test.yml b/.github/workflows/prod-test.yml index 41b31915f..4e5382a17 100644 --- a/.github/workflows/prod-test.yml +++ b/.github/workflows/prod-test.yml @@ -33,16 +33,6 @@ jobs: name: dist path: dist - # This step calls `git reset` - # It should be the last step - - name: Check Sizes - if: ${{ github.event_name == 'pull_request' && startsWith(github.head_ref, 'dependabot/npm_and_yarn/') }} - uses: preactjs/compressed-size-action@2.5.0 - with: - repo-token: "${{ secrets.GITHUB_TOKEN }}" - pattern: "./dist/**/*" - compression: none - lint: name: Lint runs-on: ubuntu-latest @@ -78,12 +68,12 @@ jobs: - "macos-latest" - "windows-latest" node: - - "16.10.0" + - "16" - "14" - "12" include: - os: "ubuntu-latest" - node: "16.10.0" + node: "16" FULL_TEST: true exclude: - os: "macos-latest" @@ -105,6 +95,10 @@ jobs: node-version: ${{ matrix.node }} cache: "yarn" + - name: Config `ignore-engines=true` (Node.js < 14) + if: ${{ matrix.node == '12' }} + run: yarn config set ignore-engines true + - name: Install Dependencies run: yarn install --frozen-lockfile diff --git a/.github/workflows/release-script-test.yml b/.github/workflows/release-script-test.yml index 232979f74..b4a4a8255 100644 --- a/.github/workflows/release-script-test.yml +++ b/.github/workflows/release-script-test.yml @@ -25,7 +25,6 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v3 with: - node-version: "14" cache: "yarn" - name: Install Dependencies diff --git a/.gitignore b/.gitignore index 20509cd82..5cd3b582d 100644 --- a/.gitignore +++ b/.gitignore @@ -20,7 +20,7 @@ /coverage .idea package-lock.json -.yarn/* +**/.yarn/* !.yarn/releases !.yarn/plugins !.yarn/sdks diff --git a/CHANGELOG.md b/CHANGELOG.md index baa01fe21..af8d402c5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,61 @@ +# 2.6.2 + +[diff](https://github.com/prettier/prettier/compare/2.6.1...2.6.2) + +#### Fix LESS/SCSS format error ([#12536](https://github.com/prettier/prettier/pull/12536) by [@fisker](https://github.com/fisker)) + + +```less +// Input +.background-gradient(@cut) { + background: linear-gradient( + to right, + @white 0%, + @white (@cut - 0.01%), + @portal-background @cut, + @portal-background 100% + ); +} + +// Prettier 2.6.1 +TypeError: Cannot read properties of undefined (reading 'endOffset') + +// Prettier 2.6.2 +.background-gradient(@cut) { + background: linear-gradient( + to right, + @white 0%, + @white (@cut - 0.01%), + @portal-background @cut, + @portal-background 100% + ); +} +``` + +#### Update `meriyah` to fix several bugs ([#12567](https://github.com/prettier/prettier/pull/12567) by [@fisker](https://github.com/fisker), fixes in [`meriyah`](https://github.com/meriyah/meriyah/) by [@3cp](https://github.com/3cp)) + +Fixes bugs when parsing following valid code: + +```js +foo(await bar()); +``` + +```js +const regex = /.*/ms; +``` + +```js +const element =
{/w/.test(s)}
; +``` + +```js +class A extends B { + #privateMethod() { + super.method(); + } +} +``` + # 2.6.1 [diff](https://github.com/prettier/prettier/compare/2.6.0...2.6.1) diff --git a/changelog_unreleased/less/12536.md b/changelog_unreleased/less/12536.md deleted file mode 100644 index e73796d3a..000000000 --- a/changelog_unreleased/less/12536.md +++ /dev/null @@ -1,29 +0,0 @@ -#### Fix LESS/SCSS format error (#12536 by @fisker) - - -```less -// Input -.background-gradient(@cut) { - background: linear-gradient( - to right, - @white 0%, - @white (@cut - 0.01%), - @portal-background @cut, - @portal-background 100% - ); -} - -// Prettier stable -TypeError: Cannot read properties of undefined (reading 'endOffset') - -// Prettier main -.background-gradient(@cut) { - background: linear-gradient( - to right, - @white 0%, - @white (@cut - 0.01%), - @portal-background @cut, - @portal-background 100% - ); -} -``` diff --git a/docs/browser.md b/docs/browser.md index 9931cdc79..5e0852d23 100644 --- a/docs/browser.md +++ b/docs/browser.md @@ -32,8 +32,8 @@ See below for examples. ### Global ```html - - + + - + +