diff --git a/.editorconfig b/.editorconfig index 58db511587d7..3e5834d004f0 100644 --- a/.editorconfig +++ b/.editorconfig @@ -10,9 +10,8 @@ insert_final_newline = true [cspell.json] 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/.eslintignore b/.eslintignore index 1c82b7c66a77..62c92fb575a9 100644 --- a/.eslintignore +++ b/.eslintignore @@ -11,3 +11,4 @@ /website/build/ /website/static/playground.js /website/static/lib/ +/vendors/ diff --git a/.eslintrc.js b/.eslintrc.js index 562538ab626b..45ea5747375b 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -4,20 +4,28 @@ const { isCI } = require("ci-info"); module.exports = { root: true, env: { - es2020: true, + es2021: true, node: true, }, + reportUnusedDisableDirectives: true, extends: ["eslint:recommended", "prettier"], - plugins: ["prettier-internal-rules", "import", "regexp", "unicorn"], + plugins: [ + "prettier-internal-rules", + "import", + "regexp", + "unicorn", + "@typescript-eslint", + ], settings: { "import/internal-regex": "^linguist-languages/", }, rules: { + "@typescript-eslint/prefer-ts-expect-error": "error", "arrow-body-style": ["error", "as-needed"], curly: "error", "dot-notation": "error", eqeqeq: "error", - "no-console": isCI ? "error" : "off", + "no-console": isCI ? "error" : "warn", "no-else-return": [ "error", { @@ -30,6 +38,9 @@ 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", @@ -89,7 +100,7 @@ module.exports = { }, ], - "import/extensions": ["error", "always", { ignorePackages: true }], + "import/extensions": ["error", "ignorePackages"], "import/no-extraneous-dependencies": [ "error", { @@ -112,12 +123,17 @@ module.exports = { strictTypes: false, }, ], + "regexp/no-useless-lazy": "error", "unicorn/better-regex": "error", "unicorn/explicit-length-check": "error", + "unicorn/filename-case": "error", "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-promise-resolve-reject": "error", "unicorn/no-useless-undefined": "error", "unicorn/prefer-array-flat": [ "error", @@ -126,16 +142,25 @@ module.exports = { }, ], "unicorn/prefer-array-flat-map": "error", + "unicorn/prefer-array-some": "error", "unicorn/prefer-includes": "error", + "unicorn/prefer-json-parse-buffer": "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-switch": "error", + "unicorn/prefer-type-error": "error", }, overrides: [ { - files: ["scripts/**/*.js", "scripts/**/*.mjs"], + files: [ + "scripts/**/*.js", + "scripts/**/*.mjs", + "tests/config/install-prettier.js", + ], rules: { "no-console": "off", }, @@ -168,6 +193,13 @@ module.exports = { alwaysAwait: true, }, ], + "jest/prefer-to-be": "error", + }, + }, + { + files: ["tests/integration/**/*.js"], + rules: { + "prettier-internal-rules/await-cli-tests": "error", }, }, { @@ -182,12 +214,23 @@ module.exports = { }, }, { - files: ["src/cli/**/*.js"], + files: ["src/cli/*.js"], + rules: { + "no-restricted-modules": [ + "error", + { + patterns: ["../"], + }, + ], + }, + }, + { + files: ["src/cli/*/*.js"], rules: { "no-restricted-modules": [ "error", { - patterns: [".."], + patterns: ["../../"], }, ], }, @@ -225,14 +268,15 @@ module.exports = { "prettier-internal-rules/no-node-comments": [ "error", { - file: "src/language-js/utils.js", + file: "src/language-js/utils/index.js", functions: ["hasComment", "getComments"], }, "src/language-js/pragma.js", - "src/language-js/parse/postprocess.js", + "src/language-js/parse/postprocess/*.js", "src/language-js/parse/babel.js", "src/language-js/parse/meriyah.js", "src/language-js/parse/json.js", + "src/language-js/parse/acorn.js", ], }, }, @@ -253,6 +297,7 @@ module.exports = { "react/display-name": "off", "react/no-deprecated": "off", "react/prop-types": "off", + "unicorn/filename-case": "off", }, }, { @@ -261,5 +306,14 @@ module.exports = { sourceType: "module", }, }, + { + files: ["bin/prettier.js"], + parserOptions: { + ecmaVersion: 5, + }, + rules: { + "no-var": "off", + }, + }, ], }; diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs index 9423d6060b16..424e9b580cb5 100644 --- a/.git-blame-ignore-revs +++ b/.git-blame-ignore-revs @@ -5,6 +5,12 @@ # See https://git-scm.com/docs/git-blame#Documentation/git-blame.txt---ignore-revs-fileltfilegt # Prettier bump after release +# 2.5.1 +4683a6284d53b913f129694a5be666fc55b06982 +# 2.5.0 +846dbdd7e8c9deb315b3e663b3103c559e798a89 +# 2.4.1 +2b5b22056e7e180ba52b04c849b6e8a1e26d87d1 # 2.4.0 ef514b9b5c817cf5105bac31a59e88cbdbdf189b # 2.3.2 diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index d7a05e9c639c..f34e74976614 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,2 +1,2 @@ -tidelift: npm/prettier open_collective: prettier +tidelift: npm/prettier diff --git a/.github/ISSUE_TEMPLATE/formatting.md b/.github/ISSUE_TEMPLATE/formatting.md index 0e49a3b9a36c..2a04b151779e 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.1** +**Prettier 2.6.0** [Playground link](https://prettier.io/playground/#.....) ```sh diff --git a/.github/ISSUE_TEMPLATE/integration.md b/.github/ISSUE_TEMPLATE/integration.md index ad20de82a127..25a39a882c5c 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.1 +- Prettier Version: 2.6.0 - Running Prettier via: - Runtime: - Operating System: diff --git a/.github/workflows/dev-package-test.yml b/.github/workflows/dev-package-test.yml index dd3b770f216b..7b4270853640 100644 --- a/.github/workflows/dev-package-test.yml +++ b/.github/workflows/dev-package-test.yml @@ -31,10 +31,10 @@ jobs: runs-on: ${{ matrix.os }} steps: - name: Checkout - uses: actions/checkout@v2.3.4 + uses: actions/checkout@v3 - name: Setup Node.js - uses: actions/setup-node@v2.4.0 + uses: actions/setup-node@v3 with: node-version: ${{ matrix.node }} cache: "yarn" diff --git a/.github/workflows/dev-test.yml b/.github/workflows/dev-test.yml index 40bcb7e966d9..ebb91356be1a 100644 --- a/.github/workflows/dev-test.yml +++ b/.github/workflows/dev-test.yml @@ -18,13 +18,13 @@ jobs: - "macos-latest" - "windows-latest" node: - - "16" + - "16.10.0" - "14" - "12" include: # only enable coverage on the fastest job - os: "ubuntu-latest" - node: "16" + node: "16.10.0" ENABLE_CODE_COVERAGE: true FULL_TEST: true CHECK_TEST_PARSERS: true @@ -41,13 +41,13 @@ jobs: runs-on: ${{ matrix.os }} steps: - name: Checkout - uses: actions/checkout@v2.3.4 + 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@v2.4.0 + uses: actions/setup-node@v3 with: node-version: ${{ matrix.node }} cache: "yarn" @@ -64,7 +64,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 @@ -76,7 +76,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 718ab4a71c0c..248dec720cd6 100644 --- a/.github/workflows/eslint-rules.yml +++ b/.github/workflows/eslint-rules.yml @@ -16,10 +16,10 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2.3.4 + uses: actions/checkout@v3 - name: Setup Node.js - uses: actions/setup-node@v2.4.0 + uses: actions/setup-node@v3 with: cache: "yarn" diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 4dbd35a0e96f..136bb757127f 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -13,10 +13,10 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2.3.4 + uses: actions/checkout@v3 - name: Setup Node.js - uses: actions/setup-node@v2.4.0 + uses: actions/setup-node@v3 with: cache: "yarn" diff --git a/.github/workflows/lock.yml b/.github/workflows/lock.yml index 6f8df0eff0a2..5207ea059c61 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 203a55c2d4b4..fd7d1cd0018e 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.2 + - uses: actions-cool/issues-helper@v3 with: actions: "mark-duplicate" token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/prod-test.yml b/.github/workflows/prod-test.yml index e7ee6d881add..affdbcb3da8c 100644 --- a/.github/workflows/prod-test.yml +++ b/.github/workflows/prod-test.yml @@ -13,27 +13,16 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2.3.4 + uses: actions/checkout@v3 - name: Setup Node.js - uses: actions/setup-node@v2.4.0 + uses: actions/setup-node@v3 with: cache: "yarn" - name: Install Dependencies run: yarn install --frozen-lockfile - - name: Cache Build Results - id: build-cache - uses: actions/cache@v2.1.6 - with: - path: .cache - key: v2-build-cache-${{ hashFiles('yarn.lock') }}-${{ hashFiles('scripts/build/**/*') }}-${{ github.ref }}- - restore-keys: | - v2-build-cache-${{ hashFiles('yarn.lock') }}-${{ hashFiles('scripts/build/**/*') }}-${{ github.ref }}- - v2-build-cache-${{ hashFiles('yarn.lock') }}-${{ hashFiles('scripts/build/**/*') }}-refs/heads/${{ github.base_ref }}- - v2-build-cache-${{ hashFiles('yarn.lock') }}-${{ hashFiles('scripts/build/**/*') }}-refs/heads/main- - - name: Build Package run: yarn build @@ -45,12 +34,12 @@ jobs: # This step calls `git reset` # It should be the last step - # The cache step might saving the result of main branch, need investigate - name: Check Sizes if: ${{ github.event_name == 'pull_request' && startsWith(github.head_ref, 'dependabot/npm_and_yarn/') }} - uses: preactjs/compressed-size-action@2.3.0 + uses: preactjs/compressed-size-action@2.5.0 with: repo-token: "${{ secrets.GITHUB_TOKEN }}" + pattern: "./dist/**/*" compression: none lint: @@ -59,10 +48,10 @@ jobs: needs: [build] steps: - name: Checkout - uses: actions/checkout@v2.3.4 + uses: actions/checkout@v3 - name: Setup Node.js - uses: actions/setup-node@v2.4.0 + uses: actions/setup-node@v3 with: cache: "yarn" @@ -76,7 +65,7 @@ jobs: path: dist - name: Lint Code - run: yarn lint:dist + run: yarn test:dist-lint test: timeout-minutes: 90 @@ -88,13 +77,13 @@ jobs: - "macos-latest" - "windows-latest" node: - - "16" + - "16.10.0" - "14" - "12" - "10" include: - os: "ubuntu-latest" - node: "16" + node: "16.10.0" FULL_TEST: true exclude: - os: "macos-latest" @@ -112,10 +101,10 @@ jobs: needs: [build] steps: - name: Checkout - uses: actions/checkout@v2.3.4 + uses: actions/checkout@v3 - name: Setup Node.js - uses: actions/setup-node@v2.4.0 + uses: actions/setup-node@v3 with: node-version: ${{ matrix.node }} cache: "yarn" @@ -155,3 +144,28 @@ jobs: env: NODE_ENV: production PRETTIER_FALLBACK_RESOLVE: true + + cli: + name: CLI + runs-on: ubuntu-latest + needs: [build] + steps: + - name: Checkout + uses: actions/checkout@v2.4.0 + + - name: Setup Node.js + uses: actions/setup-node@v2.5.1 + with: + node-version: "0.10.48" + + - name: Download Artifact + uses: actions/download-artifact@v2 + with: + name: dist + path: dist + + - name: Validate Node.js Version + run: node -v | grep "v0.10.48" || exit 1 + + - name: Run CLI on Node.js v0.10.48 + run: node dist/bin-prettier --version 2>&1 >/dev/null | grep "prettier requires at least version 10.13.0 of Node, please upgrade" || exit 1 diff --git a/.github/workflows/release-script-test.yml b/.github/workflows/release-script-test.yml index 52470aae7bc2..232979f745bb 100644 --- a/.github/workflows/release-script-test.yml +++ b/.github/workflows/release-script-test.yml @@ -20,12 +20,12 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2.3.4 + uses: actions/checkout@v3 - name: Setup Node.js - uses: actions/setup-node@v2.4.0 + uses: actions/setup-node@v3 with: - version: "14" + node-version: "14" cache: "yarn" - name: Install Dependencies diff --git a/.github/workflows/validate-vendors.yml b/.github/workflows/validate-vendors.yml new file mode 100644 index 000000000000..ec990e8a0ca0 --- /dev/null +++ b/.github/workflows/validate-vendors.yml @@ -0,0 +1,32 @@ +name: Validate_Vendors + +on: + push: + branches: + - main + - patch-release + paths: + - "package.json" + pull_request: + paths: + - "package.json" + +jobs: + validate-vendor-versions: + name: Validate Vendor Versions + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: "14" + cache: "yarn" + + - name: Install Dependencies + run: yarn install --frozen-lockfile + + - name: Validate Vendors + run: yarn run vendors:bundle && echo "Listing changed files:" && git diff --name-only --exit-code && echo "No files changed." diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml deleted file mode 100644 index 510d631cbd69..000000000000 --- a/.pre-commit-hooks.yaml +++ /dev/null @@ -1,7 +0,0 @@ -# Remove this file after year 2020 - -- id: prettier - name: prettier - entry: Prettier support for pre-commit has been moved to https://github.com/pre-commit/mirrors-prettier, please use the new repository. - language: fail - pass_filenames: false diff --git a/.prettierignore b/.prettierignore index 37b755dc4c95..305b9916ecb2 100644 --- a/.prettierignore +++ b/.prettierignore @@ -9,5 +9,5 @@ coverage/ /website/build/ /website/static/lib/ /website/static/playground.js -cspell.json .nyc_output +/vendors/ diff --git a/CHANGELOG.md b/CHANGELOG.md index 03e7a43c1f39..3cf9686a1d15 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,80 @@ +# 2.6.0 + +[diff](https://github.com/prettier/prettier/compare/2.5.1...2.6.0) + +🔗 [Release Notes](https://prettier.io/blog/2022/03/16/2.6.0.html) + +# 2.5.1 + +[diff](https://github.com/prettier/prettier/compare/2.5.0...2.5.1) + +#### Improve formatting for empty tuple types ([#11884](https://github.com/prettier/prettier/pull/11884) by [@sosukesuzuki](https://github.com/sosukesuzuki)) + + +```tsx +// Input +type Foo = + Foooooooooooooooooooooooooooooooooooooooooooooooooooooooooo extends [] + ? Foo3 + : Foo4; + +// Prettier 2.5.0 +type Foo = Foooooooooooooooooooooooooooooooooooooooooooooooooooooooooo extends [ + +] + ? Foo3 + : Foo4; + +// Prettier 2.5.0 (tailingCommma = all) +// Invalid TypeScript code +type Foo = Foooooooooooooooooooooooooooooooooooooooooooooooooooooooooo extends [ + , +] + ? Foo3 + : Foo4; + +// Prettier 2.5.1 +type Foo = + Foooooooooooooooooooooooooooooooooooooooooooooooooooooooooo extends [] + ? Foo3 + : Foo4; + +``` + +#### Fix compatibility with Jest inline snapshot test ([#11892](https://github.com/prettier/prettier/pull/11892) by [@fisker](https://github.com/fisker)) + +A internal change in Prettier@v2.5.0 accidentally breaks the Jest inline snapshot test. + +#### Support Glimmer's named blocks ([#11899](https://github.com/prettier/prettier/pull/11899) by [@duailibe](https://github.com/duailibe)) + +Prettier already supported this feature, but it converted empty named blocks to self-closing, which is not supported by the Glimmer compiler. + +See: [Glimmer's named blocks](https://emberjs.github.io/rfcs/0460-yieldable-named-blocks.html). + + +```hbs +// Input + + <:named> + + +// Prettier 2.5.0 + + <:named /> + + +// Prettier 2.5.1 + + <:named> + +``` + +# 2.5.0 + +[diff](https://github.com/prettier/prettier/compare/2.4.1...2.5.0) + +🔗 [Release Notes](https://prettier.io/blog/2021/11/25/2.5.0.html) + # 2.4.1 [diff](https://github.com/prettier/prettier/compare/2.4.0...2.4.1) @@ -311,6 +388,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 { @@ -319,7 +397,7 @@ class Foo extends Bar { // Prettier stable class Foo extends Bar { - abstract override foo: string; + override abstract foo: string; } // Prettier main diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ba6b4f392bac..71a46800da62 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -48,7 +48,7 @@ function run_spec( Parameters: - **`fixtures`**: Must be set to `__dirname` or to an object of the shape `{ dirname: __dirname, ... }`. The object may have the `snippets` property to specify an array of extra input entries in addition to the files in the current directory. For each input entry (a file or a snippet), `run_spec` configures and runs a number of tests. The main check is that for a given input the output should match the snapshot (for snippets, the expected output can also be specified directly). [Additional checks](#deeper-testing) are controlled by options and environment variables. -- **`parsers`**: A list of parser names. The tests verify that the parsers in this list produce the same output. If the list includes `typescript`, then `babel-ts` is included implicitly. If the list includes `babel`, and the current directory is inside `tests/format/js`, then `espree` and `meriyah` are included implicitly. +- **`parsers`**: A list of parser names. The tests verify that the parsers in this list produce the same output. If the list includes `typescript`, then `babel-ts` is included implicitly. If the list includes `babel`, and the current directory is inside `tests/format/js`, then `acorn`, `espree`, and `meriyah` are included implicitly. - **`options`**: In addition to Prettier's formatting options, can contain the `errors` property to specify that it's expected that the formatting shouldn't be successful and an error should be thrown for all (`errors: true`) or some combinations of input entries and parsers. The implementation of `run_spec` can be found in [`tests/config/format-test.js`](tests/config/format-test.js). diff --git a/README.md b/README.md index 189df95a6982..b439216dc289 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -![Prettier Banner](https://raw.githubusercontent.com/prettier/prettier-logo/master/images/prettier-banner-light.png) +![Prettier Banner](https://unpkg.com/prettier-logo@1.0.3/images/prettier-banner-light.svg)

Opinionated Code Formatter

@@ -82,7 +82,7 @@ foo( ); ``` -Prettier can be run [in your editor](http://prettier.io/docs/en/editors.html) on-save, in a [pre-commit hook](https://prettier.io/docs/en/precommit.html), or in [CI environments](https://prettier.io/docs/en/cli.html#list-different) to ensure your codebase has a consistent style without devs ever having to post a nit-picky comment on a code review ever again! +Prettier can be run [in your editor](https://prettier.io/docs/en/editors.html) on-save, in a [pre-commit hook](https://prettier.io/docs/en/precommit.html), or in [CI environments](https://prettier.io/docs/en/cli.html#list-different) to ensure your codebase has a consistent style without devs ever having to post a nit-picky comment on a code review ever again! --- diff --git a/bin/prettier.js b/bin/prettier.js index afd8116156e5..0e1f3fc3c34a 100755 --- a/bin/prettier.js +++ b/bin/prettier.js @@ -2,4 +2,11 @@ "use strict"; -module.exports = require("../src/cli/index.js").run(process.argv.slice(2)); +var pleaseUpgradeNode = require("please-upgrade-node"); +var packageJson = require("../package.json"); + +pleaseUpgradeNode(packageJson); + +var cli = require("../src/cli/index.js"); + +module.exports = cli.run(process.argv.slice(2)); diff --git a/changelog_unreleased/cli/10274.md b/changelog_unreleased/cli/10274.md new file mode 100644 index 000000000000..4c810005e1f8 --- /dev/null +++ b/changelog_unreleased/cli/10274.md @@ -0,0 +1,12 @@ +#### Add `--no-plugin-search` to turn off plugin autoloading (#10274 by @fisker) + +To turn off plugin autoloading, use `--no-plugin-search` when using Prettier CLI or add `{ pluginSearchDirs: false }` to options in `prettier.format()` or to the config file. + + +```cli +// Prettier stable +$ prettier . --plugin-search-dir=a-dir-without-plugins + +// Prettier main +$ prettier . --no-plugin-search +``` diff --git a/changelog_unreleased/cli/11514.md b/changelog_unreleased/cli/11514.md deleted file mode 100644 index cc6ed95ac4ab..000000000000 --- a/changelog_unreleased/cli/11514.md +++ /dev/null @@ -1,3 +0,0 @@ -#### Add new CLI option `debug-print-ast` (#11514 by @sosukesuzuki) - -A new `--debug-print-ast` CLI flag for debugging. diff --git a/changelog_unreleased/cli/12320.md b/changelog_unreleased/cli/12320.md new file mode 100644 index 000000000000..3ba65e9683f3 --- /dev/null +++ b/changelog_unreleased/cli/12320.md @@ -0,0 +1,3 @@ +#### Infer parser for `.swcrc` (#12320 by @sosukesuzuki) + +A [`.swcrc`](https://swc.rs/docs/configuration/swcrc) is handled using `json` parser. diff --git a/changelog_unreleased/css/12210.md b/changelog_unreleased/css/12210.md new file mode 100644 index 000000000000..7b597087e65c --- /dev/null +++ b/changelog_unreleased/css/12210.md @@ -0,0 +1,32 @@ +#### Preserve empty line in CSS paren groups (#12210 by @duailibe) + + + + +```css +/* Input */ +$colours: ( + "text": $light-100, + + "background-primary": $dark-300, + "background-secondary": $dark-200, + "background-tertiary": $dark-100 +); + +/* Prettier stable */ +$colours: ( + "text": $light-100, + "background-primary": $dark-300, + "background-secondary": $dark-200, + "background-tertiary": $dark-100 +); + +/* Prettier main */ +$colours: ( + "text": $light-100, + + "background-primary": $dark-300, + "background-secondary": $dark-200, + "background-tertiary": $dark-100 +); +``` diff --git a/changelog_unreleased/css/12393.md b/changelog_unreleased/css/12393.md new file mode 100644 index 000000000000..897502a1620a --- /dev/null +++ b/changelog_unreleased/css/12393.md @@ -0,0 +1,27 @@ +#### Fix lowercasing postcss values (#12393 by @niklasvatn) + +PostCSS values can start with digits. Prettier interprets this as a number followed by a unit in the example below. + + +```css +// Input +@value 4XLarge 28/36px; + +.test { + font: 4XLarge Helvetica; +} + +// Prettier stable +@value 4XLarge 28/36px; + +.test { + font: 4xlarge Helvetica; +} + +// Prettier main +@value 4XLarge 28/36px; + +.test { + font: 4XLarge Helvetica; +} +``` diff --git a/changelog_unreleased/flow/12009.md b/changelog_unreleased/flow/12009.md new file mode 100644 index 000000000000..fedd4815e269 --- /dev/null +++ b/changelog_unreleased/flow/12009.md @@ -0,0 +1,19 @@ +#### Fix Flow's class declaration's `static` indexer formatting (#12009 by @gkz) + + +```jsx +// Input +declare class A { + static [string]: boolean; +} + +// Prettier stable +declare class A { + [string]: boolean; +} + +// Prettier main +declare class A { + static [string]: boolean; +} +``` diff --git a/changelog_unreleased/graphql/11901.md b/changelog_unreleased/graphql/11901.md new file mode 100644 index 000000000000..43fa6a7239e7 --- /dev/null +++ b/changelog_unreleased/graphql/11901.md @@ -0,0 +1,24 @@ +#### Print descriptions on graphql schema definition nodes (#11901 by @trevor-scheer) + + +```graphql +# Input +"""SchemaDefinition description is lost""" +schema { + query: Query +} + +# Prettier stable +schema { + query: Query +} + +# Prettier main +""" +SchemaDefinition description is lost +""" +schema { + query: Query +} + +``` diff --git a/changelog_unreleased/handlebars/12302.md b/changelog_unreleased/handlebars/12302.md new file mode 100644 index 000000000000..0798f5dea231 --- /dev/null +++ b/changelog_unreleased/handlebars/12302.md @@ -0,0 +1,21 @@ +#### Correctly identify which backslashes are removed by glimmer (#12302 by @MattTheNub) + +This caused Prettier to unnecessarily add backslashes every time a file was formatted. + + +```hbs +{{! Input }} +

\

+

\\

+

\\\

+ +{{! Prettier stable }} +

\\

+

\\\

+

\\\\

+ +{{! Prettier main }} +

\

+

\\

+

\\\

+``` diff --git a/changelog_unreleased/html/6644.md b/changelog_unreleased/html/6644.md new file mode 100644 index 000000000000..7e12acbf1e29 --- /dev/null +++ b/changelog_unreleased/html/6644.md @@ -0,0 +1,42 @@ +#### Enforce Single Attribute Per Line (#6644 by @kankje) + +Added the `singleAttributePerLine` option for specifying if Prettier should enforce single attribute per line in HTML, Vue and JSX. + + +```html + +
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. +
+
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. +
+ + +
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. +
+
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. +
+ + +
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. +
+
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. +
+ + +
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. +
+
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. +
+``` diff --git a/changelog_unreleased/javascript/11992.md b/changelog_unreleased/javascript/11992.md new file mode 100644 index 000000000000..6a89711be049 --- /dev/null +++ b/changelog_unreleased/javascript/11992.md @@ -0,0 +1,25 @@ +#### Recognize waitForAsync as test-statement in Angular (#11992 by @HendrikN) + + +```js +// Input +test("foo bar", waitForAsync(() => { + const foo = "bar"; + expect(foo).toEqual("bar") +})); + +// Prettier stable +test( + "foo bar", + waitForAsync(() => { + const foo = "bar"; + expect(foo).toEqual("bar"); + }) +); + +// Prettier main +test("foo bar", waitForAsync(() => { + const foo = "bar"; + expect(foo).toEqual("bar"); +})); +``` diff --git a/changelog_unreleased/javascript/12017.md b/changelog_unreleased/javascript/12017.md new file mode 100644 index 000000000000..726ce45c5b67 --- /dev/null +++ b/changelog_unreleased/javascript/12017.md @@ -0,0 +1,22 @@ +#### Preserve end-of-line comment for if statements without blocks (#12017 by @sosukesuzuki) + + +```jsx +// Input +if (condition1) expression1; // comment A +else if (condition2) expression2; // comment B +else expression3; // comment C + +// Prettier stable +if (condition1) expression1; +// comment A +else if (condition2) expression2; +// comment B +else expression3; // comment C + +// Prettier main +if (condition1) expression1; // comment A +else if (condition2) expression2; // comment B +else expression3; // comment C + +``` diff --git a/changelog_unreleased/javascript/12070.md b/changelog_unreleased/javascript/12070.md new file mode 100644 index 000000000000..66bf7183ed0f --- /dev/null +++ b/changelog_unreleased/javascript/12070.md @@ -0,0 +1,17 @@ +#### Print comments for parenthesized TS keyword types with `babel-ts` parser (#12070 by @sosukesuzuki) + + +```ts +// Input +let foo: ( + // comment + never +); + +// Prettier stable +Error: Comment "comment" was not printed. Please report this error! + +// Prettier main +let foo: // comment +never; +``` diff --git a/changelog_unreleased/javascript/12075.md b/changelog_unreleased/javascript/12075.md new file mode 100644 index 000000000000..4b136d0487a3 --- /dev/null +++ b/changelog_unreleased/javascript/12075.md @@ -0,0 +1,18 @@ +#### Print end-of-line comment for `continue`/`break` statements (#12075 by @sosukesuzuki) + + + + +```jsx +// Input +for (;;) continue // comment +; + +// Prettier stable +Error: Comment "comment" was not printed. Please report this error! + +// Prettier main +for (;;) + continue; // comment + +``` diff --git a/changelog_unreleased/javascript/12088.md b/changelog_unreleased/javascript/12088.md new file mode 100644 index 000000000000..ba6004dfea3e --- /dev/null +++ b/changelog_unreleased/javascript/12088.md @@ -0,0 +1,40 @@ +#### Inline `await` expressions in JSX (#12088 & #12109 by @j-f1) + +`await` expressions in JSX are now inlined if their argument would be inlined. + + +```jsx +// Input +{await Promise.all( + someVeryLongExpression +)} + +{await ( +
Lorem ipsum ...
+)} + + +// Prettier stable +{ + await Promise.all( + someVeryLongExpression + ) +} + +{ + await ( +
Lorem ipsum ...
+ ) +} + + +// Prettier main +{await Promise.all( + someVeryLongExpression +)} + +{await ( +
Lorem ipsum ...
+)} + +``` diff --git a/changelog_unreleased/javascript/12172.md b/changelog_unreleased/javascript/12172.md new file mode 100644 index 000000000000..e653c2f0a764 --- /dev/null +++ b/changelog_unreleased/javascript/12172.md @@ -0,0 +1,3 @@ +#### Add `acorn` parser (#12172 by @fisker) + +A new value for the `parser` option has been added: [`acorn`](https://github.com/acornjs/acorn) - A small, fast, JavaScript-based JavaScript parser. diff --git a/changelog_unreleased/javascript/12177.md b/changelog_unreleased/javascript/12177.md new file mode 100644 index 000000000000..79295954a2b7 --- /dev/null +++ b/changelog_unreleased/javascript/12177.md @@ -0,0 +1,40 @@ +#### Keep comments after `default` cases in the same line (#12177 by @duailibe) + +Keep comments right after `default` cases (in switch statements) in the same line, when possible. + + +```jsx +// Input +function read_statement() { + switch (peek_keyword()) { + case Keyword.impl: // impl Growling for Wolf {} + return ImplDeclaration.read(); + + default: // expression; + return ExpressionStatement.read(); + } +} + +// Prettier stable +function read_statement() { + switch (peek_keyword()) { + case Keyword.impl: // impl Growling for Wolf {} + return ImplDeclaration.read(); + + default: + // expression; + return ExpressionStatement.read(); + } +} + +// Prettier main +function read_statement() { + switch (peek_keyword()) { + case Keyword.impl: // impl Growling for Wolf {} + return ImplDeclaration.read(); + + default: // expression; + return ExpressionStatement.read(); + } +} +``` diff --git a/changelog_unreleased/javascript/12185.md b/changelog_unreleased/javascript/12185.md new file mode 100644 index 000000000000..94fcaf7ea802 --- /dev/null +++ b/changelog_unreleased/javascript/12185.md @@ -0,0 +1,26 @@ +#### Fix misplaced argument comment in abstract methods (#12185 by @duailibe) + + +```ts +// Input +abstract class Foo { + abstract bar( + /** comment explaining userId param */ + userId + ) +} + +// Prettier stable +abstract class Foo { + abstract bar(userId); + /** comment explaining userId param */ +} + +// Prettier main +abstract class Foo { + abstract bar( + /** comment explaining userId param */ + userId + ); +} +``` diff --git a/changelog_unreleased/javascript/12222.md b/changelog_unreleased/javascript/12222.md new file mode 100644 index 000000000000..215b77dde855 --- /dev/null +++ b/changelog_unreleased/javascript/12222.md @@ -0,0 +1,15 @@ +#### Fix typecast of superclass in class declarations (#12222 & #12226 by @duailibe) + +This was a combination of two separate bugs: moving the comments before the superclass and adding multiple parenthesis around the superclass. + + +```js +// Input +class Foo extends /** @type {Type} */ (Bar) {} + +// Prettier stable +class Foo /** @type {Type} */ extends ((Bar)) {} + +// Prettier main +class Foo extends /** @type {Type} */ (Bar) {} +``` diff --git a/changelog_unreleased/javascript/12241.md b/changelog_unreleased/javascript/12241.md new file mode 100644 index 000000000000..2c8edf8a7207 --- /dev/null +++ b/changelog_unreleased/javascript/12241.md @@ -0,0 +1,16 @@ +#### Support Unicode Set Notation proposal (#12241 by @fisker) + +Support [Stage 3 proposal Unicode Set Notation](https://github.com/tc39/proposal-regexp-set-notation/) via [Babel 7.17.0](https://babeljs.io/blog/2022/02/02/7.17.0). + +See [the release blog post of Babel v7.17.0](https://babeljs.io/blog/2022/02/02/7.17.0#regexp-set-notation-and-properties-of-strings-14125httpsgithubcombabelbabelpull14125) and [the README of this proposal](https://github.com/tc39/proposal-regexp-set-notation/) for details. + + +```jsx +// Examples + +/[\p{Decimal_Number}--[0-9]]/v; // Non-ASCII decimal digits + +"Did you see the 👩🏿‍❤️‍💋‍👩🏾 emoji?".match(/\p{RGI_Emoji}/v). // ["👩🏿‍❤️‍💋‍👩🏾"] + +/[\r\n\q{\r\n|NEWLINE}]/v; // Matches \r, \n, \r\n or NEWLINE +``` diff --git a/changelog_unreleased/javascript/12260.md b/changelog_unreleased/javascript/12260.md new file mode 100644 index 000000000000..423c052e87e8 --- /dev/null +++ b/changelog_unreleased/javascript/12260.md @@ -0,0 +1,24 @@ +#### Add parens to `ClassExpression` with decorators (#12260 by @fisker) + + +```js +// Input +(@f() class {}); + +// Prettier stable +@f() +class {}; + +// Prettier stable (Second format) +SyntaxError: A class name is required. (2:7) + 1 | @f() +> 2 | class {}; + | ^ + 3 | + +// Prettier main +( + @f() + class {} +); +``` diff --git a/changelog_unreleased/javascript/12268.md b/changelog_unreleased/javascript/12268.md new file mode 100644 index 000000000000..7450c96655ef --- /dev/null +++ b/changelog_unreleased/javascript/12268.md @@ -0,0 +1,54 @@ +#### Improve printing of comments in type aliases in Flow & TS (#12268 by @duailibe) + +For Flow, the comments will now be more aligned to how we print comments in assignments where the right-hand side is an object expression: + + +```js +// Input +type Props = // comment explaining the props + { + isPlaying: boolean + }; + +// Prettier stable +// comment explaining the props +type Props = { + isPlaying: boolean, +}; + +// Prettier main +type Props = + // comment explaining the props + { + isPlaying: boolean, + }; +``` + +And for TS that comment would not be stable with a second format: + + +```ts +// Input +type Props = // comment explaining the props + { + isPlaying: boolean + }; + +// Prettier stable +type Props = { // comment explaining the props + isPlaying: boolean; +}; + +// Prettier stable (2nd format) +type Props = { + // comment explaining the props + isPlaying: boolean; +}; + +// Prettier main +type Props = + // comment explaining the props + { + isPlaying: boolean, + }; +``` diff --git a/changelog_unreleased/javascript/12276.md b/changelog_unreleased/javascript/12276.md new file mode 100644 index 000000000000..e6ea8c2f2bf3 --- /dev/null +++ b/changelog_unreleased/javascript/12276.md @@ -0,0 +1,15 @@ +#### Support destructuring private proposal (#12276 by @sosukesuzuki) + +Support [Stage 2 TC39 proposal destructuring private fields](https://github.com/tc39/proposal-destructuring-private) via [Babel 7.17](https://babeljs.io/blog/2022/02/02/7.17.0). + + +```jsx +// Example +class Foo { + constructor() { + console.log(this.#x); // => 1 + const { #x: x } = this; + console.log(x); // => 1 + } +} +``` diff --git a/changelog_unreleased/javascript/12299.md b/changelog_unreleased/javascript/12299.md new file mode 100644 index 000000000000..a8cd28519b28 --- /dev/null +++ b/changelog_unreleased/javascript/12299.md @@ -0,0 +1,12 @@ +#### Support decorator auto accessors syntax (#12299 by @sosukesuzuki) + +Support auto accessors syntax that is introduced in [new decorators proposal](https://github.com/tc39/proposal-decorators). + + +```jsx +// Example +@defineElement("my-class") +class C extends HTMLElement { + @reactive accessor clicked = false; +} +``` diff --git a/changelog_unreleased/javascript/12349.md b/changelog_unreleased/javascript/12349.md new file mode 100644 index 000000000000..35bf9cba2ba8 --- /dev/null +++ b/changelog_unreleased/javascript/12349.md @@ -0,0 +1,23 @@ +#### Fix idempotence issues caused by line comments after `=` in assignments (#12349 by @thorn0) + + +```jsx +// Input +const kochabCooieGameOnOboleUnweave = // !!! + rhubarbRhubarb(annularCooeedSplicesWalksWayWay); + +// Prettier stable, first format +const kochabCooieGameOnOboleUnweave = rhubarbRhubarb( // !!! + annularCooeedSplicesWalksWayWay +); + +// Prettier stable, second format +const kochabCooieGameOnOboleUnweave = rhubarbRhubarb( + // !!! + annularCooeedSplicesWalksWayWay +); + +// Prettier main +const kochabCooieGameOnOboleUnweave = // !!! + rhubarbRhubarb(annularCooeedSplicesWalksWayWay); +``` diff --git a/changelog_unreleased/scss/11487.md b/changelog_unreleased/scss/11487.md deleted file mode 100644 index f562cf488cc5..000000000000 --- a/changelog_unreleased/scss/11487.md +++ /dev/null @@ -1,13 +0,0 @@ -#### 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/changelog_unreleased/scss/11920.md b/changelog_unreleased/scss/11920.md new file mode 100644 index 000000000000..e7d220ae42a3 --- /dev/null +++ b/changelog_unreleased/scss/11920.md @@ -0,0 +1,36 @@ +#### Fix comments inside map (#11920 by @fisker) + + +```scss +// Input +.ag-theme-balham { + @include ag-theme-balham( + ( + foreground-color: $custom-foreground-color, + disabled-foreground-color: null, // TODO some comment + ) + ); +} + +// Prettier stable +.ag-theme-balham { + @include ag-theme-balham( + ( + foreground-color: $custom-foreground-color, + disabled-foreground-color: null, + r: null, // TODO som + ) + ); +} + +// Prettier main +.ag-theme-balham { + @include ag-theme-balham( + ( + foreground-color: $custom-foreground-color, + disabled-foreground-color: null, + // TODO some comment + ) + ); +} +``` diff --git a/changelog_unreleased/scss/12213.md b/changelog_unreleased/scss/12213.md new file mode 100644 index 000000000000..01f7c29c243c --- /dev/null +++ b/changelog_unreleased/scss/12213.md @@ -0,0 +1,16 @@ +#### Fixes printing parameters of a mixin named `selector()` (#12213 by @duailibe) + + +```css +/* Input */ +@mixin selector($param: 'value') { +} + +/* Prettier stable */ +@mixin selector($param: 'value) { +} + +/* Prettier main */ +@mixin selector($param: 'value') { +} +``` diff --git a/changelog_unreleased/typescript/12351.md b/changelog_unreleased/typescript/12351.md new file mode 100644 index 000000000000..11f0276d279a --- /dev/null +++ b/changelog_unreleased/typescript/12351.md @@ -0,0 +1,15 @@ +#### Refactor printing definite assignment assertions (#12351 by @thorn0) + +Also now definite assignment assertions are printed even when they aren't followed by type annotations, which is an error in TS but not a parse error. + + +```ts +// Input +let a!; + +// Prettier stable +let a; + +// Prettier main +let a!; +``` diff --git a/changelog_unreleased/typescript/12390.md b/changelog_unreleased/typescript/12390.md new file mode 100644 index 000000000000..21be549b9bae --- /dev/null +++ b/changelog_unreleased/typescript/12390.md @@ -0,0 +1,45 @@ +#### Print trailing comma for rest elements in tuple types (#12390 by @sosukesuzuki) + +TypeScript allows to put rest elements in places other than the end of tuple types since [4.2](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-2.html#leadingmiddle-rest-elements-in-tuple-types). +Prettier now prints a trailing comma for the trailing rest element as the it may be followed by the next element. + + +```tsx +// { trailingCommma: "all" } + +// Input +type Foo = [ + Element, + Element, + Element, + Element, + Element, + Element, + ...RestElement, +]; + + +// Prettier stable +type Foo = [ + Element, + Element, + Element, + Element, + Element, + Element, + ...RestElement +]; + + +// Prettier main +type Foo = [ + Element, + Element, + Element, + Element, + Element, + Element, + ...RestElement, +]; + +``` diff --git a/changelog_unreleased/vue/12113.md b/changelog_unreleased/vue/12113.md new file mode 100644 index 000000000000..314b5db6da0c --- /dev/null +++ b/changelog_unreleased/vue/12113.md @@ -0,0 +1,21 @@ +#### Fix hangs on invalid `v-for` (#12113 by @fisker) + + +```jsx +// Input + + +// Prettier stable +// Hangs + +// Prettier main +; +``` diff --git a/changelog_unreleased/vue/12394.md b/changelog_unreleased/vue/12394.md new file mode 100644 index 000000000000..2d85bdb1f481 --- /dev/null +++ b/changelog_unreleased/vue/12394.md @@ -0,0 +1,49 @@ +#### Allow `lang` attribute of ` + + + + + +``` diff --git a/changelog_unreleased/yaml/12305.md b/changelog_unreleased/yaml/12305.md new file mode 100644 index 000000000000..f989c615755e --- /dev/null +++ b/changelog_unreleased/yaml/12305.md @@ -0,0 +1,15 @@ +#### Fix unexpected deletion of block-literal lines which starts with U+3000 (#12305 by @Quramy) + + +```yaml +# Input +block_with_ideographic_space: | +  line-content # This line starts with U+3000 + +# Prettier stable +block_with_ideographic_space: | + +// Prettier main +block_with_ideographic_space: | +  line-content # This line starts with U+3000 +``` diff --git a/cspell.json b/cspell.json index 29f9fe29fff8..689fff064f2c 100644 --- a/cspell.json +++ b/cspell.json @@ -3,7 +3,6 @@ "$schema": "https://raw.githubusercontent.com/streetsidesoftware/cspell/master/cspell.schema.json", "words": [ "ACMR", - "actionlint", "Alexa", "Amjad", "Andrey", @@ -22,7 +21,6 @@ "autocrlf", "autodetects", "autofix", - "autogenerated", "autolinks", "autoload", "autoloaded", @@ -58,12 +56,12 @@ "codemirror", "codemod", "codemods", - "combinator", "commonmark", "compat", "concating", "cond", "corejs", + "csharpier", "daleroy", "danez", "Dara", @@ -78,7 +76,6 @@ "desugared", "devcontainer", "devs", - "docblock", "docblocks", "doctag", "Dodds", @@ -96,20 +93,19 @@ "eqeqeq", "Ericsburgh", "Esben", + "esbuild", "eslintignore", "eslump", "espree", "esproposal", "estree", "esutils", - "eval", "execa", "fbglyph", "Ficarra", "Filipe", "Fiorini", "Fisker", - "fnames", "foldgutter", "formatprg", "Friedly", @@ -124,7 +120,6 @@ "globby", "gofmt", "Gregor", - "gtag", "Hampus", "hardline", "hardlines", @@ -164,6 +159,7 @@ "jscodefmt", "jsesc", "jsfmt", + "jsonata", "jsonl", "judgements", "kalmanb", @@ -182,9 +178,7 @@ "linearize", "linebreak", "linebreaks", - "linenumbers", "literalline", - "Literallines", "loglevel", "lowercased", "lowercasing", @@ -196,6 +190,7 @@ "mdast", "Memberish", "meriyah", + "metafile", "Michał", "Microsyntax", "Mikael", @@ -204,6 +199,7 @@ "miniprettier", "mitermayer", "mjml", + "Modifer", "Moeller", "Monteiro", "Morrell", @@ -211,7 +207,6 @@ "mousedown", "mouseup", "mprettier", - "msapplication", "multiparser", "Muntean", "nargs", @@ -219,6 +214,7 @@ "neoclide", "neoformat", "neovim", + "nocheck", "nnoremap", "nonenumerable", "Nonspacing", @@ -235,6 +231,8 @@ "onwarn", "Oopsy", "outdent", + "outfile", + "outro", "overparenthesization", "Panasenko", "pandoc", @@ -284,7 +282,6 @@ "Sapegin", "sbdchd", "scandir", - "schemastore", "Serializers", "setlocal", "setq", @@ -314,6 +311,7 @@ "suchipi", "supertypes", "Supprimer", + "swcrc", "templating", "tempy", "testname", @@ -356,10 +354,8 @@ "Weixin", "whitespaces", "wxss", - "xargs", "yamafaktory", "Yatharth", - "youtube", "Zatorski", "Zosel" ], @@ -372,12 +368,11 @@ "\\(https?://.*?\\)", "author: \".*?\"", "authorURL: \".*?\"", - "\"author\": \".*?\"" + "\"author\": \".*?\"", + "(long|after){3,}" ], "files": [ "*", - ".*", - ".github/**/*", "bin/**/*", "changelog_unreleased/**/*", "docs/**/*", @@ -387,19 +382,18 @@ "website/**/*", "tests/config/**/*", "tests/integration/**/*", - "tests/**/jsfmt.spec.js" + "tests/format/**/jsfmt.spec.js" ], "ignorePaths": [ + ".git", "cspell.json", - "**/node_modules/**", - "**/yarn.lock", "*.{log,svg,snap,png}", - "test*.*", "website/data/users.yml", "website/build/**", "website/playground/codeSamples.js", "website/pages/googlefe164a33bda4034b.html", "website/static/lib/**", - "website/static/playground.js" + "website/static/playground.js", + "scripts/vendors/vendor-meta.json" ] -} \ No newline at end of file +} diff --git a/docs/assets/webstorm/prettier-settings.png b/docs/assets/webstorm/prettier-settings.png new file mode 100644 index 000000000000..4983219b7a09 Binary files /dev/null and b/docs/assets/webstorm/prettier-settings.png differ diff --git a/docs/browser.md b/docs/browser.md index 0a741f408e28..5dcce573158f 100644 --- a/docs/browser.md +++ b/docs/browser.md @@ -32,8 +32,8 @@ See below for examples. ### Global ```html - - + + + +Open Source and Money has always been a tricky topic. We've tried many things with Prettier. Right after the project was open sourced, Facebook contracted [James Long](https://twitter.com/jlongster) for 2 weeks in order to polish it. Facebook also paid Christopher Chedeau ([vjeux](https://twitter.com/Vjeux)) for 9 months to work on it full time. Once there was \$10,000 in contributions, we gave everyone that contributed significantly the opportunity to redeem \$1,000 but due to the complexities in collecting the money, few people did. + +We now have \$50,000 which is a sizable sum but not enough for someone with the skills to work on it to do it full time. But at the same time we shouldn't let it sit unused. So after a lot of thinking, we decided to provide a recurring \$1,500 to the two current maintainers of the project. They have been amazing stewards for the project for the past 2 years! + +- [Fisker Cheung](https://github.com/fisker) +- [Sosuke Suzuki](https://github.com/sosukesuzuki) + +As you can imagine, maintaining a project that is [used by 60% of all JavaScript developers](https://twitter.com/vjeux/status/1349383134010200068) is not a simple task. We are planning to release Prettier 3.0, including a migration to ECMAScript Modules, support for formatting new language features in, and fixing new edge cases as they are identified. + +If Prettier has been useful for you or your company, there has never been a better time to [donate to Prettier](https://opencollective.com/prettier). We will now be much more able to use that money to make Prettier better! diff --git a/website/blog/assets/markdown-lists.gif b/website/blog/assets/markdown-lists.gif index 213613703429..28bf263e14a4 100644 Binary files a/website/blog/assets/markdown-lists.gif and b/website/blog/assets/markdown-lists.gif differ diff --git a/website/blog/assets/markdown-tables.gif b/website/blog/assets/markdown-tables.gif index 3d5296a98488..39439fccea04 100644 Binary files a/website/blog/assets/markdown-tables.gif and b/website/blog/assets/markdown-tables.gif differ diff --git a/website/data/languages.yml b/website/data/languages.yml index f7026c70a536..8dd807916ca6 100644 --- a/website/data/languages.yml +++ b/website/data/languages.yml @@ -40,6 +40,7 @@ image: /images/languages/tools_yaml.svg variants: [] - name: Community Plugins + nameLink: ./docs/en/plugins.html#community-plugins showName: true image: /images/languages/tools_wip.svg variants: @@ -50,3 +51,4 @@ - "[Ruby](https://github.com/prettier/plugin-ruby)" - "[TOML](https://github.com/bd82/toml-tools/tree/master/packages/prettier-plugin-toml)" - "[XML](https://github.com/prettier/plugin-xml)" + - "[And more...](./docs/en/plugins.html#community-plugins)" diff --git a/website/data/users.yml b/website/data/users.yml index dab8f520f054..19856bc0980e 100644 --- a/website/data/users.yml +++ b/website/data/users.yml @@ -257,3 +257,6 @@ - caption: Icons8 image: /images/users/icons8.svg infoLink: https://icons8.com +- caption: Dev IT jobs + image: /images/users/dev-it-jobs-200-100.jpg + infoLink: https://devitjobs.uk diff --git a/website/package.json b/website/package.json index 58cf304f0421..056a4de5eb0b 100644 --- a/website/package.json +++ b/website/package.json @@ -6,21 +6,21 @@ "update-stable-docs": "rm -rf ./versioned_docs ./versions.json && docusaurus-version stable" }, "dependencies": { - "clipboard": "2.0.8", - "codemirror-graphql": "1.0.2", + "clipboard": "2.0.10", + "codemirror-graphql": "1.2.13", "lz-string": "1.4.4", - "prop-types": "15.7.2", + "prop-types": "15.8.1", "react": "17.0.2", "react-dom": "17.0.2" }, "devDependencies": { - "@babel/preset-react": "7.14.5", + "@babel/preset-react": "7.16.7", "@sandhose/prettier-animated-logo": "1.0.3", - "babel-loader": "8.2.2", - "concurrently": "6.2.1", + "babel-loader": "8.2.3", + "concurrently": "7.0.0", "docusaurus": "1.14.7", "js-yaml": "4.1.0", - "webpack": "5.52.1", - "webpack-cli": "4.8.0" + "webpack": "5.70.0", + "webpack-cli": "4.9.2" } } diff --git a/website/pages/en/index.js b/website/pages/en/index.js index 07576f5d2a0d..93f7d2eff1e1 100755 --- a/website/pages/en/index.js +++ b/website/pages/en/index.js @@ -312,7 +312,7 @@ const UsersSection = ({ language }) => {

More than{" "} - 3.2 million{" "} + 3.5 million{" "} dependent repositories on GitHub