eslint + babel-eslint + ArrowFunctionExpression as class method = inaccurate getJSDocComment
See original GitHub issuehttps://github.com/brokentone/eslint/tree/bug/babel-eslint-arrow-jsdoc Tell us about your environment
- ESLint Version: master
- Node Version: v8.11.3
- npm Version: 5.6.0
What parser (default, Babel-ESLint, etc.) are you using? babel-eslint
Please show your full configuration:
Configuration
{ rules: { checker: "error" }, parser: "babel-eslint", parserOptions: { ecmaVersion: 6, ecmaFeatures: { jsx: true } } }
What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.
/** Merges two objects together.*/
class A {
constructor(xs) {}
methodOne = () => {}
};
./node_modules/.bin/mocha tests/lib/util/source-code.js
What did you expect to happen?
Not to associate the comment with the arrow function with sourceCode.getJSDocComment(node);
What actually happened? Please include the actual, raw output from ESLint. Comment returned.
I have a test case built here: https://github.com/brokentone/eslint/tree/bug/babel-eslint-arrow-jsdoc
I added the babel-eslint
parser to all the other rules in the file as a second commit, and the only violation is this new case I added.
I attempted to dig through getJSDocComment
and I couldn’t quite figure out the issue. In fairness, it may very well be a babel-eslint
issue.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:5 (5 by maintainers)
Top GitHub Comments
I don’t know if the rest of the team feels the same way necessarily, but I would be open to a change to
getJSDocComment
for your use case. In my view, the intention of the rule policy is that we want users to create custom rules for experimental language features. But in this case, a core API is being hamstrung by this limitation and so writing a custom rule is more difficult than it should be for this case. So I’m hoping we can do something here.That said, the team may ultimately suggest a different solution.
Thanks for the suggestion. As of yesterday, we have decided to officially end-of-life JSDoc support in ESLint. All JSDoc features are now deprecated and we won’t be fixing bugs or making any further improvements to those features.
We are recommending that people transition over to use the
eslint-plugin-jsdoc
plugin instead of the built-in rules in ESLint.Thanks for understanding and we apologize for any inconvenience.