ESLint rules for Protractor
-
Install
eslint-plugin-protractor
as a dev-dependency:npm install --save-dev eslint-plugin-protractor
-
Enable the plugin by adding it to your
.eslintrc
:plugins: - protractor
This plugin ships with a default configuration for each rule:
Rule | Default | Options |
---|---|---|
missing-perform | 2 | |
no-browser-pause | 2 | |
missing-wait-message | 1 | |
no-browser-sleep | 1 | |
no-by-xpath | 1 | |
no-describe-selectors | 1 | |
no-angular-classes | 1 | |
use-angular-locators | 1 | |
use-simple-repeaters | 1 | |
by-css-shortcut | 0 |
For example, the missing-perform
rule is enabled by default and will cause
ESLint to throw an error (with an exit code of 1
) when triggered.
You may customise each rule by adding a value in your .eslintrc
rules
property:
plugins:
- protractor
rules:
protractor/missing-perform: 0
See configuring rules for more information.
This plugin export a recommended
configuration that enforce good practices.
To enable this configuration use the extends
property in your .eslintrc
config file:
{
"plugins": [
"protractor"
],
"extends": "plugin:protractor/recommended"
}
See ESLint documentation for more information about extending configuration files.
© 2016 Alexander Afanasyev
Licensed under the MIT license.