question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Angular ESLint recommended config does not include TypeScript recommended rules

See original GitHub issue

Description and reproduction of the issue

I am using ESLint config file that recommended and created using Angular ESLint schematics command: ng add @angular-eslint/schematics.

My eslintrc.json file looks like:

{
  "root": true,
  "ignorePatterns": ["projects/**/*"],
  "overrides": [
    {
      "files": ["*.ts"],
      "parserOptions": {
        "project": ["tsconfig.json"],
        "createDefaultProgram": true
      },
      "extends": ["plugin:@angular-eslint/recommended"]
    }
  ]
}

Because the package @angular-eslint/eslint-plugin depends on the package @typescript-eslint/eslint-plugin I expect that Angular ESLint plugin inherits all the recommended rules from TypeScript ESLint plugin.

I mean these rules: https://github.com/typescript-eslint/typescript-eslint/blob/v5.41.0/packages/eslint-plugin/src/configs/recommended.ts

But in fact all the recommended TypeScript ESLint rules does not working.

Versions

package version
@angular-eslint/eslint-plugin 13.5.0
@typescript-eslint/parser 5.41.0
ESLint 7.32.0
node 16.14.2
# Please run `npx ng version` in your project and paste the full output here:

Angular CLI: 13.3.9
Node: 16.14.2
Package Manager: npm 8.19.2
OS: darwin x64

Angular: 13.3.11
... animations, common, compiler, compiler-cli, core, forms
... language-service, localize, platform-browser
... platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1303.9
@angular-devkit/build-angular   13.3.9
@angular-devkit/core            13.3.9
@angular-devkit/schematics      13.3.9
@angular/cli                    13.3.9
@schematics/angular             13.3.9
rxjs                            7.5.7
typescript                      4.6.4

  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest supported version of the packages and checked my ng version output per the instructions given here.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
JamesHenrycommented, Nov 20, 2022

As of v15, all new workspaces will extend from the eslint:recommended and plugin:@typescript-eslint:recommended configs

1reaction
abaran30commented, Nov 12, 2022

The recommended config contains config for ESLint core rules, as well as two different plugins: @typescript-eslint/eslint-plugin @angular-eslint/eslint-plugin

I can see how this may give the impression that the angular-eslint recommended config extends the TypeScript recommended rules.

@JamesHenry is it intended for the angular-eslint recommended config to extend the TS recommended rules? If so, an update to the config will be required. Otherwise, perhaps an update to the docs to clarify how these configurations work.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ESlint & Angular 13: Unable to turn off typescript- ...
It appears that when I ran the following command: ng add @angular-eslint/schematics. That the setup process did not complete.
Read more >
Migrating and configuring Eslint with Angular 11
In this post we will walk through migrating and configuring an Angular 11 project to utilize ESLint and as a bonus add the...
Read more >
How to use ESLint with TypeScript
ESLint is a JavaScript linter that you can use to lint either TypeScript or JavaScript code. In this post, we'll walk through how...
Read more >
Writing custom TypeScript Eslint rules with unit tests for ...
ng new custom-eslint-rules –style=scss –skip-tests=true ... You can choose your own typescript settings although I recommend you set outDir ...
Read more >
tslint-to-eslint-config/community
I followed the official documentation and noticed the recommended rules does turn off the "@typescript-eslint/semi" rule and even turning it on ("warn") it ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found