npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

eslint-plugin-protractor

v2.1.1

Published

ESLint rules for Protractor

Downloads

39,944

Readme

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

  1. Install eslint-plugin-protractor as a dev-dependency:

    npm install --save-dev eslint-plugin-protractor
  2. 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:

Rule | Default Error Level | Auto-fixable | Options ---- | ------- | ----- | ----- missing-perform | 2 (Error) | | no-browser-pause | 2 | | correct-chaining | 2 | Yes | no-invalid-selectors | 2 | | no-array-finder-methods | 2 | | valid-locator-type | 2 | | no-compound-classes | 2 | | no-get-inner-outer-html | 2 | | no-get-raw-id | 2 | | missing-wait-message | 1 (Warning) | | no-browser-sleep | 1 | | no-by-xpath | 1 | | no-describe-selectors | 1 | | no-angular-classes | 1 | | use-angular-locators | 1 | | no-angular-attributes | 1 | | no-bootstrap-classes | 1 | | use-simple-repeaters | 1 | | no-shadowing | 1 | | use-first-last | 1 | Yes | no-get-in-it | 1 | | array-callback-return | 1 | | no-absolute-url | 1 | | no-get-location-abs-url | 1 | | no-expect-in-po | 1 | | requires plugin "settings" no-promise-in-if | 1 | | no-execute-script | 1 | | requires plugin "settings" no-repetitive-locators | 1 | | no-repetitive-selectors | 1 | | use-count-method | 1 | | valid-by-id | 1 | | valid-by-tagname | 1 | | limit-selector-depth | 1 | | number of nodes (default 5) bare-element-finders | 1 | | empty-script | 1 | | use-promise-all | 0 (Turned off) | | by-css-shortcut | 0 | | no-browser-driver | 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.

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.

Recommended configuration

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.