Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tizmagik/eslint-plugin-prefer-class-properties
Prefer class properties instead of defining literal instance members in the consturctor()
https://github.com/tizmagik/eslint-plugin-prefer-class-properties
eslint eslint-plugin eslint-rules
Last synced: about 1 month ago
JSON representation
Prefer class properties instead of defining literal instance members in the consturctor()
- Host: GitHub
- URL: https://github.com/tizmagik/eslint-plugin-prefer-class-properties
- Owner: tizmagik
- License: bsd-3-clause
- Created: 2017-03-26T23:00:31.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2021-08-11T04:04:29.000Z (over 3 years ago)
- Last Synced: 2023-03-24T04:22:47.428Z (over 1 year ago)
- Topics: eslint, eslint-plugin, eslint-rules
- Language: JavaScript
- Size: 45.9 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# eslint-plugin-prefer-class-properties
Prefer class properties instead of defining them in the constructor()
> This plugin/rule is lifted from [eslint-plugin-shopify](https://github.com/Shopify/eslint-plugin-shopify)
## Installation
You'll first need to install [ESLint](http://eslint.org):
```
$ npm i eslint --save-dev
```Next, install `eslint-plugin-prefer-class-properties`:
```
$ npm install eslint-plugin-prefer-class-properties --save-dev
```**Note:** If you installed ESLint globally (using the `-g` flag) then you must also install `eslint-plugin-prefer-class-properties` globally.
## Usage
Add `eslint-plugin-prefer-class-properties` to the plugins section of your `.eslintrc` configuration file. You can omit the `eslint-plugin-` prefix:
```json
{
"plugins": [
"prefer-class-properties"
]
}
```Then configure the rules you want to use under the rules section.
```json
{
"rules": {
"prefer-class-properties/prefer-class-properties": 2
}
}
```## Rule Documentation
See the [prefer-class-properties documentation here](./docs/rules/prefer-class-properties.md) for examples and settings.