enforces semicolon after clas properties
$ npm install eslint-plugin-class-property
Please use babel-plugin-eslint with the babel/semi rule!
You'll first need to install ESLint:
$ npm i eslint --save-dev
Next, install eslint-plugin-class-property
:
$ npm install eslint-plugin-class-property --save-dev
Note: If you installed ESLint globally (using the -g
flag) then you must also install eslint-plugin-class-property
globally.
Add class-property
to the plugins section of your .eslintrc
configuration file. You can omit the eslint-plugin-
prefix:
{
"plugins": [
"class-property"
]
}
This rule enforces consistent use of semicolons for class properties.
This rule has a single string optio:
"always"
(default) requires semicolons at the end of a class property"never"
disallows semicolons as the end of a class propertyExamples of incorrect code for this rule with the default "always"
option:
/*eslint class-property/class-property-semicolon: ["error", "always"]*/
class MyClass {
classProperty = 'foo'
}
Examples of correct code for this rule with the default "always"
option:
/*eslint class-property/class-property-semicolon: ["error", "always"]*/
class MyClass {
classProperty = 'foo';
}
Examples of incorrect code for this rule with the "never"
option:
/*eslint class-property/class-property-semicolon: ["error", "never"]*/
class MyClass {
classProperty = 'foo';
}
Examples of correct code for this rule with the "never"
option:
/*eslint class-property/class-property-semicolon: ["error", "never"]*/
class MyClass {
classProperty = 'foo'
}
© 2010 - cnpmjs.org x YWFE | Home | YWFE