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
Lack of information about violated rule provided to postprocess function for a custom plugin processor #9683
Comments
I have a whitelist of 'undefined' function/var names and I would like to filter out errors based on it. The whitelist is very dynamic, so I cannot leverage |
@ppatotski Is this still an issue? |
This doesn't seem unique to processors. Our errors in general do not report things like that, because there are so many cases where it's not clear what is the target element that caused this error. We do report AST nodes in some of the rules, but they are normalized to line/column combination, since we assume that consumers might not have access to AST. |
Looking at OOB rules I see a lot of rules report errors in the following way (example): context.report({
node,
message: "Unexpected '{{matchedTerm}}' comment.",
data: {
matchedTerm
}
}); I wonder if there is a way to enable access to |
Thanks for your interest in improving ESLint. Unfortunately, it looks like this issue didn't get consensus from the team, so I'm closing it. We define consensus as having three 👍s from team members, as well as a team member willing to champion the proposal. This is a high bar by design -- we can't realistically accept and maintain every feature request in the long term, so we only accept feature requests which are useful enough that there is consensus among the team that they're worth adding. Since ESLint is pluggable and can load custom rules at runtime, the lack of consensus among the ESLint team doesn't need to be a blocker for you using this in your project, if you'd find it useful. It just means that you would need to implement the rule yourself, rather than using a bundled rule that is packaged with ESLint. |
Well...Thanks for your time anyway. |
I submitted PR (#9871) for consideration just in case you change your mind. |
ESLint version: Latest version
Implementation:
Custom eslint plugin processor that traverses reported error messages (
postprocess
function). Problem: Lack of information about violated ruleActual: Each message includes information about violated rule
Expect: Violated rule message includes a 'target' property in cases where it makes sense
Example: 'no-undef' rule has the following message:
Expect:
Current workaround is to regex
message
text in order to extract name of undefined function. However, it is not a reliable way since message format is not a strongly defined api.The text was updated successfully, but these errors were encountered: