ESLint fixes and unified lint targets (#3424)

* optimise lint targets

* fix eslint config files

* fix app coverage settings

* tune eslint to warn about optional chains
This commit is contained in:
Denys Vuika 2023-09-08 09:00:00 +01:00 committed by GitHub
parent 46ea85436b
commit 9106608398
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 47 additions and 149 deletions

View File

@ -113,6 +113,7 @@
"@angular-eslint/no-outputs-metadata-property": "error", "@angular-eslint/no-outputs-metadata-property": "error",
"@angular-eslint/use-lifecycle-interface": "error", "@angular-eslint/use-lifecycle-interface": "error",
"@angular-eslint/use-pipe-transform-interface": "error", "@angular-eslint/use-pipe-transform-interface": "error",
"@typescript-eslint/prefer-optional-chain": "warn",
"@typescript-eslint/no-misused-new": "error", "@typescript-eslint/no-misused-new": "error",
"@typescript-eslint/no-non-null-assertion": "error", "@typescript-eslint/no-non-null-assertion": "error",
"@typescript-eslint/prefer-function-type": "error", "@typescript-eslint/prefer-function-type": "error",
@ -328,7 +329,7 @@
"@angular-eslint/template/no-negated-async": "off", "@angular-eslint/template/no-negated-async": "off",
"@angular-eslint/template/no-positive-tabindex": "error", "@angular-eslint/template/no-positive-tabindex": "error",
"@angular-eslint/template/eqeqeq": "error", "@angular-eslint/template/eqeqeq": "error",
"@angular-eslint/template/no-call-expression": "warn" "@angular-eslint/template/no-call-expression": "off"
} }
}, },
{ {

View File

@ -1,11 +1,15 @@
// Karma configuration file, see link for more information // Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html // https://karma-runner.github.io/1.0/config/configuration-file.html
const { join } = require('path');
const getBaseKarmaConfig = require('../karma.conf'); const getBaseKarmaConfig = require('../karma.conf');
module.exports = function (config) { module.exports = function (config) {
const baseConfig = getBaseKarmaConfig(); const baseConfig = getBaseKarmaConfig();
config.set({ config.set({
...baseConfig, ...baseConfig,
coverageReporter: {}, coverageReporter: {
...baseConfig.coverageReporter,
dir: join(__dirname, '../coverage/content-ce')
}
}); });
}; };

View File

@ -237,19 +237,7 @@
} }
}, },
"lint": { "lint": {
"executor": "@angular-eslint/builder:lint", "executor": "@angular-eslint/builder:lint"
"options": {
"lintFilePatterns": [
"app/**/*.ts",
"app/**/*.html"
],
"cache": true,
"cacheLocation": ".eslintcache",
"ignorePath": ".eslintignore"
},
"outputs": [
"{options.outputFile}"
]
} }
} }
} }

View File

@ -18,17 +18,7 @@
} }
}, },
"lint": { "lint": {
"executor": "@angular-eslint/builder:lint", "executor": "@angular-eslint/builder:lint"
"options": {
"lintFilePatterns": [
"e2e/**/*.ts",
"e2e/**/*.html"
],
"cache": true,
"cacheLocation": ".eslintcache",
"ignorePath": ".eslintignore"
},
"outputs": ["{options.outputFile}"]
} }
} }
} }

View File

@ -18,17 +18,7 @@
} }
}, },
"lint": { "lint": {
"executor": "@angular-eslint/builder:lint", "executor": "@angular-eslint/builder:lint"
"options": {
"lintFilePatterns": [
"e2e/**/*.ts",
"e2e/**/*.html"
],
"cache": true,
"cacheLocation": ".eslintcache",
"ignorePath": ".eslintignore"
},
"outputs": ["{options.outputFile}"]
} }
} }
} }

View File

@ -18,17 +18,7 @@
} }
}, },
"lint": { "lint": {
"executor": "@angular-eslint/builder:lint", "executor": "@angular-eslint/builder:lint"
"options": {
"lintFilePatterns": [
"e2e/**/*.ts",
"e2e/**/*.html"
],
"cache": true,
"cacheLocation": ".eslintcache",
"ignorePath": ".eslintignore"
},
"outputs": ["{options.outputFile}"]
} }
} }
} }

