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

Internal consistent-docs-url rule crashes if meta isn't present #10750

Closed
s4san opened this issue Aug 9, 2018 · 1 comment
Closed

Internal consistent-docs-url rule crashes if meta isn't present #10750

s4san opened this issue Aug 9, 2018 · 1 comment
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 infrastructure Relates to the tools used in the ESLint development process rule Relates to ESLint's core rules

Comments

@s4san
Copy link
Contributor

s4san commented Aug 9, 2018

Tell us about your environment

  • ESLint Version: master
  • Node Version: n/a
  • npm Version: n/a

What parser (default, Babel-ESLint, etc.) are you using?

Default

Please show your full configuration:

According to the internal ESLint config around rules:

rules:
    rulesdir/consistent-docs-url: "error"

What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.

module.exports = {
};
module.exports = {
  meta: undefined
};
npm run lint

What did you expect to happen?

Either a lint error about the lack of meta or nothing if that is covered by another rule.

What actually happened? Please include the actual, raw output from ESLint.

For configuration 1:
ESLint crashes, with an error message from context.report that the node location must be passed if the node is not passed.

For configuration 2:
ESLint throws an exception that it is trying to access property length of undefined

This happened when I was trying to fix #10722

As mentioned in this comment,

Case 1: meta property is not defined on the exports object.

This crashes eslint and curiously, the exportsNode is of type functionExpression.

Case 2: meta property is defined with a value of undefined

This creates an exception in getPropertyFromObject method where it tries to access length of undefined.

@eslint-deprecated eslint-deprecated bot added the triage An ESLint team member will look at this issue soon label Aug 9, 2018
@platinumazure platinumazure added bug ESLint is working incorrectly rule Relates to ESLint's core rules infrastructure Relates to the tools used in the ESLint development process accepted There is consensus among the team that this change meets the criteria for inclusion and removed triage An ESLint team member will look at this issue soon labels Aug 9, 2018
@s4san
Copy link
Contributor Author

s4san commented Aug 10, 2018

Case 1 is already covered by no-invalid-meta so there's nothing to do there.

Case 2 is only relevant when someone explicitly defines meta to either one of Array, Function, String or Number (undefined and null are already handled by no-invalid-meta)

I will create a PR for case 2.

s4san pushed a commit to s4san/eslint that referenced this issue Aug 10, 2018
@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Feb 15, 2019
@eslint-deprecated 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 15, 2019
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 infrastructure Relates to the tools used in the ESLint development process rule Relates to ESLint's core rules
Projects
None yet
Development

No branches or pull requests

2 participants