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

Upgrade prettier #26081

Merged
merged 5 commits into from
Jan 31, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions scripts/error-codes/invertObject.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,16 @@
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
'use strict';

import type {ErrorMap} from './Types';
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This used a "type comment" before of the form:

/*::
[flow only code here]
*/

The flow prettier parser parses this as a pure AST w/o the comment and then when it's printed the comment is removed. Most of the scripts don't use types, I think we don't loose much by removing this here.

/**
* turns
* { 'MUCH ERROR': '0', 'SUCH WRONG': '1' }
* into
* { 0: 'MUCH ERROR', 1: 'SUCH WRONG' }
*/
function invertObject(targetObj /*: ErrorMap */) /*: ErrorMap */ {
function invertObject(targetObj) {
const result /*: {[string]: string} */ = {};
const mapKeys = Object.keys(targetObj);

Expand Down