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
Consider support for output of data in rules #8344
Comments
@jonathanKingston I'm not really sure what you are asking for. Could you clarify what changes you would like to see? Do you mean that you would like to get not only compiled error string, but also components that it was compiled from? |
Ping; @jonathanKingston, would you mind clarifying your request to answer @ilyavolodin's questions? |
Sorry missed this.
In the The documentation shows this example:
This would be changed to perhaps something like:
However the
Yeah exactly that, currently we have the following plugin: no-unsanitized We would like to differentiate between:
An external repository wants to check for these errors would like to explain the error in much more detail when they are thrown (this repo is for uploading of an addon to addons.mozilla.org and may not be an addon developer themselves) or also ignore certain issues. So:
May get presented on addons.mozilla.org as:
Obviously having the linting rule as verbose as that would be nasty for normal CLI usage, so we would like a way to parse the params of the error itself. Let me know if this makes sense. Thanks. |
Thanks for clarifying. Would #6740 solve this issue? It seems like you need a way to get more info about short "CLI-suitable" messages to display more verbose messages on addons.mozilla.org. If #6740 was implemented, you could look in the |
@not-an-aardvark sorry for the delay. I'm not sure this would be good enough to solve the issue cleanly. Perhaps if the optional data object was permitted only if a message id was provided? This would permit us to use shapes like:
I also don't mind if it is /cc @muffinresearch and @EnTeQuAk as you likely will deal with this more than me do you have other thoughts? The ruleHelper I worked on has the Lines not solvable by message id:
Solvable by message id:
|
Thanks for your interest in improving ESLint. Unfortunately, it looks like this issue didn't get enough support from the team and so I'm closing it. While we wish we'd be able to accommodate everyone's requests, we do need to prioritize. We've found that issues failing to reach consensus after a long time tend to never do it, and as such, we close those issues. This doesn't mean the idea isn't interesting, just that it's not something the team can commit to. |
To make rules more portable between projects it would be useful to be able to get an output of data attributes on failures.
Currently https://github.com/mozilla/addons-linter is taking rules from other projects and may have to parse them in some cases to output some human readable form of the issue.
This is an issue because some rules output multiple string messages and the nice output of these strings would be vastly different or not relevant to the addons-linter.
If the linter could look at some form of 'meta data' for each message object returned by the CLI engine the following code wouldn't have to hard code error string replacements which makes it somewhat inflexible: https://github.com/mozilla/addons-linter/blob/master/src/scanners/javascript.js#L37
Take for example my rule:
https://github.com/jonathanKingston/eslint-plugin-no-unescaped/blob/master/lib/rules/enforce.js#L146
I might output the following errors via reports:
and
and
That way an addon linter could ignore "unexpected-expression" as they are failings in the rule rather than the others. They could also choose to express the message for "unescaped-call" and "unescaped-assign".
Addon linter is obviously designed for developers to upload code to https://addons.mozilla.org/ which would like to give help on how to fix or advice why something might be banned.
The text was updated successfully, but these errors were encountered: