1.0.8 • Published 3 years ago

eslint-config-totvs-ats v1.0.8

Weekly downloads
-
License
-
Repository
-
Last release
3 years ago

ATS Lint Library

This project is meant to centralize the code style of all the Javascript/Typescript projects in the ATS system (including test projects). Those files are meant to be used with ESLint and Prettier.

How to use this library in a frontend project

Add the dependency in your project.json file in the devDependencies section:

$ npm i -D eslint-config-totvs-ats

After the dependency is installed add this configuration to your package.json

"eslintConfig": {
  "root": true,
  "extends": [
    "eslint-config-totvs-ats/ui"
  ]
},
"prettier": "eslint-config-totvs-ats/prettier"

At this section it's also possible to override the default configurations if necessary.

To configure angular follow the instructions here: https://github.com/angular-eslint/angular-eslint

In the angular.json file add json files to the lintFilePatterns:

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

How to use this library in an e2e project

Add the dependency in your project.json file in the devDependencies section:

$ npm i -D eslint-config-totvs-ats

After the dependency is installed add this configuration to your package.json

"eslintConfig": {
  "root": true,
  "extends": [
    "eslint-config-totvs-ats/e2e"
  ]
},
"prettier": "eslint-config-totvs-ats/prettier"

At this section it's also possible to override the default configurations if necessary.

How to override the location of the tsconfig.json

The UI project configuration is configured to find the tsconfig.json file in the root of the application. The e2e project configuration is configured to find the tsconfig.json file at the path: cypress/tsconfig.json. To override this configuration add this to your project.json file:

"eslintConfig": {
    "root": true,
    "extends": [
      "eslint-config-totvs-ats/e2e" //or the ui file
    ],
    "overrides": [
      {
        "files": [
          "*.ts"
        ],
        "parserOptions": {
          "project": [
            "tsconfig.json"
          ]
        }
      }
    ]
  }