avajs / eslint-plugin-ava

ESLint rules for AVA
https://avajs.dev
MIT License
230 stars 49 forks source link

Add failing test for `prefer-t-regex` #334

Closed fregante closed 3 years ago

fregante commented 3 years ago

As mentioned in https://github.com/avajs/eslint-plugin-ava/issues/317#issuecomment-922262370

https://github.com/fregante/chrome-webstore-upload-cli/blob/ab45edaf6b1681c9ce50caf65acfa89ed6f66714/test/cli.js#L27

TypeError: Cannot read property 'type' of undefined
Occurred while linting ./test/cli.js:22
    at booleanHandler (./node_modules/eslint-plugin-ava/rules/prefer-t-regex.js:94:35)
    at ./node_modules/eslint-plugin-ava/rules/prefer-t-regex.js:192:5
    at ./node_modules/enhance-visitors/index.js:25:12
    at ./node_modules/enhance-visitors/index.js:15:7
    at ./node_modules/eslint/lib/linter/safe-emitter.js:45:58
    at Array.forEach (<anonymous>)
    at Object.emit (./node_modules/eslint/lib/linter/safe-emitter.js:45:38)
    at NodeEventGenerator.applySelector (./node_modules/eslint/lib/linter/node-event-generator.js:293:26)
    at NodeEventGenerator.applySelectors (./node_modules/eslint/lib/linter/node-event-generator.js:322:22)
    at NodeEventGenerator.enterNode (./node_modules/eslint/lib/linter/node-event-generator.js:336:14)

I had seen this error before but it wasn't clear what the issue was since the line does not match the error (and there's no "type" in the user code)

sindresorhus commented 3 years ago

The test is not failing though.

fregante commented 3 years ago

The tests must be broken!!1!1

Closing because I don't know how to reproduce in the tests, but you can test it on the real code I linked to

sindresorhus commented 3 years ago

I think it's still a useful fixture though, even if it doesn't achieve what you want it to.