-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
An array is unexpectedly regarded as a valid ESLint severity #5499
Labels
accepted
There is consensus among the team that this change meets the criteria for inclusion
archived due to age
This issue has been archived; please open a new issue for any further discussion
bug
ESLint is working incorrectly
core
Relates to ESLint's core APIs and features
Comments
ilyavolodin
added
bug
ESLint is working incorrectly
core
Relates to ESLint's core APIs and features
evaluating
The team will evaluate this issue to decide whether it meets the criteria for inclusion
and removed
triage
An ESLint team member will look at this issue soon
labels
Mar 7, 2016
Looks like an oversight to me. |
👍 for being more strict and throwing an error for this case. |
nzakas
added
accepted
There is consensus among the team that this change meets the criteria for inclusion
and removed
evaluating
The team will evaluate this issue to decide whether it meets the criteria for inclusion
labels
Mar 7, 2016
I suspect this code path isn't being run through the validator. |
I've just started to implement strict severity checking. |
shinnn
added a commit
to shinnn/is-eslint-severity
that referenced
this issue
Mar 9, 2016
Submitted a PR. #5527 |
nzakas
added a commit
that referenced
this issue
Mar 11, 2016
Fix: validate the type of severity level (fixes: #5499)
eslint-deprecated
bot
added
the
archived due to age
This issue has been archived; please open a new issue for any further discussion
label
Feb 6, 2018
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
accepted
There is consensus among the team that this change meets the criteria for inclusion
archived due to age
This issue has been archived; please open a new issue for any further discussion
bug
ESLint is working incorrectly
core
Relates to ESLint's core APIs and features
What version of ESLint are you using?
v2.3.0
What configuration and parser (Espree, Babel-ESLint, etc.) are you using?
Default parser
What did you do? Please include the actual source code causing the issue.
This is an extremely rare case, but a user may carelessly fill an ESLint severity value with an array of the string like below:
What did you expect to happen?
new CLIEngine(...)
should throw an error because['error']
is, of course, not a valid severity according to the doc.What actually happened? Please include the actual, raw output from ESLint.
new CLIEngine(...)
doesn't throw any errors, because,/^(?:off|warn|error)$/i.test(severity)
always stringify non-stringseverity
before testing.String(['error'])
returns'error'
. Unfortunately, that also matches/^(?:off|warn|error)$/i
.We should do stricter type checking for
severity
to fix this unexpected behavior. I can create a pull request for this issue.The text was updated successfully, but these errors were encountered: