eslint-plugin-variables
v1.0.3
Published
ESLint micro plugin with rules for more strictly variables usage.
Downloads
146
Maintainers
Readme
eslint-plugin-variables
ESLint micro plugin with rules for more strictly variables usage.
Installation
npm i -D eslint-plugin-variables
Usage
Add into your .eslintrc
:
{
"plugins": [
"variables"
],
"rules": {
"variables/only-ascii-variables": "error"
}
}
Rules list
Currently following rules are supported:
variables/only-ascii-variables
: Forbid unicode variable names.variables/snakecase
: [WIP] Force to use snake_case in your code. Options:allowCapitalized
,camelcasedClasses
.- Use
allowCapitalized
if your code contains capitalized constants, e.g.MY_IMPORTANT_CONSTANT = {...}
- Use
camelcasedClasses
to allow class names in camel case (hi, PEP8). Currently works only with ES5class
statement.
- Use
Troubleshooting
You can get error "Parsing error: The keyword is reserved"
if you use modern JavaScript features in your project, such as let and const.
To solve this, add to your .eslintrc
:
"parserOptions": {
"ecmaVersion": 2015
}
Contributing
This package contains only rules related to the variables usage and naming in JavaScript. Feel free to open issues and pull requests and suggest rules
Tests running
Just run
npm test