Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kubk/eslint-plugin-mobx-computed-getters
ESLint plugin that ensures MobX's computed methods are always getters.
https://github.com/kubk/eslint-plugin-mobx-computed-getters
eslint eslint-plugin mobx
Last synced: 25 days ago
JSON representation
ESLint plugin that ensures MobX's computed methods are always getters.
- Host: GitHub
- URL: https://github.com/kubk/eslint-plugin-mobx-computed-getters
- Owner: kubk
- Created: 2019-11-09T06:57:53.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2019-12-11T11:35:33.000Z (almost 5 years ago)
- Last Synced: 2024-10-04T09:19:10.247Z (about 1 month ago)
- Topics: eslint, eslint-plugin, mobx
- Language: JavaScript
- Size: 3.91 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# eslint-plugin-mobx-computed-getters [![Build Status](https://travis-ci.org/kubk/eslint-plugin-mobx-computed-getters.svg?branch=master)](https://travis-ci.org/kubk/eslint-plugin-mobx-computed-getters) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
ESLint plugin that ensures MobX's computed methods are always getters.
```js
class UserStore {
@observable firstName = '';
@observable lastName = '';
// ESLint error: Computed methods should always be getters. Did you miss 'get' keyword?
@computed fullName() {
return `${this.firstName} ${this.lastName}`;
}
}
```### Installation
1) `npm i eslint-plugin-mobx-computed-getters`
2) Then in your `.eslintrc.json` file add the following line:
```json
"plugins": ["mobx-computed-getters"]
```
Now you can add the rule like so:
```json
{
"rules": {
"mobx-computed-getters/computed-getters": "error",
}
}
```### Usage with Create React App:
1) Add `EXTEND_ESLINT=true` to your `.env` file
2) Extend your `.eslintrc.json` file from `react-app` config:
```json
{
"extends": ["react-app"],
"plugins": ["mobx-computed-getters"],
"rules": {
"getter-return": "error",
"mobx-computed-getters/computed-getters": "error"
}
}
```