Skip to content

Raynos/eslint-plugin-jsdoc-typescript

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

eslint-plugin-jsdoc-typescript

This plugin adds new jsdoc rules specifically for using typescript with checkJs & jsdoc comments.

Rule: require-class-field

This enforces that your classes have class field declaration. This syntax only works in node 12 & later.

Rule: require-constructor-property

This rule enforces that all properties assigned to this in the constructor of a class have a jsdoc @type annotation.

e.g.

class Test {
  constructor () {
    /** @type {number} */
    this.a = 1
    /** @type {string} */
    this.b = 2
    /** @type {boolean} */
    this.c = 3
  }
}

This is useful for the same reason being explicit with your function return types is useful. You don't want to rely too much on type inference as it.

Being explicit makes refactoring and changes easier to review as you know what it was before and what it will be.

About

This plugin adds new jsdoc rules specifically for using typescript with checkJs & jsdoc comments.

Resources

Stars

Watchers

Forks

Packages

No packages published