Switch default branch to main (#10115)
This commit is contained in:
1 parent
01052292ab
commit
12bddae20c
52 files changed
+74
-62
No files matched your search
@@ -10,7 +10,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 `changelog_unreleased/*/XXXX.md` file following `changelog_unreleased/TEMPLATE.md`.
|
||||
- [ ] I’ve read the [contributing guidelines](https://github.com/prettier/prettier/blob/master/CONTRIBUTING.md).
|
||||
- [ ] I’ve read the [contributing guidelines](https://github.com/prettier/prettier/blob/main/CONTRIBUTING.md).
|
||||
|
||||
<!-- Please DO NOT remove the playground link -->
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ name: Dev
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- main
|
||||
- patch-release
|
||||
pull_request:
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ name: Lint
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- main
|
||||
- patch-release
|
||||
pull_request:
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ name: Prod
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- main
|
||||
- patch-release
|
||||
pull_request:
|
||||
|
||||
@@ -30,7 +30,7 @@ jobs:
|
||||
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/master-
|
||||
v2-build-cache-${{ hashFiles('yarn.lock') }}-${{ hashFiles('scripts/build/**/*') }}-refs/heads/main-
|
||||
|
||||
- name: Build Package
|
||||
run: yarn build
|
||||
@@ -43,7 +43,7 @@ jobs:
|
||||
|
||||
# This step calls `git reset`
|
||||
# It should be the last step
|
||||
# The cache step might saving the result of master branch, need investigate
|
||||
# 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.1.0
|
||||
|
||||
@@ -37,11 +37,11 @@
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://github.com/prettier/prettier/actions?query=workflow%3AProd+branch%3Amaster">
|
||||
<a href="https://github.com/prettier/prettier/actions?query=workflow%3AProd+branch%3Amain">
|
||||
<img alt="Github Actions Build Status" src="https://img.shields.io/github/workflow/status/prettier/prettier/Prod?label=Prod&style=flat-square"></a>
|
||||
<a href="https://github.com/prettier/prettier/actions?query=workflow%3ADev+branch%3Amaster">
|
||||
<a href="https://github.com/prettier/prettier/actions?query=workflow%3ADev+branch%3Amain">
|
||||
<img alt="Github Actions Build Status" src="https://img.shields.io/github/workflow/status/prettier/prettier/Dev?label=Dev&style=flat-square"></a>
|
||||
<a href="https://github.com/prettier/prettier/actions?query=workflow%3ALint+branch%3Amaster">
|
||||
<a href="https://github.com/prettier/prettier/actions?query=workflow%3ALint+branch%3Amain">
|
||||
<img alt="Github Actions Build Status" src="https://img.shields.io/github/workflow/status/prettier/prettier/Lint?label=Lint&style=flat-square"></a>
|
||||
<a href="https://codecov.io/gh/prettier/prettier">
|
||||
<img alt="Codecov Coverage Status" src="https://img.shields.io/codecov/c/github/prettier/prettier.svg?style=flat-square"></a>
|
||||
|
||||
@@ -34,6 +34,6 @@
|
||||
// Prettier stable
|
||||
foo ?? baz || baz;
|
||||
|
||||
// Prettier master
|
||||
// Prettier main
|
||||
(foo ?? baz) || baz;
|
||||
```
|
||||
@@ -8,6 +8,6 @@ If you're a plugin author, this change should only concern you if your plugin in
|
||||
// Prettier stable
|
||||
myDoc = group(concat(["foo", line, "bar"]));
|
||||
|
||||
// Prettier master
|
||||
// Prettier main
|
||||
myDoc = group(["foo", line, "bar"]);
|
||||
```
|
||||
@@ -9,6 +9,6 @@ The CSS parser is parsing this as `["division", "absolute/path"]` instead of a s
|
||||
/* Prettier stable */
|
||||
-custom-url(/ absolute/path)
|
||||
|
||||
/* Prettier master */
|
||||
/* Prettier main */
|
||||
-custom-url(/absolute/path)
|
||||
```
|
||||
@@ -10,6 +10,6 @@ declare export * from "ES6_ExportAllFrom_Source2";
|
||||
// Prettier stable
|
||||
declare export * from "ES6_ExportAllFrom_Source2"
|
||||
|
||||
// Prettier master
|
||||
// Prettier main
|
||||
declare export * from "ES6_ExportAllFrom_Source2";
|
||||
```
|
||||
@@ -12,7 +12,7 @@
|
||||
{{! Comment }}
|
||||
{{! Comment }}
|
||||
|
||||
{{!-- Prettier master --}}
|
||||
{{!-- Prettier main --}}
|
||||
{{~! Comment }}
|
||||
{{! Comment ~}}
|
||||
{{~! Comment ~}}
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
Hello
|
||||
{{/block}}
|
||||
|
||||
{{!-- Prettier master --}}
|
||||
{{!-- Prettier main --}}
|
||||
<MyComponent
|
||||
@prop={{true}}
|
||||
@prop2={{true}}
|
||||
|
||||
@@ -9,7 +9,7 @@ Formatting of HTML class names will now keep classes on one line until the line
|
||||
class="SomeComponent__heading-row d-flex flex-column flex-lg-row justify-content-start justify-content-lg-between align-items-start align-items-lg-center"
|
||||
></div>
|
||||
|
||||
<!-- Prettier master -->
|
||||
<!-- Prettier main -->
|
||||
<div
|
||||
class="
|
||||
SomeComponent__heading-row
|
||||
|
||||
@@ -17,7 +17,7 @@ class loooooooooooooooooooong
|
||||
property: string;
|
||||
}
|
||||
|
||||
// Prettier master
|
||||
// Prettier main
|
||||
class loooooooooooooooooooong
|
||||
extends looooooooooooooooooong
|
||||
implements loooooooooooooooooooong
|
||||
|
||||
@@ -19,7 +19,7 @@ b;
|
||||
a; /*2*/ /*3*/
|
||||
/*1*/ b;
|
||||
|
||||
// Prettier master
|
||||
// Prettier main
|
||||
a;
|
||||
/*1*/ /*2*/
|
||||
/*3*/
|
||||
|
||||
@@ -12,7 +12,7 @@ foo = 1.0000;bar = 1.0000;baz=1.0000;
|
||||
foo = 1.0;
|
||||
bar = 1.0;baz=1.0000;
|
||||
|
||||
// Prettier master
|
||||
// Prettier main
|
||||
foo = 1.0000;bar = 1.0;baz=1.0000;
|
||||
```
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<a></// comment
|
||||
a>;
|
||||
|
||||
// Prettier master
|
||||
// Prettier main
|
||||
<a></
|
||||
// comment
|
||||
a
|
||||
|
||||
@@ -13,7 +13,7 @@ foo /* HTML */ = `<div></div>`;
|
||||
foo /* HTML */ = `<DIV>
|
||||
</DIV>`;
|
||||
|
||||
// Prettier master (All JavaScript parsers)
|
||||
// Prettier main (All JavaScript parsers)
|
||||
foo /* HTML */ = `<DIV>
|
||||
</DIV>`;
|
||||
```
|
||||
@@ -8,7 +8,7 @@ foo("a", , "b");
|
||||
// Prettier stable
|
||||
TypeError: Cannot read property 'type' of null
|
||||
|
||||
// Prettier master
|
||||
// Prettier main
|
||||
[error] stdin: SyntaxError: Argument expression expected. (1:10)
|
||||
[error] > 1 | foo("a", , "b");
|
||||
[error] | ^
|
||||
|
||||
@@ -20,7 +20,7 @@ function foo() {
|
||||
"use strict";;
|
||||
}
|
||||
|
||||
// Prettier master
|
||||
// Prettier main
|
||||
// prettier-ignore
|
||||
'use strict';
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
//----- ^ U+3000 --------------- ^ U+3000
|
||||
</p>;
|
||||
|
||||
// Prettier master
|
||||
// Prettier main
|
||||
<p>
|
||||
<span /> {this.props.data.title} <span />
|
||||
//----- ^ U+3000 --------------- ^ U+3000
|
||||
|
||||
@@ -17,7 +17,7 @@ Markdown
|
||||
|
||||
```
|
||||
|
||||
<!-- Prettier master -->
|
||||
<!-- Prettier main -->
|
||||
Markdown
|
||||
|
||||
```js
|
||||
|
||||
@@ -28,7 +28,7 @@ a|b|c|
|
||||
|
||||
text
|
||||
|
||||
<!-- Prettier master -->
|
||||
<!-- Prettier main -->
|
||||
---
|
||||
---
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
foo: (calc() // not a comment anymore);
|
||||
}
|
||||
|
||||
// Prettier master
|
||||
// Prettier main
|
||||
.simplification {
|
||||
foo: (
|
||||
calc() // not a comment anymore
|
||||
|
||||
@@ -12,7 +12,7 @@ class Foo {
|
||||
// Prettier stable
|
||||
Error: Comment "bat" was not printed. Please report this error!
|
||||
|
||||
// Prettier master
|
||||
// Prettier main
|
||||
class Foo {
|
||||
bar /* bat */();
|
||||
}
|
||||
|
||||
+1
-1
@@ -167,7 +167,7 @@ export const printers = {
|
||||
|
||||
#### The printing process
|
||||
|
||||
Prettier uses an intermediate representation, called a Doc, which Prettier then turns into a string (based on options like `printWidth`). A _printer_'s job is to take the AST generated by `parsers[<parser name>].parse` and return a Doc. A Doc is constructed using [builder commands](https://github.com/prettier/prettier/blob/master/commands.md):
|
||||
Prettier uses an intermediate representation, called a Doc, which Prettier then turns into a string (based on options like `printWidth`). A _printer_'s job is to take the AST generated by `parsers[<parser name>].parse` and return a Doc. A Doc is constructed using [builder commands](https://github.com/prettier/prettier/blob/main/commands.md):
|
||||
|
||||
```js
|
||||
const { join, line, ifBreak, group } = require("prettier").doc.builders;
|
||||
|
||||
@@ -9,4 +9,4 @@ The basic idea is that the printer takes an AST and returns an intermediate repr
|
||||
|
||||
This means that most of the logic of printing an AST involves generating an abstract representation of the output involving certain commands. For example, `["(", line, arg, line, ")"]` would represent a concatenation of opening parens, an argument, and closing parens. But if that doesn’t fit on one line, the printer can break where `line` is specified.
|
||||
|
||||
More (rough) details can be found in [commands.md](https://github.com/prettier/prettier/blob/master/commands.md).
|
||||
More (rough) details can be found in [commands.md](https://github.com/prettier/prettier/blob/main/commands.md).
|
||||
@@ -140,5 +140,5 @@ function formatVersion(version) {
|
||||
function replaceVersions(data) {
|
||||
return data
|
||||
.replace(/prettier stable/gi, `Prettier ${formatVersion(previousVersion)}`)
|
||||
.replace(/prettier master/gi, `Prettier ${formatVersion(version)}`);
|
||||
.replace(/prettier main/gi, `Prettier ${formatVersion(version)}`);
|
||||
}
|
||||
@@ -144,5 +144,11 @@ for (const category of CHANGELOG_CATEGORIES) {
|
||||
`[${displayPath}]: Please put one space between title and PR link.`
|
||||
);
|
||||
}
|
||||
|
||||
if (/prettier master/i.test(content)) {
|
||||
showErrorMessage(
|
||||
`[${displayPath}]: Please use "main" instead of "master".`
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26,7 +26,9 @@ async function run() {
|
||||
throw new Error(`Unexpected previousVersion: ${previousVersion}`);
|
||||
} else {
|
||||
params.previousVersion = previousVersion;
|
||||
params.previousVersionOnMaster = (await readJson("package.json")).version;
|
||||
params.previousVersionOnDefaultBranch = (
|
||||
await readJson("package.json")
|
||||
).version;
|
||||
}
|
||||
|
||||
const steps = [
|
||||
|
||||
@@ -29,10 +29,14 @@ async function commit(version) {
|
||||
await execa("git", ["push"]);
|
||||
}
|
||||
|
||||
async function bump({ version, previousVersion, previousVersionOnMaster }) {
|
||||
async function bump({
|
||||
version,
|
||||
previousVersion,
|
||||
previousVersionOnDefaultBranch,
|
||||
}) {
|
||||
const pkg = await readJson("package.json");
|
||||
if (semver.diff(version, previousVersion) === "patch") {
|
||||
pkg.version = previousVersionOnMaster; // restore the `-dev` version
|
||||
pkg.version = previousVersionOnDefaultBranch; // restore the `-dev` version
|
||||
} else {
|
||||
pkg.version = semver.inc(version, "minor") + "-dev";
|
||||
}
|
||||
@@ -52,6 +56,6 @@ module.exports = async function (params) {
|
||||
);
|
||||
|
||||
await logPromise("Updating files", format());
|
||||
await logPromise("Bump master version", bump(params));
|
||||
await logPromise("Bump default branch version", bump(params));
|
||||
await logPromise("Committing changed files", commit(version));
|
||||
};
|
||||
+1
-1
@@ -49,7 +49,7 @@ module.exports = {
|
||||
type: "suggestion",
|
||||
docs: {
|
||||
url:
|
||||
"https://github.com/prettier/prettier/blob/master/scripts/eslint-plugin-prettier-internal-rules/better-parent-property-check-in-needs-parens.js",
|
||||
"https://github.com/prettier/prettier/blob/main/scripts/eslint-plugin-prettier-internal-rules/better-parent-property-check-in-needs-parens.js",
|
||||
},
|
||||
messages: {
|
||||
[MESSAGE_ID_PREFER_NAME_CHECK]:
|
||||
|
||||
@@ -14,7 +14,7 @@ module.exports = {
|
||||
type: "suggestion",
|
||||
docs: {
|
||||
url:
|
||||
"https://github.com/prettier/prettier/blob/master/scripts/eslint-plugin-prettier-internal-rules/directly-loc-start-end.js",
|
||||
"https://github.com/prettier/prettier/blob/main/scripts/eslint-plugin-prettier-internal-rules/directly-loc-start-end.js",
|
||||
},
|
||||
messages: {
|
||||
[MESSAGE_ID]:
|
||||
|
||||
@@ -10,7 +10,7 @@ module.exports = {
|
||||
type: "suggestion",
|
||||
docs: {
|
||||
url:
|
||||
"https://github.com/prettier/prettier/blob/master/scripts/eslint-plugin-prettier-internal-rules/jsx-identifier-case.js",
|
||||
"https://github.com/prettier/prettier/blob/main/scripts/eslint-plugin-prettier-internal-rules/jsx-identifier-case.js",
|
||||
},
|
||||
messages: {
|
||||
[MESSAGE_ID]: "Please rename '{{name}}' to '{{fixed}}'.",
|
||||
|
||||
@@ -14,7 +14,7 @@ module.exports = {
|
||||
type: "suggestion",
|
||||
docs: {
|
||||
url:
|
||||
"https://github.com/prettier/prettier/blob/master/scripts/eslint-plugin-prettier-internal-rules/no-doc-builder-concat.js",
|
||||
"https://github.com/prettier/prettier/blob/main/scripts/eslint-plugin-prettier-internal-rules/no-doc-builder-concat.js",
|
||||
},
|
||||
messages: {
|
||||
[messageId]: "Use array directly instead of `concat([])`",
|
||||
|
||||
@@ -30,7 +30,7 @@ module.exports = {
|
||||
type: "suggestion",
|
||||
docs: {
|
||||
url:
|
||||
"https://github.com/prettier/prettier/blob/master/scripts/eslint-plugin-prettier-internal-rules/no-node-comments.js",
|
||||
"https://github.com/prettier/prettier/blob/main/scripts/eslint-plugin-prettier-internal-rules/no-node-comments.js",
|
||||
},
|
||||
messages: {
|
||||
[messageId]: "Do not access node.comments.",
|
||||
|
||||
@@ -21,7 +21,7 @@ module.exports = {
|
||||
type: "suggestion",
|
||||
docs: {
|
||||
url:
|
||||
"https://github.com/prettier/prettier/blob/master/scripts/eslint-plugin-prettier-internal-rules/require-json-extensions.js",
|
||||
"https://github.com/prettier/prettier/blob/main/scripts/eslint-plugin-prettier-internal-rules/require-json-extensions.js",
|
||||
},
|
||||
messages: {
|
||||
[messageId]: "Prefer `FastPath#each()` over `FastPath#map()`.",
|
||||
|
||||
@@ -57,7 +57,7 @@ module.exports = {
|
||||
type: "suggestion",
|
||||
docs: {
|
||||
url:
|
||||
"https://github.com/prettier/prettier/blob/master/scripts/eslint-plugin-prettier-internal-rules/prefer-is-non-empty-array.js",
|
||||
"https://github.com/prettier/prettier/blob/main/scripts/eslint-plugin-prettier-internal-rules/prefer-is-non-empty-array.js",
|
||||
},
|
||||
messages: {
|
||||
[MESSAGE_ID]: "Please use `isNonEmptyArray()`.",
|
||||
|
||||
@@ -27,7 +27,7 @@ module.exports = {
|
||||
type: "suggestion",
|
||||
docs: {
|
||||
url:
|
||||
"https://github.com/prettier/prettier/blob/master/scripts/eslint-plugin-prettier-internal-rules/require-json-extensions.js",
|
||||
"https://github.com/prettier/prettier/blob/main/scripts/eslint-plugin-prettier-internal-rules/require-json-extensions.js",
|
||||
},
|
||||
messages: {
|
||||
[MESSAGE_ID]: 'Missing file extension ".json" for "{{id}}".',
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
const CATEGORY_COMMON = "Common";
|
||||
|
||||
// format based on https://github.com/prettier/prettier/blob/master/src/main/core-options.js
|
||||
// format based on https://github.com/prettier/prettier/blob/main/src/main/core-options.js
|
||||
module.exports = {
|
||||
bracketSpacing: {
|
||||
since: "0.0.0",
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
const commonOptions = require("../common/common-options");
|
||||
|
||||
// format based on https://github.com/prettier/prettier/blob/master/src/main/core-options.js
|
||||
// format based on https://github.com/prettier/prettier/blob/main/src/main/core-options.js
|
||||
module.exports = {
|
||||
singleQuote: commonOptions.singleQuote,
|
||||
};
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
const commonOptions = require("../common/common-options");
|
||||
|
||||
// format based on https://github.com/prettier/prettier/blob/master/src/main/core-options.js
|
||||
// format based on https://github.com/prettier/prettier/blob/main/src/main/core-options.js
|
||||
module.exports = {
|
||||
bracketSpacing: commonOptions.bracketSpacing,
|
||||
};
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
const CATEGORY_HTML = "HTML";
|
||||
|
||||
// format based on https://github.com/prettier/prettier/blob/master/src/main/core-options.js
|
||||
// format based on https://github.com/prettier/prettier/blob/main/src/main/core-options.js
|
||||
module.exports = {
|
||||
htmlWhitespaceSensitivity: {
|
||||
since: "1.15.0",
|
||||
|
||||
@@ -4,7 +4,7 @@ const commonOptions = require("../common/common-options");
|
||||
|
||||
const CATEGORY_JAVASCRIPT = "JavaScript";
|
||||
|
||||
// format based on https://github.com/prettier/prettier/blob/master/src/main/core-options.js
|
||||
// format based on https://github.com/prettier/prettier/blob/main/src/main/core-options.js
|
||||
module.exports = {
|
||||
arrowParens: {
|
||||
since: "1.9.0",
|
||||
|
||||
@@ -47,7 +47,7 @@ function printHtmlBinding(path, options, print) {
|
||||
}
|
||||
}
|
||||
|
||||
// based on https://github.com/prettier/prettier/blob/master/src/language-html/syntax-vue.js isVueEventBindingExpression()
|
||||
// based on https://github.com/prettier/prettier/blob/main/src/language-html/syntax-vue.js isVueEventBindingExpression()
|
||||
function isVueEventBindingExpression(node) {
|
||||
switch (node.type) {
|
||||
case "MemberExpression":
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
const commonOptions = require("../common/common-options");
|
||||
|
||||
// format based on https://github.com/prettier/prettier/blob/master/src/main/core-options.js
|
||||
// format based on https://github.com/prettier/prettier/blob/main/src/main/core-options.js
|
||||
module.exports = {
|
||||
proseWrap: commonOptions.proseWrap,
|
||||
singleQuote: commonOptions.singleQuote,
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
const commonOptions = require("../common/common-options");
|
||||
|
||||
// format based on https://github.com/prettier/prettier/blob/master/src/main/core-options.js
|
||||
// format based on https://github.com/prettier/prettier/blob/main/src/main/core-options.js
|
||||
module.exports = {
|
||||
bracketSpacing: commonOptions.bracketSpacing,
|
||||
singleQuote: commonOptions.singleQuote,
|
||||
|
||||
@@ -229,7 +229,7 @@ const EditorSupportSection = () => (
|
||||
<div style={{ float: "right" }}>
|
||||
<span>Got more? </span>
|
||||
<a
|
||||
href={`${siteConfig.githubUrl}/edit/master/website/data/editors.yml`}
|
||||
href={`${siteConfig.githubUrl}/edit/main/website/data/editors.yml`}
|
||||
className="button"
|
||||
>
|
||||
Send a PR
|
||||
|
||||
@@ -15,12 +15,12 @@ const CWD = process.cwd();
|
||||
const versions = require(`${CWD}/versions.json`);
|
||||
|
||||
const rootPackageJson = require(`${CWD}/../package.json`);
|
||||
const masterVersion = rootPackageJson.version;
|
||||
const isMasterDevVersion = masterVersion.endsWith("-dev");
|
||||
const devVersion = isMasterDevVersion ? masterVersion : null;
|
||||
const latestVersion = isMasterDevVersion
|
||||
const defaultBranchVersion = rootPackageJson.version;
|
||||
const isDefaultBranchDevVersion = defaultBranchVersion.endsWith("-dev");
|
||||
const devVersion = isDefaultBranchDevVersion ? defaultBranchVersion : null;
|
||||
const latestVersion = isDefaultBranchDevVersion
|
||||
? rootPackageJson.devDependencies.prettier
|
||||
: masterVersion;
|
||||
: defaultBranchVersion;
|
||||
const [latestDocsVersion, ...pastDocsVersions] = versions;
|
||||
|
||||
function Versions(props) {
|
||||
@@ -60,7 +60,7 @@ function Versions(props) {
|
||||
<a href={`${siteConfig.baseUrl}docs/en/next/index.html`}>
|
||||
next
|
||||
</a>{" "}
|
||||
(master)
|
||||
(main)
|
||||
</td>
|
||||
</tr>
|
||||
{pastDocsVersions.length > 0 &&
|
||||
|
||||
@@ -11,7 +11,7 @@ export default function ({ version }) {
|
||||
} else if (/\.0$/.test(version)) {
|
||||
href = `releases/tag/${version}`;
|
||||
} else {
|
||||
href = `blob/master/CHANGELOG.md#${version.replace(/\./g, "")}`;
|
||||
href = `blob/main/CHANGELOG.md#${version.replace(/\./g, "")}`;
|
||||
}
|
||||
|
||||
const formattedVersion = match ? `PR #${match[1]}` : `v${version}`;
|
||||
|
||||
@@ -32,7 +32,7 @@ const siteConfig = {
|
||||
tideliftUrl:
|
||||
"https://tidelift.com/subscription/pkg/npm-prettier?utm_source=npm-prettier&utm_medium=referral&utm_campaign=website",
|
||||
/* base url for editing docs, usage example: editUrl + 'en/doc1.md' */
|
||||
editUrl: `${GITHUB_URL}/edit/master/docs/`,
|
||||
editUrl: `${GITHUB_URL}/edit/main/docs/`,
|
||||
headerLinks: [
|
||||
{ href: "/playground/", label: "Playground" },
|
||||
{ doc: "index", label: "Docs" },
|
||||
|
||||
@@ -168,7 +168,7 @@ export const printers = {
|
||||
|
||||
#### The printing process
|
||||
|
||||
Prettier uses an intermediate representation, called a Doc, which Prettier then turns into a string (based on options like `printWidth`). A _printer_'s job is to take the AST generated by `parsers[<parser name>].parse` and return a Doc. A Doc is constructed using [builder commands](https://github.com/prettier/prettier/blob/master/commands.md):
|
||||
Prettier uses an intermediate representation, called a Doc, which Prettier then turns into a string (based on options like `printWidth`). A _printer_'s job is to take the AST generated by `parsers[<parser name>].parse` and return a Doc. A Doc is constructed using [builder commands](https://github.com/prettier/prettier/blob/main/commands.md):
|
||||
|
||||
```js
|
||||
const { concat, join, line, ifBreak, group } = require("prettier").doc.builders;
|
||||
|
||||
@@ -10,4 +10,4 @@ The basic idea is that the printer takes an AST and returns an intermediate repr
|
||||
|
||||
This means that most of the logic of printing an AST involves generating an abstract representation of the output involving certain commands. For example, `concat(["(", line, arg, line, ")"])` would represent a concatenation of opening parens, an argument, and closing parens. But if that doesn’t fit on one line, the printer can break where `line` is specified.
|
||||
|
||||
More (rough) details can be found in [commands.md](https://github.com/prettier/prettier/blob/master/commands.md).
|
||||
More (rough) details can be found in [commands.md](https://github.com/prettier/prettier/blob/main/commands.md).
|
||||
Reference in new issue
Block a user