eslint-plugin-protractor

raw JSON →
2.1.1 verified Sat Apr 25 auth: no javascript maintenance

ESLint plugin providing lint rules specific to Protractor end-to-end tests for AngularJS applications. Current stable version is 2.1.1, last released in September 2019, with infrequent updates. It helps catch common Protractor errors, enforce best practices for element locators, and avoid deprecated API usage. Differentiates from general ESLint by focusing on Protractor-specific patterns, including rules for correct chaining, promise handling, and locator quality. The plugin is intended to be integrated into IDEs for real-time feedback during test development.

error Error: Failed to load plugin 'protractor' declared in '.eslintrc': Cannot find module 'eslint-plugin-protractor'
cause eslint-plugin-protractor is not installed or not in node_modules.
fix
Run npm install --save-dev eslint-plugin-protractor and ensure it is in the project's devDependencies.
error Configuration for rule 'protractor/no-promise-in-if' is invalid: Value "error" is not a recognized severity.
cause Using incorrect severity level (e.g., 'warning' instead of 'warn' or 'error').
fix
Use valid severity: 'off', 'warn', or 'error'.
error Definition for rule 'protractor/no-promise-in-if' was not found.
cause Rule name is misspelled or the plugin version does not include that rule.
fix
Check rule names in the plugin documentation and ensure correct spelling (e.g., 'no-promise-in-if').
breaking Version 2.0.0 requires ESLint >= 6.x; older ESLint versions are incompatible.
fix Upgrade ESLint to version 6 or later, or use plugin version 1.x for ESLint <6.
deprecated Rule 'no-get-inner-outer-html' warns about deprecated Protractor methods getInnerHtml() and getOuterHtml() which are removed in newer Protractor versions.
fix Use Protractor's getAttribute('innerHTML') or similar alternatives. The rule will flag usage.
gotcha Rule 'array-callback-return' may produce false positives if used with non-standard ElementArrayFinder methods that do not require return values.
fix Disable rule for specific patterns or file globs if false positives occur.
gotcha Plugin is designed for Protractor test files only; applying to non-test code may cause spurious warnings.
fix Scope ESLint configuration to test file patterns using overrides in .eslintrc.
npm install eslint-plugin-protractor
yarn add eslint-plugin-protractor
pnpm add eslint-plugin-protractor

Shows installation and basic configuration of eslint-plugin-protractor in .eslintrc to enable rules for Protractor test files.

// Install: npm install --save-dev eslint eslint-plugin-protractor
// .eslintrc.yml
plugins:
  - protractor
rules:
  protractor/no-promise-in-if: error
  protractor/missing-perform: warn
  protractor/no-array-finder-methods: error