1.0.0 ⢠Published 2 years ago
@landmineaknpm/autem-culpa-molestiae v1.0.0
@landmineaknpm/autem-culpa-molestiae
An eslint plugin to enforce method or function name conforms to conventions.
Installation
You'll first need to install ESLint:
npm i eslint --save-devNext, install @landmineaknpm/autem-culpa-molestiae:
npm install @landmineaknpm/autem-culpa-molestiae --save-devUsage
Add function-name to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:
{
"plugins": [
"function-name"
],
"rules": {
"function-name/starts-with-verb": "error"
}
}Supported Rules
function-name/starts-with-verb
Function is always do something, so it should start with a verb and to avoid confusion with variables.
š Examples of incorrect code for this rule:
// "@ali/paytm/function-name-starts-with-verb": ["error"]
function cat(fish) {}
function dog(distance) {}š Examples of correct code for this rule:
// "@ali/paytm/function-name-starts-with-verb": ["error"]
function feedCat(fish) {}
function walkDog(distance) {}options
interface IOptions {
whitelist: string[];
blacklist: string[];
}.eslintrc.js
{
"rules": {
"function-name/starts-with-verb": ["error", {
"whitelist": ["success"],
"blacklist": ["init"]
}]
}
}š Examples of incorrect code for this rule:
// ..."blacklist": ["init"]...
const foo = {
init() {},
}š Examples of correct code for this rule:
// ..."whitelist": ["success"]...
const foo = {
success() {},
}Develop
npm
yarn ā bun
1.0.0
2 years ago