eslint-plugin-budapestian
To make visually clear within a function body which variables are variables, and which ones
are regular constants or variables, we use a bastard variant of
Hungarian notation where we treat elements
with a scope prefix:
p
for parameters (supported by this plugin),- For global constants we use the C convention of ALL_CAPS_SNAKE_CASE (supported by this plugin).
l
for local variables (not yet supported)g
for global variables (not yet supported).
This convention makes weird re-assignment bugs immediately visible, and makes naming things
that would normally clash with regular javascript syntax a easier. E.g. you can't use
function
as a parameter - so you need creativity to come up with something - callback
is
a popular option for that. Just prefixing with a p
removes that mental stress.
Installation
You'll first need to install ESLint:
$ npm i eslint --save-dev
Next, install eslint-plugin-budapestian
:
$ npm install eslint-plugin-budapestian --save-dev
Note: If you installed ESLint globally (using the -g
flag) then you must also install eslint-plugin-budapestian
globally.
Usage
Add budapestian
to the plugins section of your .eslintrc
configuration file. You can omit the eslint-plugin-
prefix:
{
"plugins": ["budapestian"]
}
Then configure the rules you want to use under the rules section.
{
"rules": {
"budapestian/parameter-pattern": "error",
"budapestian/global-constant-pattern": "error"
}
}
Supported Rules
Flare'n status section