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.
|
- [ ] 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 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`.
|
- [ ] (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 -->
|
<!-- Please DO NOT remove the playground link -->
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ name: Dev
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- master
|
- main
|
||||||
- patch-release
|
- patch-release
|
||||||
pull_request:
|
pull_request:
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ name: Lint
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- master
|
- main
|
||||||
- patch-release
|
- patch-release
|
||||||
pull_request:
|
pull_request:
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ name: Prod
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- master
|
- main
|
||||||
- patch-release
|
- patch-release
|
||||||
pull_request:
|
pull_request:
|
||||||
|
|
||||||
@@ -30,7 +30,7 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
v2-build-cache-${{ hashFiles('yarn.lock') }}-${{ hashFiles('scripts/build/**/*') }}-${{ github.ref }}-
|
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/${{ 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
|
- name: Build Package
|
||||||
run: yarn build
|
run: yarn build
|
||||||
@@ -43,7 +43,7 @@ jobs:
|
|||||||
|
|
||||||
# This step calls `git reset`
|
# This step calls `git reset`
|
||||||
# It should be the last step
|
# 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
|
- name: Check Sizes
|
||||||
if: github.event_name == 'pull_request' && startsWith(github.head_ref, 'dependabot/npm_and_yarn/')
|
if: github.event_name == 'pull_request' && startsWith(github.head_ref, 'dependabot/npm_and_yarn/')
|
||||||
uses: preactjs/compressed-size-action@2.1.0
|
uses: preactjs/compressed-size-action@2.1.0
|
||||||
|
|||||||
@@ -37,11 +37,11 @@
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p align="center">
|
<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>
|
<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>
|
<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>
|
<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">
|
<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>
|
<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
|
// Prettier stable
|
||||||
foo ?? baz || baz;
|
foo ?? baz || baz;
|
||||||
|
|
||||||
// Prettier master
|
// Prettier main
|
||||||
(foo ?? baz) || baz;
|
(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
|
// Prettier stable
|
||||||
myDoc = group(concat(["foo", line, "bar"]));
|
myDoc = group(concat(["foo", line, "bar"]));
|
||||||
|
|
||||||
// Prettier master
|
// Prettier main
|
||||||
myDoc = group(["foo", line, "bar"]);
|
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 */
|
/* Prettier stable */
|
||||||
-custom-url(/ absolute/path)
|
-custom-url(/ absolute/path)
|
||||||
|
|
||||||
/* Prettier master */
|
/* Prettier main */
|
||||||
-custom-url(/absolute/path)
|
-custom-url(/absolute/path)
|
||||||
```
|
```
|
||||||
@@ -10,6 +10,6 @@ declare export * from "ES6_ExportAllFrom_Source2";
|
|||||||
// Prettier stable
|
// Prettier stable
|
||||||
declare export * from "ES6_ExportAllFrom_Source2"
|
declare export * from "ES6_ExportAllFrom_Source2"
|
||||||
|
|
||||||
// Prettier master
|
// Prettier main
|
||||||
declare export * from "ES6_ExportAllFrom_Source2";
|
declare export * from "ES6_ExportAllFrom_Source2";
|
||||||
```
|
```
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
{{! Comment }}
|
{{! Comment }}
|
||||||
{{! Comment }}
|
{{! Comment }}
|
||||||
|
|
||||||
{{!-- Prettier master --}}
|
{{!-- Prettier main --}}
|
||||||
{{~! Comment }}
|
{{~! Comment }}
|
||||||
{{! Comment ~}}
|
{{! Comment ~}}
|
||||||
{{~! Comment ~}}
|
{{~! Comment ~}}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
Hello
|
Hello
|
||||||
{{/block}}
|
{{/block}}
|
||||||
|
|
||||||
{{!-- Prettier master --}}
|
{{!-- Prettier main --}}
|
||||||
<MyComponent
|
<MyComponent
|
||||||
@prop={{true}}
|
@prop={{true}}
|
||||||
@prop2={{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"
|
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>
|
></div>
|
||||||
|
|
||||||
<!-- Prettier master -->
|
<!-- Prettier main -->
|
||||||
<div
|
<div
|
||||||
class="
|
class="
|
||||||
SomeComponent__heading-row
|
SomeComponent__heading-row
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ class loooooooooooooooooooong
|
|||||||
property: string;
|
property: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prettier master
|
// Prettier main
|
||||||
class loooooooooooooooooooong
|
class loooooooooooooooooooong
|
||||||
extends looooooooooooooooooong
|
extends looooooooooooooooooong
|
||||||
implements loooooooooooooooooooong
|
implements loooooooooooooooooooong
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ b;
|
|||||||
a; /*2*/ /*3*/
|
a; /*2*/ /*3*/
|
||||||
/*1*/ b;
|
/*1*/ b;
|
||||||
|
|
||||||
// Prettier master
|
// Prettier main
|
||||||
a;
|
a;
|
||||||
/*1*/ /*2*/
|
/*1*/ /*2*/
|
||||||
/*3*/
|
/*3*/
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ foo = 1.0000;bar = 1.0000;baz=1.0000;
|
|||||||
foo = 1.0;
|
foo = 1.0;
|
||||||
bar = 1.0;baz=1.0000;
|
bar = 1.0;baz=1.0000;
|
||||||
|
|
||||||
// Prettier master
|
// Prettier main
|
||||||
foo = 1.0000;bar = 1.0;baz=1.0000;
|
foo = 1.0000;bar = 1.0;baz=1.0000;
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
<a></// comment
|
<a></// comment
|
||||||
a>;
|
a>;
|
||||||
|
|
||||||
// Prettier master
|
// Prettier main
|
||||||
<a></
|
<a></
|
||||||
// comment
|
// comment
|
||||||
a
|
a
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ foo /* HTML */ = `<div></div>`;
|
|||||||
foo /* HTML */ = `<DIV>
|
foo /* HTML */ = `<DIV>
|
||||||
</DIV>`;
|
</DIV>`;
|
||||||
|
|
||||||
// Prettier master (All JavaScript parsers)
|
// Prettier main (All JavaScript parsers)
|
||||||
foo /* HTML */ = `<DIV>
|
foo /* HTML */ = `<DIV>
|
||||||
</DIV>`;
|
</DIV>`;
|
||||||
```
|
```
|
||||||
@@ -8,7 +8,7 @@ foo("a", , "b");
|
|||||||
// Prettier stable
|
// Prettier stable
|
||||||
TypeError: Cannot read property 'type' of null
|
TypeError: Cannot read property 'type' of null
|
||||||
|
|
||||||
// Prettier master
|
// Prettier main
|
||||||
[error] stdin: SyntaxError: Argument expression expected. (1:10)
|
[error] stdin: SyntaxError: Argument expression expected. (1:10)
|
||||||
[error] > 1 | foo("a", , "b");
|
[error] > 1 | foo("a", , "b");
|
||||||
[error] | ^
|
[error] | ^
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ function foo() {
|
|||||||
"use strict";;
|
"use strict";;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prettier master
|
// Prettier main
|
||||||
// prettier-ignore
|
// prettier-ignore
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
//----- ^ U+3000 --------------- ^ U+3000
|
//----- ^ U+3000 --------------- ^ U+3000
|
||||||
</p>;
|
</p>;
|
||||||
|
|
||||||
// Prettier master
|
// Prettier main
|
||||||
<p>
|
<p>
|
||||||
<span /> {this.props.data.title} <span />
|
<span /> {this.props.data.title} <span />
|
||||||
//----- ^ U+3000 --------------- ^ U+3000
|
//----- ^ U+3000 --------------- ^ U+3000
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ Markdown
|
|||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
<!-- Prettier master -->
|
<!-- Prettier main -->
|
||||||
Markdown
|
Markdown
|
||||||
|
|
||||||
```js
|
```js
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ a|b|c|
|
|||||||
|
|
||||||
text
|
text
|
||||||
|
|
||||||
<!-- Prettier master -->
|
<!-- Prettier main -->
|
||||||
---
|
---
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
foo: (calc() // not a comment anymore);
|
foo: (calc() // not a comment anymore);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prettier master
|
// Prettier main
|
||||||
.simplification {
|
.simplification {
|
||||||
foo: (
|
foo: (
|
||||||
calc() // not a comment anymore
|
calc() // not a comment anymore
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ class Foo {
|
|||||||
// Prettier stable
|
// Prettier stable
|
||||||
Error: Comment "bat" was not printed. Please report this error!
|
Error: Comment "bat" was not printed. Please report this error!
|
||||||
|
|
||||||
// Prettier master
|
// Prettier main
|
||||||
class Foo {
|
class Foo {
|
||||||
bar /* bat */();
|
bar /* bat */();
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -167,7 +167,7 @@ export const printers = {
|
|||||||
|
|
||||||
#### The printing process
|
#### 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
|
```js
|
||||||
const { join, line, ifBreak, group } = require("prettier").doc.builders;
|
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.
|
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) {
|
function replaceVersions(data) {
|
||||||
return data
|
return data
|
||||||
.replace(/prettier stable/gi, `Prettier ${formatVersion(previousVersion)}`)
|
.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.`
|
`[${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}`);
|
throw new Error(`Unexpected previousVersion: ${previousVersion}`);
|
||||||
} else {
|
} else {
|
||||||
params.previousVersion = previousVersion;
|
params.previousVersion = previousVersion;
|
||||||
params.previousVersionOnMaster = (await readJson("package.json")).version;
|
params.previousVersionOnDefaultBranch = (
|
||||||
|
await readJson("package.json")
|
||||||
|
).version;
|
||||||
}
|
}
|
||||||
|
|
||||||
const steps = [
|
const steps = [
|
||||||
|
|||||||
@@ -29,10 +29,14 @@ async function commit(version) {
|
|||||||
await execa("git", ["push"]);
|
await execa("git", ["push"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function bump({ version, previousVersion, previousVersionOnMaster }) {
|
async function bump({
|
||||||
|
version,
|
||||||
|
previousVersion,
|
||||||
|
previousVersionOnDefaultBranch,
|
||||||
|
}) {
|
||||||
const pkg = await readJson("package.json");
|
const pkg = await readJson("package.json");
|
||||||
if (semver.diff(version, previousVersion) === "patch") {
|
if (semver.diff(version, previousVersion) === "patch") {
|
||||||
pkg.version = previousVersionOnMaster; // restore the `-dev` version
|
pkg.version = previousVersionOnDefaultBranch; // restore the `-dev` version
|
||||||
} else {
|
} else {
|
||||||
pkg.version = semver.inc(version, "minor") + "-dev";
|
pkg.version = semver.inc(version, "minor") + "-dev";
|
||||||
}
|
}
|
||||||
@@ -52,6 +56,6 @@ module.exports = async function (params) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
await logPromise("Updating files", format());
|
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));
|
await logPromise("Committing changed files", commit(version));
|
||||||
};
|
};
|
||||||
+1
-1
@@ -49,7 +49,7 @@ module.exports = {
|
|||||||
type: "suggestion",
|
type: "suggestion",
|
||||||
docs: {
|
docs: {
|
||||||
url:
|
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: {
|
messages: {
|
||||||
[MESSAGE_ID_PREFER_NAME_CHECK]:
|
[MESSAGE_ID_PREFER_NAME_CHECK]:
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ module.exports = {
|
|||||||
type: "suggestion",
|
type: "suggestion",
|
||||||
docs: {
|
docs: {
|
||||||
url:
|
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: {
|
messages: {
|
||||||
[MESSAGE_ID]:
|
[MESSAGE_ID]:
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ module.exports = {
|
|||||||
type: "suggestion",
|
type: "suggestion",
|
||||||
docs: {
|
docs: {
|
||||||
url:
|
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: {
|
messages: {
|
||||||
[MESSAGE_ID]: "Please rename '{{name}}' to '{{fixed}}'.",
|
[MESSAGE_ID]: "Please rename '{{name}}' to '{{fixed}}'.",
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ module.exports = {
|
|||||||
type: "suggestion",
|
type: "suggestion",
|
||||||
docs: {
|
docs: {
|
||||||
url:
|
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: {
|
messages: {
|
||||||
[messageId]: "Use array directly instead of `concat([])`",
|
[messageId]: "Use array directly instead of `concat([])`",
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ module.exports = {
|
|||||||
type: "suggestion",
|
type: "suggestion",
|
||||||
docs: {
|
docs: {
|
||||||
url:
|
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: {
|
messages: {
|
||||||
[messageId]: "Do not access node.comments.",
|
[messageId]: "Do not access node.comments.",
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ module.exports = {
|
|||||||
type: "suggestion",
|
type: "suggestion",
|
||||||
docs: {
|
docs: {
|
||||||
url:
|
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: {
|
messages: {
|
||||||
[messageId]: "Prefer `FastPath#each()` over `FastPath#map()`.",
|
[messageId]: "Prefer `FastPath#each()` over `FastPath#map()`.",
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ module.exports = {
|
|||||||
type: "suggestion",
|
type: "suggestion",
|
||||||
docs: {
|
docs: {
|
||||||
url:
|
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: {
|
messages: {
|
||||||
[MESSAGE_ID]: "Please use `isNonEmptyArray()`.",
|
[MESSAGE_ID]: "Please use `isNonEmptyArray()`.",
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ module.exports = {
|
|||||||
type: "suggestion",
|
type: "suggestion",
|
||||||
docs: {
|
docs: {
|
||||||
url:
|
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: {
|
messages: {
|
||||||
[MESSAGE_ID]: 'Missing file extension ".json" for "{{id}}".',
|
[MESSAGE_ID]: 'Missing file extension ".json" for "{{id}}".',
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
const CATEGORY_COMMON = "Common";
|
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 = {
|
module.exports = {
|
||||||
bracketSpacing: {
|
bracketSpacing: {
|
||||||
since: "0.0.0",
|
since: "0.0.0",
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
const commonOptions = require("../common/common-options");
|
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 = {
|
module.exports = {
|
||||||
singleQuote: commonOptions.singleQuote,
|
singleQuote: commonOptions.singleQuote,
|
||||||
};
|
};
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
const commonOptions = require("../common/common-options");
|
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 = {
|
module.exports = {
|
||||||
bracketSpacing: commonOptions.bracketSpacing,
|
bracketSpacing: commonOptions.bracketSpacing,
|
||||||
};
|
};
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
const CATEGORY_HTML = "HTML";
|
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 = {
|
module.exports = {
|
||||||
htmlWhitespaceSensitivity: {
|
htmlWhitespaceSensitivity: {
|
||||||
since: "1.15.0",
|
since: "1.15.0",
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ const commonOptions = require("../common/common-options");
|
|||||||
|
|
||||||
const CATEGORY_JAVASCRIPT = "JavaScript";
|
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 = {
|
module.exports = {
|
||||||
arrowParens: {
|
arrowParens: {
|
||||||
since: "1.9.0",
|
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) {
|
function isVueEventBindingExpression(node) {
|
||||||
switch (node.type) {
|
switch (node.type) {
|
||||||
case "MemberExpression":
|
case "MemberExpression":
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
const commonOptions = require("../common/common-options");
|
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 = {
|
module.exports = {
|
||||||
proseWrap: commonOptions.proseWrap,
|
proseWrap: commonOptions.proseWrap,
|
||||||
singleQuote: commonOptions.singleQuote,
|
singleQuote: commonOptions.singleQuote,
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
const commonOptions = require("../common/common-options");
|
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 = {
|
module.exports = {
|
||||||
bracketSpacing: commonOptions.bracketSpacing,
|
bracketSpacing: commonOptions.bracketSpacing,
|
||||||
singleQuote: commonOptions.singleQuote,
|
singleQuote: commonOptions.singleQuote,
|
||||||
|
|||||||
@@ -229,7 +229,7 @@ const EditorSupportSection = () => (
|
|||||||
<div style={{ float: "right" }}>
|
<div style={{ float: "right" }}>
|
||||||
<span>Got more? </span>
|
<span>Got more? </span>
|
||||||
<a
|
<a
|
||||||
href={`${siteConfig.githubUrl}/edit/master/website/data/editors.yml`}
|
href={`${siteConfig.githubUrl}/edit/main/website/data/editors.yml`}
|
||||||
className="button"
|
className="button"
|
||||||
>
|
>
|
||||||
Send a PR
|
Send a PR
|
||||||
|
|||||||
@@ -15,12 +15,12 @@ const CWD = process.cwd();
|
|||||||
const versions = require(`${CWD}/versions.json`);
|
const versions = require(`${CWD}/versions.json`);
|
||||||
|
|
||||||
const rootPackageJson = require(`${CWD}/../package.json`);
|
const rootPackageJson = require(`${CWD}/../package.json`);
|
||||||
const masterVersion = rootPackageJson.version;
|
const defaultBranchVersion = rootPackageJson.version;
|
||||||
const isMasterDevVersion = masterVersion.endsWith("-dev");
|
const isDefaultBranchDevVersion = defaultBranchVersion.endsWith("-dev");
|
||||||
const devVersion = isMasterDevVersion ? masterVersion : null;
|
const devVersion = isDefaultBranchDevVersion ? defaultBranchVersion : null;
|
||||||
const latestVersion = isMasterDevVersion
|
const latestVersion = isDefaultBranchDevVersion
|
||||||
? rootPackageJson.devDependencies.prettier
|
? rootPackageJson.devDependencies.prettier
|
||||||
: masterVersion;
|
: defaultBranchVersion;
|
||||||
const [latestDocsVersion, ...pastDocsVersions] = versions;
|
const [latestDocsVersion, ...pastDocsVersions] = versions;
|
||||||
|
|
||||||
function Versions(props) {
|
function Versions(props) {
|
||||||
@@ -60,7 +60,7 @@ function Versions(props) {
|
|||||||
<a href={`${siteConfig.baseUrl}docs/en/next/index.html`}>
|
<a href={`${siteConfig.baseUrl}docs/en/next/index.html`}>
|
||||||
next
|
next
|
||||||
</a>{" "}
|
</a>{" "}
|
||||||
(master)
|
(main)
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{pastDocsVersions.length > 0 &&
|
{pastDocsVersions.length > 0 &&
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ export default function ({ version }) {
|
|||||||
} else if (/\.0$/.test(version)) {
|
} else if (/\.0$/.test(version)) {
|
||||||
href = `releases/tag/${version}`;
|
href = `releases/tag/${version}`;
|
||||||
} else {
|
} 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}`;
|
const formattedVersion = match ? `PR #${match[1]}` : `v${version}`;
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ const siteConfig = {
|
|||||||
tideliftUrl:
|
tideliftUrl:
|
||||||
"https://tidelift.com/subscription/pkg/npm-prettier?utm_source=npm-prettier&utm_medium=referral&utm_campaign=website",
|
"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' */
|
/* base url for editing docs, usage example: editUrl + 'en/doc1.md' */
|
||||||
editUrl: `${GITHUB_URL}/edit/master/docs/`,
|
editUrl: `${GITHUB_URL}/edit/main/docs/`,
|
||||||
headerLinks: [
|
headerLinks: [
|
||||||
{ href: "/playground/", label: "Playground" },
|
{ href: "/playground/", label: "Playground" },
|
||||||
{ doc: "index", label: "Docs" },
|
{ doc: "index", label: "Docs" },
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ export const printers = {
|
|||||||
|
|
||||||
#### The printing process
|
#### 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
|
```js
|
||||||
const { concat, join, line, ifBreak, group } = require("prettier").doc.builders;
|
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.
|
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