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

refactor: Improve placement of $FlowExpectedErrors in @babel/* packages #4559

Merged

Conversation

hyperupcall
Copy link
Contributor

  • Links to documentation: N/A
  • Link to GitHub or NPM: N/A
  • Type of contribution: refactor

This improves the placement of various $FlowExpectedErrors so they actually apply. Error id's were also added

BEFORE
$ node cli/dist/cli.js run-tests @babel/'*' --numberOfFlowVersions 1
Running definition tests against latest 1 flow versions in /home/edwin/Documents/Repositories/fox-forks/flow-typed/definitions...

Fetching all Flow binaries...
Finished fetching Flow binaries.

Testing @babel/code-frame_v7.x.x/flow_v0.104.x- (flow-v0.224.0)...
Testing @babel/polyfill_v7.x.x/flow_v0.104.x- (flow-v0.224.0)...
Testing @babel/register_v7.x.x/flow_v0.104.x- (flow-v0.224.0)...
 
ERROR: @babel/polyfill_v7.x.x/flow_v0.104.x-
* @babel/polyfill_v7.x.x/flow_v0.104.x- (flow-v0.224.0): Unexpected Flow errors (0):
    
    Warning ------------------------------------------------------------------------------------ test_polyfill_v7.x.x.js:7:1
    
    Suppression is missing a code. Please update this suppression to use an error code: `$FlowFixMe[missing-export]`
    
       7| // $FlowExpectedError does not export anything
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    
    
    
    Found 1 warning
    

ERROR: @babel/register_v7.x.x/flow_v0.104.x-
* @babel/register_v7.x.x/flow_v0.104.x- (flow-v0.224.0): Unexpected Flow errors (2):
    
    Error ------------------------------------------------------------------------------------- test_register_v7.x.x.js:26:9
    
    Cannot call `require(...)` with object literal bound to `options` because in array element of property `plugins`:
    [incompatible-call]
     - Either number [1] is incompatible with string [2].
     - Or number [1] is incompatible with tuple type [3].
    
       test_register_v7.x.x.js:26:9
       26|         123
                   ^^^ [1]
    
    References:
       register_v7.x.x.js:28:40
       28|     plugins?: Array<[string, Object] | string>,
                                                  ^^^^^^ [2]
       register_v7.x.x.js:28:21
       28|     plugins?: Array<[string, Object] | string>,
                               ^^^^^^^^^^^^^^^^ [3]
    
    
    Error ------------------------------------------------------------------------------------ test_register_v7.x.x.js:31:16
    
    Cannot call `require(...)` with object literal bound to `options` because string [1] is incompatible with array type [2]
    in property `plugins`. [incompatible-call]
    
       test_register_v7.x.x.js:31:16
       31|       plugins: 'my-plugin'
                          ^^^^^^^^^^^ [1]
    
    References:
       register_v7.x.x.js:28:15
       28|     plugins?: Array<[string, Object] | string>,
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [2]
    
    
    Warning ------------------------------------------------------------------------------------ test_register_v7.x.x.js:6:5
    
    Suppression is missing a code. Please update this suppression to use an error code: `$FlowFixMe[prop-missing]`
    
       6|     // $FlowExpectedError does not accept unknown props
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    
    
    Warning ----------------------------------------------------------------------------------- test_register_v7.x.x.js:23:5
    
    Unused suppression comment.
    
       23|     // $FlowExpectedError no numbers
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    
    
    Warning ----------------------------------------------------------------------------------- test_register_v7.x.x.js:29:5
    
    Unused suppression comment.
    
       29|     // $FlowExpectedError should be array
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    
    
    
    Found 2 errors and 3 warnings
    
    Only showing the most relevant union/intersection branches.
    To see all branches, re-run Flow with --show-all-branches
AFTER
$ run-tests @babel/'*' --numberOfFlowVersions 1
Running definition tests against latest 1 flow versions in /home/edwin/Documents/Repositories/fox-forks/flow-typed/definitions...

Fetching all Flow binaries...
Finished fetching Flow binaries.

Testing @babel/code-frame_v7.x.x/flow_v0.104.x- (flow-v0.224.0)...
Testing @babel/polyfill_v7.x.x/flow_v0.104.x- (flow-v0.224.0)...
Testing @babel/register_v7.x.x/flow_v0.104.x- (flow-v0.224.0)...
 
All tests passed!

@hyperupcall hyperupcall changed the title refactor: Improve placement of $FlowExpectedErrors refactor: Improve placement of $FlowExpectedErrors in @babel/* packages Dec 18, 2023
@Brianzchen Brianzchen merged commit 87f1dca into flow-typed:master Dec 19, 2023
4 checks passed
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

2 participants