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 12 workspace: Failed to load config "../../.eslintrc.json" to extend from

See original GitHub issue

Description and reproduction of the issue

When creating an angular 12 workspace, @angular-eslint/schematics@12.0.0 schematics incorrectly writes eslintrc.json

❯ npx @angular/cli@12 new web-apps --create-application false --strict
❯ cd web-apps
❯ yarn ng g app command-center
❯ yarn ng add @angular-eslint/schematics
❯ yarn ng lint
Linting "command-center"...
An unhandled exception occurred: Failed to load config "../../.eslintrc.json" to extend from.
Referenced from: /Users/<username>/dev/web-apps/projects/command-center/.eslintrc.json
angular_12_eslint_error

Versions

# yarn ng version:
Angular CLI: 12.0.0
Node: 16.1.0
Package Manager: yarn 1.22.10
OS: darwin x64

Angular: 12.0.0
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1200.0
@angular-devkit/build-angular   12.0.0
@angular-devkit/core            12.0.0
@angular-devkit/schematics      12.0.0
@schematics/angular             12.0.0
rxjs                            6.6.7
typescript                      4.2.4

  • 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 2 years ago
  • Reactions:6
  • Comments:12 (3 by maintainers)

github_iconTop GitHub Comments

13reactions
prabh-62commented, Jun 9, 2021

Root .eslintrc.json

{
    "root": true,
    "ignorePatterns": ["projects/**/*"],
    "plugins": [],
    "overrides": [
      {
        "files": ["*.ts"],
        "parserOptions": {
          "project": ["tsconfig.json"],
          "createDefaultProgram": true
        },
        "extends": [
          "plugin:@typescript-eslint/recommended-requiring-type-checking",
          "plugin:@angular-eslint/all"
        ],
        "rules": {
          "@angular-eslint/sort-ngmodule-metadata-arrays": "off"
        }
      },
      {
        "files": ["*.html"],
        "extends": ["plugin:@angular-eslint/template/all"],
        "rules": {
          "@angular-eslint/template/i18n": "off"
        }
      }
    ]
  }
  

Project specific eslint: projects/dashboard/.eslintrc.json

{
  "extends": "../../.eslintrc.json",
  "ignorePatterns": ["!**/*"],
  "overrides": [
    {
      "files": ["*.ts"],
      "parserOptions": {
        "project": [
          "projects/dashboard/tsconfig.app.json",
          "projects/dashboard/tsconfig.spec.json"
        ],
        "createDefaultProgram": true
      },
      "rules": {
        "@angular-eslint/directive-selector": [
          "error",
          {
            "type": "attribute",
            "prefix": "td",
            "style": "camelCase"
          }
        ],
        "@angular-eslint/component-selector": [
          "error",
          {
            "type": "element",
            "prefix": "td",
            "style": "kebab-case"
          }
        ]
      }
    },
    {
      "files": ["*.html"],
      "rules": {}
    }
  ]
}
3reactions
JamesHenrycommented, Apr 3, 2022

Thanks a lot for covering the workarounds on this folks, I’m pleased to say that the tooling will now do the right thing in the --create-application=false case automatically as of 13.2.0

Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular Eslint config is not extending Project Eslint config
I have an angular 12.x project and it uses eslint, this is the current root configuration file: { "env": { "browser": true, "node":...
Read more >
[eslint] failed to load config "react-app" to extend from - You.com
I just have the same error: for some reason, your react-scripts package is too old (mine was 1.1.5 ). Find and change it...
Read more >
Using ESLint in Nx Workspaces
Let's take an example of an ESLint config that Nx might generate for you out of the box for a Next.js project called...
Read more >
Configuration Files - ESLint - Pluggable JavaScript Linter
The first way to use configuration files is via .eslintrc.* and package.json files. ESLint automatically looks for them in the directory of the...
Read more >
The ultimate migration guide to angular-eslint, ESLint and Nx 11
How to set up a new Nx workspace using angular-eslint or migrate an existing Nx ... The base .eslintrc.json configuration should mention the ......
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