menu

Questions & Answers

eslint VSCode error on the fist line of all my TypeScript files

I have just converted my Angular project from tslint to eslint.

All seem to be working fine, except I have the following error on the start of each file

enter image description here

I added the following to my .eslint , but it made no difference.

    "valid-jsdoc": "off",
    "check-alignment": "off",

I currently have "eslint": "^7.32.0"

Aside - Version 8 was causing the following issue, so have downgraded to 7, which got rid of that one.

What is causing the error as shown here?

Update 1

I have the following eslint related packages.

"@angular-eslint/builder": "14.0.2",
"@angular-eslint/eslint-plugin": "14.0.2",
"@angular-eslint/eslint-plugin-template": "14.0.2",
"@angular-eslint/schematics": "14.0.2",
"@angular-eslint/template-parser": "14.0.2",
"@typescript-eslint/eslint-plugin": "5.29.0",
"@typescript-eslint/parser": "5.29.0",
"eslint": "^7.32.0",

I have the following lint setup in angular.json

"lint": {
      "builder": "@angular-eslint/builder:lint",
      "options": {
        "lintFilePatterns": [
          "src/**/*.ts",
          "src/**/*.html"
        ]
      }
    }

When I run ng lint I get

  1:1    error    Definition for rule 'jsdoc/check-alignment' was not found                                                      jsdoc/check-alignment

for every single file.

The only way to get rid of the errors is in .eslintrc to add:

"jsdoc/check-alignment": "off",

Even if I set:

"jsdoc/check-alignment": "warn",

it still shows as an error (not a warning).

For now, I have set it to off, but it would be good to know how to fix it (so I could then enabled it as a warning, and it would pick up real mis-alignments).

Comments:
2023-01-25 12:42:02
In order to disable a rule, you must reference the full rule name, in your case "jsdoc/check-alignment": "off",. Also since this errors come from the plugin eslint-plugin-jsdoc, which version of the plugin are you using?
2023-01-25 12:42:02
Additionally, does this error also occur when you run the linter from the command line? If not, it could be just a caching issue or plugin misconfiguration.
2023-01-25 12:42:02
@JSONDerulo - yes I get it when I run the command line. You are correct if I use jsdoc/check-alignment": "off" I can get rid of the error. I don't seem to have any eslint-plugin-jsdoc installed (perhaps it is part of another related (package)? I Have added some more info to the question under [UPDATE1]
Answers(0) :