diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index ff66d8bff..a687fe657 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -53,8 +53,7 @@ jobs: run: yarn lint:blog - name: Lint docs code block - # TODO: Lint files in `website/versioned_docs/version-stable` too - run: yarn "docs/**/*.md" + run: yarn prettier "{docs,website/versioned_docs/version-stable}/**/*.md" --check env: # Make Prettier throws on embeded format PRETTIER_DEBUG: true diff --git a/CHANGELOG.md b/CHANGELOG.md index 24810aec0..bf7a23d22 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2053,7 +2053,7 @@ Test abc. #### Fix broken format for `...infer T` ([#9044](https://github.com/prettier/prettier/pull/9044) by [@fisker](https://github.com/fisker)) -```typescript +```ts // Input type Tail = T extends [infer U, ...infer R] ? R : never; diff --git a/docs/rationale.md b/docs/rationale.md index 0abe6ed85..fbd56b86d 100644 --- a/docs/rationale.md +++ b/docs/rationale.md @@ -87,7 +87,7 @@ const user = { Just like with objects, decorators are used for a lot of different things. Sometimes it makes sense to write decorators _above_ the line they're decorating, sometimes it’s nicer if they're on the _same_ line. We haven’t been able to find a good rule for this, so Prettier keeps your decorator positioned like you wrote them (if they fit on the line). This isn’t ideal, but a pragmatic solution to a difficult problem. -```js +```ts @Component({ selector: "hero-button", template: ``, @@ -108,14 +108,14 @@ class HeroButtonComponent { There’s one exception: classes. We don’t think it ever makes sense to inline the decorators for them, so they are always moved to their own line. -```js +```ts // Before running Prettier: @observer class OrderLine { @observable price: number = 0; } ``` -```js +```ts // After running Prettier: @observer class OrderLine { @@ -125,7 +125,7 @@ class OrderLine { Note: Prettier 1.14.x and older tried to automatically move your decorators, so if you've run an older Prettier version on your code you might need to manually join up some decorators here and there to avoid inconsistencies: -```js +```ts @observer class OrderLine { @observable price: number = 0; diff --git a/website/blog/2017-12-05-1.9.0.md b/website/blog/2017-12-05-1.9.0.md index 7bd9786de..df46cafe4 100644 --- a/website/blog/2017-12-05-1.9.0.md +++ b/website/blog/2017-12-05-1.9.0.md @@ -220,7 +220,7 @@ const { We were omitting parens around type assertions inside decorators: -```typescript +```ts @(bind as ClassDecorator) class Decorated {} ``` diff --git a/website/blog/2021-05-09-2.3.0.md b/website/blog/2021-05-09-2.3.0.md index 73b86cbb3..ea6ac8d24 100644 --- a/website/blog/2021-05-09-2.3.0.md +++ b/website/blog/2021-05-09-2.3.0.md @@ -819,7 +819,7 @@ const x = async do { `typescript` parser only, `babel-ts` doesn't have this issue. -```typescript +```ts // Input class Foo { bar() /* bat */; diff --git a/website/versioned_docs/version-stable/rationale.md b/website/versioned_docs/version-stable/rationale.md index 83967597e..f7713a988 100644 --- a/website/versioned_docs/version-stable/rationale.md +++ b/website/versioned_docs/version-stable/rationale.md @@ -88,7 +88,7 @@ const user = { Just like with objects, decorators are used for a lot of different things. Sometimes it makes sense to write decorators _above_ the line they're decorating, sometimes it’s nicer if they're on the _same_ line. We haven’t been able to find a good rule for this, so Prettier keeps your decorator positioned like you wrote them (if they fit on the line). This isn’t ideal, but a pragmatic solution to a difficult problem. -```js +```ts @Component({ selector: "hero-button", template: ``, @@ -109,14 +109,14 @@ class HeroButtonComponent { There’s one exception: classes. We don’t think it ever makes sense to inline the decorators for them, so they are always moved to their own line. -```js +```ts // Before running Prettier: @observer class OrderLine { @observable price: number = 0; } ``` -```js +```ts // After running Prettier: @observer class OrderLine { @@ -126,7 +126,7 @@ class OrderLine { Note: Prettier 1.14.x and older tried to automatically move your decorators, so if you've run an older Prettier version on your code you might need to manually join up some decorators here and there to avoid inconsistencies: -```js +```ts @observer class OrderLine { @observable price: number = 0;