Skip to content

prefer-t-regex crashes ESLint #251

Closed
@ehmicky

Description

@ehmicky

example.js:

import test from 'ava'

const func = () => {}

test('example', t => {
  t.true(func())
})

.eslintrc.yml:

parserOptions:
  ecmaVersion: 2019
  sourceType: module
plugins: [eslint-plugin-ava]
rules:
  ava/prefer-t-regex: 2

package.json:

{
  "name": "eslint-plugin-ava-bug",
  "version": "0.0.1",
  "dependencies": {
    "eslint": "^5.16.0",
    "eslint-plugin-ava": "^7.0.0"
  }
}

Then:

$ eslint example.js 
TypeError: Cannot destructure property `name` of 'undefined' or 'null'.
Occurred while linting /home/ether/Desktop/eslint-plugin-ava-bug/example.js:6
    at /home/ether/Desktop/eslint-plugin-ava-bug/node_modules/eslint-plugin-ava/rules/prefer-t-regex.js:44:10
    at /home/ether/Desktop/eslint-plugin-ava-bug/node_modules/enhance-visitors/index.js:25:12
    at /home/ether/Desktop/eslint-plugin-ava-bug/node_modules/enhance-visitors/index.js:15:7
    at /home/ether/Desktop/eslint-plugin-ava-bug/node_modules/eslint/lib/util/safe-emitter.js:45:58
    at Array.forEach (<anonymous>)
    at Object.emit (/home/ether/Desktop/eslint-plugin-ava-bug/node_modules/eslint/lib/util/safe-emitter.js:45:38)
    at NodeEventGenerator.applySelector (/home/ether/Desktop/eslint-plugin-ava-bug/node_modules/eslint/lib/util/node-event-generator.js:251:26)
    at NodeEventGenerator.applySelectors (/home/ether/Desktop/eslint-plugin-ava-bug/node_modules/eslint/lib/util/node-event-generator.js:280:22)
    at NodeEventGenerator.enterNode (/home/ether/Desktop/eslint-plugin-ava-bug/node_modules/eslint/lib/util/node-event-generator.js:294:14)
    at CodePathAnalyzer.enterNode (/home/ether/Desktop/eslint-plugin-ava-bug/node_modules/eslint/lib/code-path-analysis/code-path-analyzer.js:632:23)

Node 12.3.1
Ubuntu 19.04

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions