require-jsdoc false positive on first property after static field within class
See original GitHub issueTell us about your environment
- ESLint Version: 3.14.0
- Node Version: 6.10,3
- npm Version: 3.10.5
What parser (default, Babel-ESLint, etc.) are you using? babel-eslint running from Visual Studio Code
Please show your full configuration:
Configuration
{
"parser": "babel-eslint",
"extends": [
"airbnb"
],
"plugins": [
"no-unused-vars-rest"
],
"env": {
"browser": true,
"jest": true
},
"globals": {
"__DEV__": true,
"__PROD__": true,
"__DEBUG__": true,
"__COVERAGE__": true,
"__BASENAME__": true
},
"settings": {
"import/resolver": {
"webpack": {
"config": "webpack.config.js"
}
}
},
"rules": {
"arrow-body-style": 0,
"arrow-parens": 0,
"comma-dangle": 0,
"global-require": 0,
"import/no-dynamic-require": 0,
"import/no-extraneous-dependencies": 0,
"import/prefer-default-export": 0,
"import/no-named-as-default": 0,
"indent": ["error", 2],
"linebreak-style": 0,
"max-len": 0,
"no-shadow": 0,
"no-unused-expressions": 0,
"no-confusing-arrow": 0,
"no-console": [2, { "allow": ["warn", "error"] }],
"no-unused-vars": 0,
"no-unused-vars-rest/no-unused-vars": [2, {"ignoreDestructuredVarsWithRest": true}],
"react/require-default-props": 0,
"react/forbid-prop-types": 0,
"react/prop-types": 1,
"react/jsx-filename-extension": [2, {"extensions": [".js", ".jsx"]}],
"react/jsx-curly-spacing": [1, "always"],
"require-jsdoc": [2, {
"require": {
"FunctionDeclaration": true,
"MethodDefinition": true,
"ClassDeclaration": true,
"ArrowFunctionExpression": true
}
}],
"semi": [2, "always"],
"space-infix-ops": 0,
"space-before-blocks": 0
}
}
What did you do? Please include the actual source code causing the issue.
/**
* Employee component
*/
export class Employee extends React.Component {
/** @type {Object} component prop types */
static propTypes = {
match: PropTypes.object.isRequired,
title: PropTypes.string.isRequired,
children: PropTypes.any.isRequired
}
/**
* Construct component
* @param {*} props - component properties
*/
constructor(props){
super(props);
this.name = null;
}
/**
* Pre-render
*/
componentWillMount(){
this.name = this.fetchName();
}
}
What did you expect to happen? No Errors regarding require-jsdoc
What actually happened? Please include the actual, raw output from ESLint. “Missing JSDoc comment”
Code is currently being marked in error due to (what the parser thinks) missing jsdoc block above my constructor(){}
. The jsdoc block is there but the code is being marked with what I believe to be a false positive. If I remove the static propTypes = {}
then the false positive goes away but triggers another one of my eslint rules. The two should be exclusive, so I am not sure what is going on.
Thanks for your hard work and your help.
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (3 by maintainers)
Top GitHub Comments
@designbystephen Thanks for the issue. It looks like this might be a babel-eslint issue. Can you open up an issue there? They need to make sure they’re including the comment (with correct location data) when parsing your code. If they can confirm that the comment and location data are all correct, then we can take a look at our JSDoc comment detection logic.
P.S. Hope it’s okay that I edited the issue title to reflect what you have said in your most recent post.
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.