0

I am configuring a monorepo with Angular and other tools using NX. I have managed to run the applications correctly and now I am trying to get the Linter working. This is the configuration of the eslintrc.json of Angular

{
  "extends": [
    "../../.eslintrc.json"
  ],
  "ignorePatterns": [
    "!**/*"
  ],
  "overrides": [
    // Typescript
    {
      "files": ["*.ts"],
      "parser": "@typescript-eslint/parser",
      "parserOptions": {
        "project": ["tsconfig.base.json"]
      },
      "extends": [
        "plugin:@nx/angular",
        "plugin:@angular-eslint/template/process-inline-templates",
        "../tools/linters/frontend/plugins/import"
      ]
    },

In this configuration, I make an extend of a file that I have located in another folder where there are a series of rules like these:

module.exports = {
    plugins: ["import", "unused-imports"],
    settings: {
        "import/parsers": {
            "@typescript-eslint/parser": [".ts"],
        },
        "import/resolver": {
            typescript: {
                alwaysTryTypes: true,
            },
        },
    },
    rules: {
        "unused-imports/no-unused-vars": "off",
        "unused-imports/no-unused-imports": "error",
        "import/no-unresolved": "error",

The problem is that when I launch npx nx lint myApp, I get all these errors:

 10:33  error  Unable to resolve path to module '@api/catalog/products/products.service'                                import/no-unresolved
  11:31  error  Unable to resolve path to module '@core/services/config/config.service'                                  import/no-unresolved

However, in my angular tsconfig.json, I have all the path aliases correctly configured.

{
  "compilerOptions": {
    "paths": {
      "@api/*": ["code/angular/src/app/api/*"],
      "@core/*": ["code/angular/src/app/core/*"],
      ...
    },

Could someone give me a hand?

0 Answers0