Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no-force: Cannot read property 'name' of undefined #71

Closed
AriPerkkio opened this issue Dec 8, 2020 · 0 comments
Closed

no-force: Cannot read property 'name' of undefined #71

AriPerkkio opened this issue Dec 8, 2020 · 0 comments

Comments

@AriPerkkio
Copy link

Hello, I'm testing stability of well known community ESlint plugins with eslint-remote-tester. This ESLint plugin seems to contain a rule which causes linter to crash. ESlint rules should not crash in any condition since this makes all valid linting problems disappear. If this is a false flag please let me know.

CI run: https://github.com/AriPerkkio/eslint-remote-tester/actions/runs/404195602

Crashing rule:

no-force

Minimal repro:

const FORCE_OPTION = { force: true };
cy.get(element).click('A', { ...FORCE_OPTION })
"eslint-plugin-cypress": "^2.11.2"
  "plugins": ["cypress"],
  "extends": ["plugin:cypress/recommended"],
  "rules": {
    "cypress/no-force": "error",
    "cypress/assertion-before-screenshot": "error",
    "cypress/require-data-selectors": "error"
  }
Errors from real-world examples

Rule: no-force

Message: Cannot read property 'name' of undefined
Path: department-of-veterans-affairs/vets-website/src/platform/testing/e2e/cypress/support/form-tester/index.js
Link

    case 'tel':
    case 'email':
    case 'number':
    case 'text': {
      cy.wrap(field.element)
        .clear(FORCE_OPTION)
        .type(field.data, { ...FORCE_OPTION, ...NO_DELAY_OPTION })
        .then(element => {
          // Get the autocomplete menu out of the way.
          if (element.attr('role') === 'combobox') element.blur();
Error:
TypeError: Cannot read property 'name' of undefined
Occurred while linting <text>:304
    at /home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint-plugin-cypress/lib/rules/no-force.js:45:98
    at Array.some (<anonymous>)
    at /home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint-plugin-cypress/lib/rules/no-force.js:45:66
    at Array.some (<anonymous>)
    at hasOptionForce (/home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint-plugin-cypress/lib/rules/no-force.js:44:22)
    at deepCheck (/home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint-plugin-cypress/lib/rules/no-force.js:54:13)
    at CallExpression (/home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint-plugin-cypress/lib/rules/no-force.js:71:77)
    at /home/runner/work/eslint-remote-tester/eslint-remote-tester/node_modules/eslint/lib/linter/safe-emitter.js:45:58
    at Array.forEach (<anonymous>)
    at Object.emit (/home/runner/work/eslint-remote-tester/eslint-remote-tester/node_modules/eslint/lib/linter/safe-emitter.js:45:38)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant