prettier / prettier/eslint-plugin-prettier

v3.7.x throws error "Missing visitor keys for 'undefined'"

Open
#771 6 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
3.7k
Forks
212
PR merge metrics
No merged PRs in 30d

Description

After upgrading from Prettier 3.6.2 to 3.7.4 I get the following error when I run my linter

Error when running ESLint: Missing visitor keys for 'undefined'.
Occurred while linting C:\Users\xxxx\Repositories\xxx\src\app\components\bar-select\bar-select.component.html:1
Rule: "prettier/prettier"

Here is the contents of that file, which uses Angular

@if (isSearching) {
  <div class="flex items-center justify-center">
    <mat-spinner />
  </div>
} @else {
  <div class="group m-4 flex flex-col justify-center gap-2" [ngClass]="innerClass">
    @for (item of items; track $index) {
      <button type="button" mat-flat-button class="!block !h-auto min-h-12 !bg-white text-left" (click)="select(item)">
        <div class="flex py-1">
          <div class="mr-auto">
            <div class="text-base" [innerHTML]="item.display | highlight: highlightString"></div>
            @if (item.displaySecondary) {
              <div class="text-sm text-gray-500" [innerHTML]="item.displaySecondary | highlight: highlightString"></div>
            }
          </div>
          @if (item.displayRight) {
            <div class="ml-2 content-center">
              <span class="border border-black px-4 py-1 text-base group-hover:bg-white">{{ item.displayRight }}</span>
            </div>
          }
        </div>
      </button>
    } @empty {
      <span class="text-center">{{ nullMessage }}</span>
    }
  </div>
}

Here is the contents of my .prettierrc file

{
  "plugins": ["prettier-plugin-tailwindcss"],
  "endOfLine": "auto",
  "overrides": [
    { "files": "*.html", "options": { "parser": "html" } },
    { "files": "*.component.html", "options": { "parser": "angular" } }
  ]
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the ESLint failure on the supplied Angular template using Prettier 3.6.2 and 3.7.4, the prettier-plugin-tailwindcss plugin, and the shown .prettierrc overrides. Start by tracing the prettier/prettier integration around Angular parsing; done means the linter processes this template without the "Missing visitor keys for 'undefined'" error.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, javascript
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.