'eslint in vscode doesn't like existing filenames of my yaml files

I have 2 yaml files for Github actions, frontend-build.yaml and backend-build.yaml. After switching from tslint to eslint, The Microsoft eslint extension in vscode has squiggly red lines under all the property names: "name;" "on:", "jobs:", etc. The error msg is "Unexpected property name".

name: Build frontend

on:
  push:
    paths:
      ["src/WebUI/WebApp/clientapp/**", ".github/workflows/frontend-build.yaml"]
  pull_request:
    paths:
      ["src/WebUI/WebApp/clientapp/**", ".github/workflows/frontend-build.yaml"]

jobs:
  build:
... etc ...

I created a new file "newfrontend.yaml" and copied the contents of "frontend-build.yaml", piece by piece. No errors appeared, even when newfrontend.yaml had the identical contents as frontend-build.yaml.

Then I just renamed frontend-build.yaml to frontend-buildX.yaml and all it's errors went away! I renamed newfrontend.yaml to frontend-build.yaml and eslint put back all the red squiggly lines that were in the original frontend-build.yaml!

The same thing happens with "backend-build.yaml.

Does anyone know what's going on and how to fix it?

EDIT: For now, I decided to change the names of the files to frontend-build.yml and backend-build.yml. The docs say the extension can be either .yaml or .yml. This gets rid of the errors, but I don't know if they will come back.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source