eslint-plugin-jasmine-jquery
ESLint rules for jasmine-jquery
Installation
You'll first need to install ESLint:
$ npm install eslint --save-dev
Next, install eslint-plugin-jasmine-jquery
:
$ npm install eslint-plugin-jasmine-jquery --save-dev
Note: If you installed ESLint globally (using the -g
flag) then you must also install eslint-plugin-jasmine-jquery
globally.
Usage
Add jasmine-jquery
to the plugins section of your .eslintrc
configuration file, as well as including jasmine
and jquery
environments:
{
"plugins": [
"jasmine-jquery"
],
"env": {
"jquery": true,
"jasmine": true
}
}
Recommended configuration
Use the default settings by adding it to the extends section of your .eslintrc
:
{
"extends": [
"plugin:jasmine-jquery/recommended"
]
}
Supported Rules
/no-global-shortcuts
The recommended config enables all global shortcut functions by default. (All functions as of jasmine-jquery v2.1.1, see the complete list here.)
To disallow all jasmine-jquery's global shortcut functions, configure this rule:
{
"rules": {
"jasmine-jquery/no-global-shortcuts": 2
}
}
Options
To allow certain functions, pass in an array as the second argument containing the exceptions:
{
"rules": {
"jasmine-jquery/no-global-shortcuts": [2, ["loadFixtures", "setFixtures"]]
}
}
This will throw an error for any global shortcut method except loadFixtures()
and setFixtures()
.
Development
Install dev dependencies
npm install
Run tests
npm test
Issues, Bugs, and Suggestions
Report any issues or submit suggestions for rules on GitHub.
Special thanks to @nathpaiva for contributing to the project.