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

code and message is the same in JSON output #1287

Closed
potch opened this issue May 16, 2017 · 5 comments · Fixed by #1356
Closed

code and message is the same in JSON output #1287

potch opened this issue May 16, 2017 · 5 comments · Fixed by #1356

Comments

@potch
Copy link
Contributor

potch commented May 16, 2017

Describe the problem and steps to reproduce it:

Get results from programmatic usage of the linter (as an API)

What happened?

In results, the code field of warnings is the same thing as the message field. example:

{
  _type: 'warning',
  code: 'The Function constructor is eval.',
  message: 'The Function constructor is eval.',
  ...
}

What did you expect to happen?

The code field that would be something like "UNSUPPORTED_API", as listed in the messages definition:

export const UNSUPPORTED_API = {

Anything else we should know?

Nah.

@mstriemer
Copy link
Contributor

Since code is something we added and isn't supported when adding an error through eslint I think we're stuck with this for now.

@EnTeQuAk and I discussed moving to the eslint standard of using the rule name to replace code and we agreed that was the best path forward but I don't see an issue for that.

@EnTeQuAk
Copy link
Contributor

Correct, it's a bit of a tricky problem. We do have code and message and at the moment use both and for our internal messages code is set properly but for messages coming from eslint it's set to message which isn't a problem at the moment since more or less code was unused.

We do have the ability to overwrite code for messages coming from eslint, we should probably do and require that. I do agree that having a code is useful longerm since it allows ignoring or filtering messages on the receiving client (AMO, web-ext etc).

@potch
Copy link
Contributor Author

potch commented May 18, 2017

I'm looking to filter for specific codes to filter under programmatic usage. Can I pass a flag that's like "this isn't eslint, give me generalized codes"?

EnTeQuAk added a commit that referenced this issue Jun 19, 2017
* Overwrite 'code' on overwritten 3rd party messages too.

Fixes #1355
Fixes #1287

* Small improvement to code overwrite

* Implement test that checks for code not to be null, ever.
@EnTeQuAk
Copy link
Contributor

I marked this as fixed with merging #1356. We are now able to overwrite the code for a 3rd party rule as well, we are currently overwriting all 3rd party rules so as far as I can tell this issue should be fixed now.

Mind testing if this helps with what you wanted to do @potch?

@vcarciu
Copy link

vcarciu commented Jun 20, 2017

Please add some STRs to this bug or mark it as "qa: not needed"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants