Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add parentheses to TypeofTypeAnnotation #14458

Merged
merged 5 commits into from Mar 8, 2023

Conversation

fisker
Copy link
Sponsor Member

@fisker fisker commented Mar 6, 2023

Description

Missed in #14042, flow support this syntax too.

Checklist

  • 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.

Try the playground for this PR

@fisker fisker merged commit f1b18f2 into prettier:main Mar 8, 2023
24 of 25 checks passed
@fisker fisker deleted the TypeofTypeAnnotation branch March 8, 2023 15:16
crapStone pushed a commit to Calciumdibromid/CaBr2 that referenced this pull request Mar 29, 2023
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [prettier](https://prettier.io) ([source](https://github.com/prettier/prettier)) | devDependencies | patch | [`2.8.4` -> `2.8.7`](https://renovatebot.com/diffs/npm/prettier/2.8.4/2.8.7) |

---

### Release Notes

<details>
<summary>prettier/prettier</summary>

### [`v2.8.7`](https://github.com/prettier/prettier/blob/HEAD/CHANGELOG.md#&#8203;287)

[Compare Source](prettier/prettier@2.8.6...2.8.7)

[diff](prettier/prettier@2.8.6...2.8.7)

##### Allow multiple decorators on same getter/setter ([#&#8203;14584](prettier/prettier#14584) by [@&#8203;fisker](https://github.com/fisker))

<!-- prettier-ignore -->

```ts
// Input
class A {
  @&#8203;decorator()
  get foo () {}

  @&#8203;decorator()
  set foo (value) {}
}

// Prettier 2.8.6
SyntaxError: Decorators cannot be applied to multiple get/set accessors of the same name. (5:3)
  3 |   get foo () {}
  4 |
> 5 |   @&#8203;decorator()
    |   ^^^^^^^^^^^^
  6 |   set foo (value) {}
  7 | }

// Prettier 2.8.7
class A {
  @&#8203;decorator()
  get foo() {}

  @&#8203;decorator()
  set foo(value) {}
}
```

### [`v2.8.6`](https://github.com/prettier/prettier/blob/HEAD/CHANGELOG.md#&#8203;286)

[Compare Source](prettier/prettier@2.8.5...2.8.6)

[diff](prettier/prettier@2.8.5...2.8.6)

##### Allow decorators on private members and class expressions ([#&#8203;14548](prettier/prettier#14548) by [@&#8203;fisker](https://github.com/fisker))

<!-- prettier-ignore -->

```ts
// Input
class A {
  @&#8203;decorator()
  #privateMethod () {}
}

// Prettier 2.8.5
SyntaxError: Decorators are not valid here. (2:3)
  1 | class A {
> 2 |   @&#8203;decorator()
    |   ^^^^^^^^^^^^
  3 |   #privateMethod () {}
  4 | }

// Prettier 2.8.6
class A {
  @&#8203;decorator()
  #privateMethod() {}
}
```

### [`v2.8.5`](https://github.com/prettier/prettier/blob/HEAD/CHANGELOG.md#&#8203;285)

[Compare Source](prettier/prettier@2.8.4...2.8.5)

[diff](prettier/prettier@2.8.4...2.8.5)

##### Support TypeScript 5.0 ([#&#8203;14391](prettier/prettier#14391) by [@&#8203;fisker](https://github.com/fisker), [#&#8203;13819](prettier/prettier#13819) by [@&#8203;fisker](https://github.com/fisker), [@&#8203;sosukesuzuki](https://github.com/sosukesuzuki))

TypeScript 5.0 introduces two new syntactic features:

-   `const` modifiers for type parameters
-   `export type *` declarations

##### Add missing parentheses for decorator ([#&#8203;14393](prettier/prettier#14393) by [@&#8203;fisker](https://github.com/fisker))

<!-- prettier-ignore -->

```jsx
// Input
class Person {
  @&#8203;(myDecoratorArray[0])
  greet() {}
}

// Prettier 2.8.4
class Person {
  @&#8203;myDecoratorArray[0]
  greet() {}
}

// Prettier 2.8.5
class Person {
  @&#8203;(myDecoratorArray[0])
  greet() {}
}
```

##### Add parentheses for `TypeofTypeAnnotation` to improve readability ([#&#8203;14458](prettier/prettier#14458) by [@&#8203;fisker](https://github.com/fisker))

<!-- prettier-ignore -->

```tsx
// Input
type A = (typeof node.children)[];

// Prettier 2.8.4
type A = typeof node.children[];

// Prettier 2.8.5
type A = (typeof node.children)[];
```

##### Support `max_line_length=off` when parsing `.editorconfig` ([#&#8203;14516](prettier/prettier#14516) by [@&#8203;josephfrazier](https://github.com/josephfrazier))

If an .editorconfig file is in your project and it sets `max_line_length=off` for the file you're formatting,
it will be interpreted as a `printWidth` of `Infinity` rather than being ignored
(which previously resulted in the default `printWidth` of 80 being applied, if not overridden by Prettier-specific configuration).

<!-- prettier-ignore -->

```html
<!-- Input -->
<div className='HelloWorld' title={`You are visitor number ${ num }`} onMouseOver={onMouseOver}/>

<!-- Prettier 2.8.4 -->
<div
  className="HelloWorld"
  title={`You are visitor number ${num}`}
  onMouseOver={onMouseOver}
/>;

<!-- Prettier 2.8.5 -->
<div className="HelloWorld" title={`You are visitor number ${num}`} onMouseOver={onMouseOver} />;
```

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNS4yNC4yIiwidXBkYXRlZEluVmVyIjoiMzUuMjQuMiJ9-->

Co-authored-by: cabr2-bot <cabr2.help@gmail.com>
Reviewed-on: https://codeberg.org/Calciumdibromid/CaBr2/pulls/1832
Reviewed-by: Epsilon_02 <epsilon_02@noreply.codeberg.org>
Co-authored-by: Calciumdibromid Bot <cabr2_bot@noreply.codeberg.org>
Co-committed-by: Calciumdibromid Bot <cabr2_bot@noreply.codeberg.org>
lorenzocorallo added a commit to lorenzocorallo/TheTOLProject that referenced this pull request Apr 25, 2023
- add parentheses for `TypeofTypeAnnotation`
  ([#14458](prettier/prettier#14458),
  [#14042](prettier/prettier#14042))
lorenzocorallo added a commit to lorenzocorallo/TheTOLProject that referenced this pull request Apr 25, 2023
EndBug added a commit to PoliNetworkOrg/TheTOLProject that referenced this pull request Apr 28, 2023
* chore(deps): bump axios from 0.24.0 to 1.3.6

* chore(deps): bump eslint from 7.32.0 to 8.39.0

- eslint from 7.32.0 to 8.39.0
- @typescript-eslint/eslint-plugin from 4.33.0 to 5.59.1
- @typescript-eslint/parser from 4.33.0 to 5.59.1
- eslint-plugin-parser from 4.0.0 to 4.2.1
- eslint-config-parser from 8.3.0 to 8.8.1
- correct assignment of license attributes in <meta>

* chore(deps): bump i18next and react-i18next

- i18next from 22.4.13 to 22.4.15
- react-i18next from 12.2.0 to 12.2.2

* chore(deps): bump ts-node from 10.3.0 to 10.9.1

* chore(deps): bump ts-prune from 0.10.1 to 0.10.3

* chore(deps): bump underscore from 1.13.1 to 1.13.6

* chore(deps): bump rimraf from 3.0.2 to 5.0.0

* chore(deps): bump @types/underscore from 1.11.3 to 1.11.4

* chore(deps): bump react-collapsible from 2.8.4 to 2.8.10

* chore(deps): bump prettier from 2.4.1 to 2.8.8

- add parentheses for `TypeofTypeAnnotation`
  (prettier/prettier#14458,
  prettier/prettier#14042)

* chore(deps): bump mkdirp from 1.0.4 to 3.0.1

* chore(deps): bump react-to-print from 2.14.0 to 2.14.12

* chore(deps): bump react-icons from 4.3.1 to 4.8.0

* chore(deps): bump gh-pages from 3.2.3 to 4.0.0

note: latest is 5.0.0, but it requires Node>=14

* chore(deps): bump typescript from 4.4.3 to 4.9.5*

* typescript v5 is not currently supported by react-scripts (see facebook/create-react-app#13080)

* chore(deps): bump google-spreadsheet from 3.1.15 to 3.3.0

* chore(deps): bump depcheck from 1.4.2 to 1.4.3

---------

Co-authored-by: Federico Grandi <fgrandi30@gmail.com>
medikoo pushed a commit to medikoo/prettier-elastic that referenced this pull request Jan 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant