Socket
Book a DemoInstallSign in
Socket

eslint-plugin-protractor

Package Overview
Dependencies
Maintainers
1
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-protractor

ESLint rules for Protractor

2.1.1
latest
Source
npmnpm
Version published
Weekly downloads
3.8K
-17.83%
Maintainers
1
Weekly downloads
 
Created
Source

eslint-plugin-protractor

npm version npm downloads Build Status

semantic-release Commitizen friendly Join the chat at https://gitter.im/alecxe/eslint-plugin-protractor Maintenance Status

Code Climate Package Quality Coverage Status js-standard-style

ESLint rules for Protractor

This plugin would not only help catch common Protractor-specific errors early, follow the best practices for writing Protractor tests, but would also help maintaining good and reliable element locators.

The plugin would be of the most help if configured to run in your IDE of choice on the fly.

Example

This gif shows integration of ESLint with eslint-plugin-protractor into WebStorm IDE. Find out more at WebStorm ESLint configuration.

Installation

Install ESLint and this plugin either locally or globally.

$ npm install eslint --save-dev
$ npm install eslint-plugin-protractor --save-dev

Usage

  • 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
    

Rules

There are various types of rules implemented in the plugin. Here is a rough categorization.

Correct Protractor API usage and Common Errors

Locating Elements

Style Guide Recommendations and Best Practices

Here is a table with all the available rules sorted by the default error level:

RuleDefault Error LevelAuto-fixableOptions
missing-perform2 (Error)
no-browser-pause2
correct-chaining2Yes
no-invalid-selectors2
no-array-finder-methods2
valid-locator-type2
no-compound-classes2
no-get-inner-outer-html2
no-get-raw-id2
missing-wait-message1 (Warning)
no-browser-sleep1
no-by-xpath1
no-describe-selectors1
no-angular-classes1
use-angular-locators1
no-angular-attributes1
no-bootstrap-classes1
use-simple-repeaters1
no-shadowing1
use-first-last1Yes
no-get-in-it1
array-callback-return1
no-absolute-url1
no-get-location-abs-url1
no-expect-in-po1requires plugin "settings"
no-promise-in-if1
no-execute-script1requires plugin "settings"
no-repetitive-locators1
no-repetitive-selectors1
use-count-method1
valid-by-id1
valid-by-tagname1
limit-selector-depth1number of nodes (default 5)
bare-element-finders1
empty-script1
use-promise-all0 (Turned off)
by-css-shortcut0
no-browser-driver0

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.

The requires plugin "settings" note indicates that a rule needs the plugin to have configured settings in your ESLint config. For example, no-execute-script rule expects configured paths to either spec, or page object files, or both.

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.

Author

© 2016-infinity Alexander Afanasyev and contributors.

License

Licensed under the MIT license.

Keywords

eslint

FAQs

Package last updated on 18 Sep 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.