View File

@ -18,17 +18,7 @@
} }
}, },
"lint": { "lint": {
"executor": "@angular-eslint/builder:lint", "executor": "@angular-eslint/builder:lint"
"options": {
"lintFilePatterns": [
"e2e/**/*.ts",
"e2e/**/*.html"
],
"cache": true,
"cacheLocation": ".eslintcache",
"ignorePath": ".eslintignore"
},
"outputs": ["{options.outputFile}"]
} }
} }
} }

View File

@ -18,17 +18,7 @@
} }
}, },
"lint": { "lint": {
"executor": "@angular-eslint/builder:lint", "executor": "@angular-eslint/builder:lint"
"options": {
"lintFilePatterns": [
"e2e/**/*.ts",
"e2e/**/*.html"
],
"cache": true,
"cacheLocation": ".eslintcache",
"ignorePath": ".eslintignore"
},
"outputs": ["{options.outputFile}"]
} }
} }
} }

View File

@ -17,19 +17,7 @@
} }
}, },
"lint": { "lint": {
"executor": "@angular-eslint/builder:lint", "executor": "@angular-eslint/builder:lint"
"options": {
"lintFilePatterns": [
"e2e/**/*.ts",
"e2e/**/*.html"
],
"cache": true,
"cacheLocation": ".eslintcache",
"ignorePath": ".eslintignore"
},
"outputs": [
"{options.outputFile}"
]
} }
} }
} }

15
nx.json
View File

@ -48,10 +48,17 @@
] ]
}, },
"lint": { "lint": {
"inputs": [ "executor": "@angular-eslint/builder:lint",
"default", "outputs": ["{options.outputFile}"],
"{workspaceRoot}/.eslintrc.json" "options": {
] "lintFilePatterns": [
"{projectRoot}/**/*.ts",
"{projectRoot}/**/*.html"
],
"cache": true,
"cacheLocation": ".eslintcache",
"ignorePath": ".eslintignore"
}
}, },
"e2e": { "e2e": {
"inputs": [ "inputs": [

View File

@ -1,23 +1,15 @@
path = require("path"); const path = require('path');
module.exports = { module.exports = {
"extends": "../../.eslintrc.json", extends: '../../.eslintrc.json',
"ignorePatterns": [ ignorePatterns: ['!**/*'],
"!**/*" overrides: [
],
"overrides": [
{ {
"files": [ files: ['*.ts'],
"*.ts" parserOptions: {
], project: [path.join(__dirname, 'tsconfig.lib.json'), path.join(__dirname, 'tsconfig.spec.json')],
"parserOptions": { createDefaultProgram: true
"project": [
path.join(__dirname, "tsconfig.lib.json"),
path.join(__dirname, "tsconfig.spec.json")
],
"createDefaultProgram": true
}, },
"rules": { rules: {}
}
} }
] ]
} };

View File

@ -41,19 +41,7 @@
} }
}, },
"lint": { "lint": {
"executor": "@angular-eslint/builder: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}"
]
} }
} }
} }

View File

@ -1,23 +1,15 @@
path = require("path"); const path = require('path');
module.exports = { module.exports = {
"extends": "../../.eslintrc.json", extends: '../../.eslintrc.json',
"ignorePatterns": [ ignorePatterns: ['!**/*'],
"!**/*" overrides: [
],
"overrides": [
{ {
"files": [ files: ['*.ts'],
"*.ts" parserOptions: {
], project: [path.join(__dirname, 'tsconfig.lib.json'), path.join(__dirname, 'tsconfig.spec.json')],
"parserOptions": { createDefaultProgram: true
"project": [
path.join(__dirname, "tsconfig.lib.json"),
path.join(__dirname, "tsconfig.spec.json")
],
"createDefaultProgram": true
}, },
"rules": { rules: {}
}
} }
] ]
} };

View File

@ -36,19 +36,7 @@
} }
}, },
"lint": { "lint": {
"executor": "@angular-eslint/builder: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}"
]
} }
} }
} }