Skip to content

Update to use --json-version=2 #119

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

Merged
merged 1 commit into from
Feb 27, 2018
Merged

Conversation

nwoltman
Copy link
Collaborator

The new JSON format is much more consistent and has fewer oddities than the old format.

.eslintrc Outdated
"prettier"
],
"rules": {
"consistent-return": "off",
"flowtype/define-flow-type",
Copy link
Owner

Choose a reason for hiding this comment

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Whoops, must have hit backspace without realizing. Fixed now.

@amilajack amilajack merged commit 442f8f0 into amilajack:master Feb 27, 2018
@amilajack
Copy link
Owner

Published this as eslint-plugin-flowtype-errors@next again. Would like some testing before bumping the minor semver

@nwoltman nwoltman deleted the json-version-2 branch February 27, 2018 05:46
@amilajack
Copy link
Owner

amilajack commented Feb 27, 2018

Getting the following error:

messageMarkup.map is not a function
TypeError: messageMarkup.map is not a function
    at /project/node_modules/eslint-plugin-flowtype-errors/dist/collect.js:180:33
    at Array.map (<anonymous>)
    at collect (/project/node_modules/eslint-plugin-flowtype-errors/dist/collect.js:173:28)
    at Program (/project/node_modules/eslint-plugin-flowtype-errors/dist/index.js:83:46)
    at listeners.(anonymous function).forEach.listener (/project/node_modules/eslint/lib/util/safe-emitter.js:47:58)
    at Array.forEach (<anonymous>)
    at Object.emit (/project/node_modules/eslint/lib/util/safe-emitter.js:47:38)
    at NodeEventGenerator.applySelector (/project/node_modules/eslint/lib/util/node-event-generator.js:251:26)
    at NodeEventGenerator.applySelectors (/project/node_modules/eslint/lib/util/node-event-generator.js:280:22)
    at NodeEventGenerator.enterNode (/project/node_modules/eslint/lib/util/node-event-generator.js:294:14)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

@amilajack
Copy link
Owner

There are some cases where the messageMarkup is actually an object. It fails when it is equal to:

{ kind: 'UnorderedList',
  message: 
   [ { kind: 'Text', text: 'Cannot get ' },
     { kind: 'Code', text: 'exportOptions.tables' },
     { kind: 'Text', text: ' because:' } ],
  items: 
   [ [ [Object], [Object], [Object], [Object], [Object] ],
     [ [Object], [Object], [Object], [Object], [Object] ] ] }

@nwoltman
Copy link
Collaborator Author

@amilajack Could you post some code that will produce this error?

@amilajack
Copy link
Owner

amilajack commented Feb 27, 2018

// @flow
type foo = {} & ({ a: Array<string> } | { b: string });

class bar {
 foo(a: foo) {
    if ('b' in a) {
      a.foo.map(e => e(e))
    }
  }
}

@jdmota
Copy link
Collaborator

jdmota commented Feb 27, 2018

facebook/flow@28c8a3e

@nwoltman I think you just missed this

type Message = MessageInline | MessageBlock;

type MessageBlock = MessageUnorderedList;

type MessageUnorderedList = {
  kind: 'UnorderedList',
  message: MessageInline,
  items: Array<Message>,
};

That explains why the message might be an object.

@jdmota
Copy link
Collaborator

jdmota commented Feb 27, 2018

I think it's easier if you just copy the types from facebook's commit message, to our code. That way, we won't forget anything.

@nwoltman
Copy link
Collaborator Author

@jdmota Thanks for pointing out that commit! I'll get to it tomorrow.

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.

3 participants