Fails with eslint 8.40.0: TypeError: Cannot read properties of undefined (reading 'getAllComments')
andersk opened this issue · 6 comments
Upgrading eslint from 8.39.0 to 8.40.0 (released an hour ago) causes xo to fail with this error.
❯ pnpm test
> xo@0.54.2 test /home/anders/js/xo
> node cli.js && nyc ava
TypeError: Cannot read properties of undefined (reading 'getAllComments')
Occurred while linting /home/anders/js/xo/cli.js:3
Rule: "unicorn/expiring-todo-comments"
at Object.Program (/home/anders/js/xo/node_modules/.pnpm/eslint@8.40.0/node_modules/eslint/lib/rules/no-warning-comments.js:193:45)
at Program (/home/anders/js/xo/node_modules/.pnpm/eslint-plugin-unicorn@46.0.0_eslint@8.40.0/node_modules/eslint-plugin-unicorn/rules/expiring-todo-comments.js:514:10)
at /home/anders/js/xo/node_modules/.pnpm/eslint-plugin-unicorn@46.0.0_eslint@8.40.0/node_modules/eslint-plugin-unicorn/rules/utils/rule.js:39:18
at ruleErrorHandler (/home/anders/js/xo/node_modules/.pnpm/eslint@8.40.0/node_modules/eslint/lib/linter/linter.js:1049:28)
at /home/anders/js/xo/node_modules/.pnpm/eslint@8.40.0/node_modules/eslint/lib/linter/safe-emitter.js:45:58
at Array.forEach (<anonymous>)
at Object.emit (/home/anders/js/xo/node_modules/.pnpm/eslint@8.40.0/node_modules/eslint/lib/linter/safe-emitter.js:45:38)
at NodeEventGenerator.applySelector (/home/anders/js/xo/node_modules/.pnpm/eslint@8.40.0/node_modules/eslint/lib/linter/node-event-generator.js:297:26)
at NodeEventGenerator.applySelectors (/home/anders/js/xo/node_modules/.pnpm/eslint@8.40.0/node_modules/eslint/lib/linter/node-event-generator.js:326:22)
at NodeEventGenerator.enterNode (/home/anders/js/xo/node_modules/.pnpm/eslint@8.40.0/node_modules/eslint/lib/linter/node-event-generator.js:340:14)
ELIFECYCLE Test failed. See above for more details.
Discussing it here eslint/eslint#17167
In the meantime I downgraded to 8.39.0 again
I started experiencing this problem yesterday, downgrading xo to 0.53
didn't fix the issue
TypeError: Cannot read properties of undefined (reading 'getAllComments')
Occurred while linting C:\Users\ilarr\Documents\dev-tools\ns_npm_repository\bundler\index.ts:1
Appears the issue is actually with an older version of eslint-plugin-unicorn
.
Apparently upgrading that plugin resolves the issue re: eslint/eslint#17167 (comment).
We may be able to resolve this issue by upgrading eslint-plugin-unicorn
in xo
to 47.0.0
.
Line 79 in 4bf9631
Opened a bump PR up over here.
The issue was fixed in eslint-plugin-unicorn 46.0.1 (not 47): https://github.com/sindresorhus/eslint-plugin-unicorn/releases/tag/v46.0.1
The issue was fixed in eslint-plugin-unicorn 46.0.1 (not 47): https://github.com/sindresorhus/eslint-plugin-unicorn/releases/tag/v46.0.1
Alright, let's do a bump to 46.0.1.
Closing.
Solution
- update
xo
to at least v0.55.0 - or update
eslint-plugin-unicorn
to at least v46.0.1