Skip to content

Commit

Permalink
ESLint fixes and unified lint targets (#3424)
Browse files Browse the repository at this point in the history
* optimise lint targets

* fix eslint config files

* fix app coverage settings

* tune eslint to warn about optional chains
  • Loading branch information
DenysVuika committed Sep 8, 2023
1 parent 46ea854 commit 9106608
Show file tree
Hide file tree
Showing 14 changed files with 47 additions and 149 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@
"@angular-eslint/no-outputs-metadata-property": "error",
"@angular-eslint/use-lifecycle-interface": "error",
"@angular-eslint/use-pipe-transform-interface": "error",
"@typescript-eslint/prefer-optional-chain": "warn",
"@typescript-eslint/no-misused-new": "error",
"@typescript-eslint/no-non-null-assertion": "error",
"@typescript-eslint/prefer-function-type": "error",
Expand Down Expand Up @@ -328,7 +329,7 @@
"@angular-eslint/template/no-negated-async": "off",
"@angular-eslint/template/no-positive-tabindex": "error",
"@angular-eslint/template/eqeqeq": "error",
"@angular-eslint/template/no-call-expression": "warn"
"@angular-eslint/template/no-call-expression": "off"
}
},
{
Expand Down
6 changes: 5 additions & 1 deletion app/karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html
const { join } = require('path');
const getBaseKarmaConfig = require('../karma.conf');

module.exports = function (config) {
const baseConfig = getBaseKarmaConfig();
config.set({
...baseConfig,
coverageReporter: {},
coverageReporter: {
...baseConfig.coverageReporter,
dir: join(__dirname, '../coverage/content-ce')
}
});
};
14 changes: 1 addition & 13 deletions app/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -237,19 +237,7 @@
}
},
"lint": {
"executor": "@angular-eslint/builder:lint",
"options": {
"lintFilePatterns": [
"app/**/*.ts",
"app/**/*.html"
],
"cache": true,
"cacheLocation": ".eslintcache",
"ignorePath": ".eslintignore"
},
"outputs": [
"{options.outputFile}"
]
"executor": "@angular-eslint/builder:lint"
}
}
}
12 changes: 1 addition & 11 deletions e2e/playwright/actions/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,7 @@
}
},
"lint": {
"executor": "@angular-eslint/builder:lint",
"options": {
"lintFilePatterns": [
"e2e/**/*.ts",
"e2e/**/*.html"
],
"cache": true,
"cacheLocation": ".eslintcache",
"ignorePath": ".eslintignore"
},
"outputs": ["{options.outputFile}"]
"executor": "@angular-eslint/builder:lint"
}
}
}
12 changes: 1 addition & 11 deletions e2e/playwright/authentication/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,7 @@
}
},
"lint": {
"executor": "@angular-eslint/builder:lint",
"options": {
"lintFilePatterns": [
"e2e/**/*.ts",
"e2e/**/*.html"
],
"cache": true,
"cacheLocation": ".eslintcache",
"ignorePath": ".eslintignore"
},
"outputs": ["{options.outputFile}"]
"executor": "@angular-eslint/builder:lint"
}
}
}
12 changes: 1 addition & 11 deletions e2e/playwright/folder-rules/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,7 @@
}
},
"lint": {
"executor": "@angular-eslint/builder:lint",
"options": {
"lintFilePatterns": [
"e2e/**/*.ts",
"e2e/**/*.html"
],
"cache": true,
"cacheLocation": ".eslintcache",
"ignorePath": ".eslintignore"
},
"outputs": ["{options.outputFile}"]
"executor": "@angular-eslint/builder:lint"
}
}
}
12 changes: 1 addition & 11 deletions e2e/playwright/navigation/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,7 @@
}
},
"lint": {
"executor": "@angular-eslint/builder:lint",
"options": {
"lintFilePatterns": [
"e2e/**/*.ts",
"e2e/**/*.html"
],
"cache": true,
"cacheLocation": ".eslintcache",
"ignorePath": ".eslintignore"
},
"outputs": ["{options.outputFile}"]
"executor": "@angular-eslint/builder:lint"
}
}
}
12 changes: 1 addition & 11 deletions e2e/playwright/viewer/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,7 @@
}
},
"lint": {
"executor": "@angular-eslint/builder:lint",
"options": {
"lintFilePatterns": [
"e2e/**/*.ts",
"e2e/**/*.html"
],
"cache": true,
"cacheLocation": ".eslintcache",
"ignorePath": ".eslintignore"
},
"outputs": ["{options.outputFile}"]
"executor": "@angular-eslint/builder:lint"
}
}
}
14 changes: 1 addition & 13 deletions e2e/protractor/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,7 @@
}
},
"lint": {
"executor": "@angular-eslint/builder:lint",
"options": {
"lintFilePatterns": [
"e2e/**/*.ts",
"e2e/**/*.html"
],
"cache": true,
"cacheLocation": ".eslintcache",
"ignorePath": ".eslintignore"
},
"outputs": [
"{options.outputFile}"
]
"executor": "@angular-eslint/builder:lint"
}
}
}
15 changes: 11 additions & 4 deletions nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,17 @@
]
},
"lint": {
"inputs": [
"default",
"{workspaceRoot}/.eslintrc.json"
]
"executor": "@angular-eslint/builder:lint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": [
"{projectRoot}/**/*.ts",
"{projectRoot}/**/*.html"
],
"cache": true,
"cacheLocation": ".eslintcache",
"ignorePath": ".eslintignore"
}
},
"e2e": {
"inputs": [
Expand Down
28 changes: 10 additions & 18 deletions projects/aca-content/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,15 @@
path = require("path");
const path = require('path');
module.exports = {
"extends": "../../.eslintrc.json",
"ignorePatterns": [
"!**/*"
],
"overrides": [
extends: '../../.eslintrc.json',
ignorePatterns: ['!**/*'],
overrides: [
{
"files": [
"*.ts"
],
"parserOptions": {
"project": [
path.join(__dirname, "tsconfig.lib.json"),
path.join(__dirname, "tsconfig.spec.json")
],
"createDefaultProgram": true
files: ['*.ts'],
parserOptions: {
project: [path.join(__dirname, 'tsconfig.lib.json'), path.join(__dirname, 'tsconfig.spec.json')],
createDefaultProgram: true
},
"rules": {
}
rules: {}
}
]
}
};
14 changes: 1 addition & 13 deletions projects/aca-content/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,7 @@
}
},
"lint": {
"executor": "@angular-eslint/builder:lint",
"options": {
"lintFilePatterns": [
"projects/aca-content/**/*.ts",
"projects/aca-content/**/*.html"
],
"cache": true,
"cacheLocation": ".eslintcache",
"ignorePath": ".eslintignore"
},
"outputs": [
"{options.outputFile}"
]
"executor": "@angular-eslint/builder:lint"
}
}
}
28 changes: 10 additions & 18 deletions projects/aca-shared/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,15 @@
path = require("path");
const path = require('path');
module.exports = {
"extends": "../../.eslintrc.json",
"ignorePatterns": [
"!**/*"
],
"overrides": [
extends: '../../.eslintrc.json',
ignorePatterns: ['!**/*'],
overrides: [
{
"files": [
"*.ts"
],
"parserOptions": {
"project": [
path.join(__dirname, "tsconfig.lib.json"),
path.join(__dirname, "tsconfig.spec.json")
],
"createDefaultProgram": true
files: ['*.ts'],
parserOptions: {
project: [path.join(__dirname, 'tsconfig.lib.json'), path.join(__dirname, 'tsconfig.spec.json')],
createDefaultProgram: true
},
"rules": {
}
rules: {}
}
]
}
};
14 changes: 1 addition & 13 deletions projects/aca-shared/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,7 @@
}
},
"lint": {
"executor": "@angular-eslint/builder:lint",
"options": {
"lintFilePatterns": [
"projects/aca-shared/**/*.ts",
"projects/aca-shared/**/*.html"
],
"cache": true,
"cacheLocation": ".eslintcache",
"ignorePath": ".eslintignore"
},
"outputs": [
"{options.outputFile}"
]
"executor": "@angular-eslint/builder:lint"
}
}
}

0 comments on commit 9106608

Please sign in to comment.