https://github.com/buildo/eslint-plugin-method-names
ESLint plugin defining a single rule for checking ES6 method name conventions
https://github.com/buildo/eslint-plugin-method-names
Last synced: about 2 months ago
JSON representation
ESLint plugin defining a single rule for checking ES6 method name conventions
- Host: GitHub
- URL: https://github.com/buildo/eslint-plugin-method-names
- Owner: buildo
- License: mit
- Created: 2016-09-05T17:35:40.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2016-09-05T17:55:01.000Z (almost 10 years ago)
- Last Synced: 2026-06-17T15:04:48.885Z (about 2 months ago)
- Language: JavaScript
- Size: 6.84 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# eslint-plugin-method-names
[](https://drone.our.buildo.io/buildo/eslint-plugin-method-names)
[](https://www.npmjs.com/package/eslint-plugin-method-names)
## Installation
```sh
npm install --save-dev eslint-plugin-method-names
```
## Usage
In your `.eslintrc`:
```javascript
{
"plugins": [
"method-names"
],
"rules": {
"method-names/method-names": [2, { regex: '^[a-z].*' }]
}
}
```
## Rule
Restrict class method names to a regex. It applies to methods and static properties defining a function.
## Usage
With the configuration above, the following patterns are considered valid
```js
class Foo {
bar() {}
}
class Foo {
bar = () => {}
}
class Foo {
_bar = 40 + 2
}
```
whereas the following are considered errors
```js
class Foo {
_bar() {}
}
class Foo {
_bar = () => {}
}
```
## Why
This is useful for enforcing conventions like "methods should never start with an underscore".