Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Data path "" should have required property 'lintFilePatterns'

Linting for my angular 10 project is failing wheh running ng lint node --max_old_space_size=8192 node_modules/@angular/cli/bin/ng lint

It failed with return code 1 and says:

Schema validation failed with the following errors:
  Data path "" should have required property 'lintFilePatterns'.

It still lints the files, and prints warnings and errors to the console. But I want to integrate this to into our CI at some point.

Below is my angular.json lint configuration as well as my eslint config

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

And eslintrc.js

module.exports = {
"root": true,
"overrides": [
  {
    "files": ["*.ts"],
    "parserOptions": {
        "project": [
          "src/tsconfig.app.json",
          "src/tsconfig.spec.json",
          "e2e/tsconfig.json"
        ],
        "createDefaultProgram": true,
        "tsconfigRootDir": __dirname,
      },
    "extends": [
      "plugin:@angular-eslint/recommended",
      // This is required if you use inline templates in Components
      "plugin:@angular-eslint/template/process-inline-templates",
      'plugin:@typescript-eslint/recommended',
    ],
    "rules": {
      /**
       * Any TypeScript source code (NOT TEMPLATE) related rules you wish to use/reconfigure over and above the
       * recommended set provided by the @angular-eslint project would go here.
       */

      "@angular-eslint/directive-selector": [
        "error",
        { "type": "attribute", "prefix": "app", "style": "camelCase" }
      ],
      "@angular-eslint/component-selector": [
        "error",
        { "type": "element", "prefix": "app", "style": "kebab-case" }
      ]
    }
  },
  {
    "files": ["*.html"],
    "extends": ["plugin:@angular-eslint/template/recommended"],
    "rules": {
      /**
       * Any template/HTML related rules you wish to use/reconfigure over and above the
       * recommended set provided by the @angular-eslint project would go here.
       */
    }
  }
]

}

Appreciate any help

like image 623
Lajna Avatar asked Mar 23 '21 09:03

Lajna


People also ask

How to resolve data path “should not have additional properties (extracts)” error?

After a successful upgrade, while preparing a build, it gives the following error. Data path "should NOT have additional properties (extracts). Option 1. Just remove the "extractCss": true from your production environment, it will resolve the problem. The reason for it is extractCss is deprecated, and its value is true by default.

Should [ng] data path have additional properties (es5browsersupport)?

[ng] Data path "" should NOT have additional properties (es5BrowserSupport). [ERROR] ng has unexpectedly closed (exit code 1). Sorry, something went wrong. For anyone having this problem while updating Ionic from 3 to 4: I had to remove "es5BrowserSupport": true from angular.json

How to fix Lint target cannot be found in angular?

Cannot find "lint" target for the specified project. You should add a package that implements linting capabilities Schema validation failed with the following errors: Data path "" must have required property 'lintFilePatterns'. Both errors can be fixed with proper configuration of your angular.json.


1 Answers

Try replacing or editing the "lint" block in your angular.json file with

"lint": {
  "builder": "@angular-eslint/builder:lint",
  "options": {
    "eslintConfig": ".eslintrc.json",
    "lintFilePatterns": ["**/*.spec.ts", "**/*.ts"]
  }
}

Or wherever your eslint config file is stored.

like image 192
Tom Hall Avatar answered Sep 23 '22 20:09

Tom Hall