eslint/eslint

Bug: Cannot read properties of undefined (reading 'getAllComments')

dahiro opened this issue · 6 comments

dahiro commented

Environment

Node version: v18.12.1
npm version: 8.19.2
Local ESLint version: 8.40.0
Global ESLint version: -
Operating System: macOS 13.3.1 (a) (22E772610a)

What parser are you using?

Default (Espree)

What did you do?

Configuration
const defaults = require("@internal/tools/eslint-strict.config.cjs");

module.exports = {
    ...defaults,
    extends: [...defaults.extends, "plugin:@next/next/recommended", "next/core-web-vitals", "next"],
    rules: {
        ...defaults.rules,
        "import/no-default-export": "off",
        "import/no-extraneous-dependencies": "off",
        // TODO: Missing return type on function - for exported functions
        "@typescript-eslint/explicit-module-boundary-types": "off",
    },
};
some ts files

What did you expect to happen?

no error

What actually happened?

> projectxy@1.4.0 lint:next
> next lint

info  - Loaded env from /Users/me/src/projects/projectxy/.env.local
Cannot read properties of undefined (reading 'getAllComments')
Occurred while linting /Users/me/src/projects/projectxy/src/middleware.ts:1
Rule: "unicorn/expiring-todo-comments"
ERROR: "lint:next" exited with 1.

Link to Minimal Reproducible Example

https://stackblitz.com/edit/nextjs-v3bpaa?file=package.json

Participation

  • I am willing to submit a pull request for this issue.

Additional comments

No response

Hi @dahiro, thanks for the issue!

Can you please provide a repro repo? I believe this is a problem in eslint-plugin-unicorn.

dahiro commented

Hi @dahiro, thanks for the issue!

Can you please provide a repro repo? I believe this is a problem in eslint-plugin-unicorn.

https://stackblitz.com/edit/nextjs-v3bpaa?file=package.json

You were right, updating eslint-plugin-unicorn to the latest version fixed the issue as well. Thanks for pointing me in the right direction

It looks like there wasn't enough information for us to know how to help you, so we're closing the issue.

Thanks for your understanding.

@dahiro Thanks! I needed to upgrade my eslint-plugin-unicorn too.

Never mind. I'm still having the problem.

@ryancwalsh we don't track closed issues much. If you are facing a problem with an error, please open a new discussion with a repro repo and we'll help you there. Thanks.