eslint-plugin-interfaced
ESLint plugin with essential rules for Closure Compiler environment and JSDoc.
Usage
- Install the package:
npm i eslint-plugin-interfaced --save-dev
- Specify "interfaced" as a plugin in your
.eslintrc
:
{
"plugins": [
"interfaced"
]
}
- Enable all of the rules that you would like to use in your
.eslintrc
:
{
"rules": {
"interfaced/abstract-class-name-prefix": "error"
}
}
Rules
JSDoc
- interfaced/jsdoc-tags-order - enforce the specified order for JSDoc tags
- interfaced/jsdoc-type-application-dot - enforce dot before "<" symbol in JSDoc type application
- interfaced/jsdoc-type-indent - enforce consistent indentation in JSDoc type
- interfaced/jsdoc-type-spacing - enforce consistent spacing in JSDoc type
- interfaced/no-jsdoc-type-multi-spaces - disallow multiple spaces in JSDoc type
- interfaced/no-jsdoc-type-tabs - disallow tab characters in JSDoc type
- interfaced/no-restricted-jsdoc-tags - disallow the specified JSDoc tags
- interfaced/prefer-shorthand-jsdoc-types - enforce usage of a shorthand notation for some JSDoc types
- interfaced/prevent-unused-jsdoc-types - prevent variables used in JSDoc type to be marked as unused
Naming convention
- interfaced/abstract-class-name-prefix - enforce "Abstract" prefix for abstract class name
- interfaced/capitalized-enum - enforce capitalization of the first letter of an enum
- interfaced/capitalized-typedef - enforce capitalization of the first letter of a typedef
- interfaced/caps-const - enforce caps notation for constant name and enum properties
- interfaced/event-const-desc - enforce event description ("Fired with: ...") for event constant
- interfaced/event-const-value - enforce event constant value to be a lowercase latin string with dash sign delimiter
- interfaced/interface-name-prefix - enforce "I" prefix for interface name
- interfaced/singular-enum - enforce enum name to be singular
Stylistic issues
- interfaced/lines-around-class - enforce newlines before and after class
- interfaced/lines-between-methods - enforce newlines between methods
- interfaced/lines-between-props - enforce newlines between properties
- interfaced/methods-order - enforce the specified order for methods
- interfaced/props-order - enforce the specified order for properties
- interfaced/typecast-spacing - enforce spacing in typecast (JSDoc + parenthesis)
Other
- interfaced/no-empty-method - disallow empty methods when class is neither abstract, interface nor record
- interfaced/no-public-underscore - disallow methods and properties with name that starts from "_" without private/protected access modifier
- interfaced/prevent-unused-meta-params - prevent interface, record, abstract or overriding method params to be marked as unused
Redefined
Some useful rules provided by ESLint are slightly inappropriate for our environment, so we redefine them with some adjusting: