RED-3800: fix eslint

This commit is contained in:
Dan Percic 2022-06-19 00:29:20 +03:00
parent 22d8e15c8c
commit 8d2ed3d18b
28 changed files with 125 additions and 1666 deletions

View File

@ -35,20 +35,19 @@
},
{
"files": ["*.ts"],
"extends": ["plugin:@nrwl/nx/typescript"],
"rules": {}
"extends": ["plugin:@nrwl/nx/typescript"]
},
{
"files": ["*.ts"],
"extends": [
"plugin:@nrwl/nx/angular",
"plugin:import/recommended",
"airbnb-typescript/base",
"plugin:@angular-eslint/template/process-inline-templates",
"plugin:@angular-eslint/recommended",
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"plugin:@angular-eslint/recommended--extra"
"plugin:@angular-eslint/recommended",
"plugin:@angular-eslint/recommended--extra",
"plugin:@angular-eslint/template/process-inline-templates",
"plugin:prettier/recommended"
],
"rules": {
"@angular-eslint/no-conflicting-lifecycle": "error",
@ -94,19 +93,19 @@
"selector": "memberLike",
"modifiers": ["private"],
"format": ["camelCase"],
"leadingUnderscore": "require"
"leadingUnderscore": "allow"
},
{
"selector": "memberLike",
"modifiers": ["protected"],
"format": ["camelCase"],
"leadingUnderscore": "require"
"leadingUnderscore": "allow"
},
{
"selector": "memberLike",
"modifiers": ["private", "readonly"],
"format": ["UPPER_CASE", "camelCase"],
"leadingUnderscore": "require"
"leadingUnderscore": "allow"
}
],
"@typescript-eslint/no-empty-function": "off",
@ -139,36 +138,12 @@
"guard-for-in": "error",
"id-blacklist": "off",
"id-match": "off",
"import/prefer-default-export": "off",
"import/no-deprecated": "warn",
"import/no-extraneous-dependencies": "off",
"no-bitwise": "error",
"no-caller": "error",
"no-console": [
"error",
{
"allow": [
"log",
"warn",
"dir",
"timeLog",
"assert",
"clear",
"count",
"countReset",
"group",
"groupEnd",
"table",
"dirxml",
"error",
"groupCollapsed",
"Console",
"profile",
"profileEnd",
"timeStamp",
"context"
]
}
],
"no-console": "off",
"no-debugger": "error",
"no-empty": "off",
"no-eval": "error",
@ -183,6 +158,7 @@
"prefer-const": "error",
"radix": "error",
"curly": "error",
"class-methods-use-this": "off",
"quotes": ["error", "single"],
"comma-dangle": [
"error",
@ -199,21 +175,29 @@
{
"code": 140,
"tabWidth": 4,
"ignoreComments": true,
"ignorePattern": "^import .*"
}
]
},
"plugins": ["eslint-plugin-import", "@angular-eslint/eslint-plugin", "@typescript-eslint"]
}
},
{
"files": ["*.html"],
"extends": ["plugin:@nrwl/nx/angular-template", "plugin:@angular-eslint/template/recommended"],
"extends": ["plugin:@nrwl/nx/angular-template", "plugin:@angular-eslint/template/recommended"]
},
{
// https://github.com/angular-eslint/angular-eslint#notes-for-eslint-plugin-prettier-users
"files": ["*.html"],
"excludedFiles": ["*inline-template-*.component.html"],
"extends": ["plugin:prettier/recommended"],
"rules": {
"@angular-eslint/template/banana-in-box": "error",
"@angular-eslint/template/no-negated-async": "error",
"@angular-eslint/template/eqeqeq": "error"
},
"plugins": ["@angular-eslint/eslint-plugin-template", "prettier"]
"prettier/prettier": [
"error",
{
"parser": "angular"
}
]
}
}
]
}

View File

@ -7,7 +7,7 @@
"arrowParens": "avoid",
"overrides": [
{
"files": "{apps}/**/*.html",
"files": "{apps,libs}/**/*.html",
"options": {
"parser": "angular"
}

View File

@ -1,91 +1,50 @@
{
"version": 1,
"projects": {
"common-ui": {
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "library",
"root": "libs/common-ui",
"sourceRoot": "libs/common-ui/src",
"prefix": "redaction",
"architect": {
"test": {
"builder": "@nrwl/jest:jest",
"outputs": ["coverage/libs/common-ui"],
"options": {
"jestConfig": "libs/common-ui/jest.config.ts",
"passWithNoTests": true
}
},
"lint": {
"builder": "@nrwl/linter:eslint",
"options": {
"lintFilePatterns": ["libs/common-ui/src/**/*.ts", "libs/common-ui/src/**/*.html"]
},
"outputs": ["{options.outputFile}"]
}
},
"tags": []
},
"red-cache": {
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "library",
"root": "libs/red-cache",
"sourceRoot": "libs/red-cache/src",
"prefix": "redaction",
"architect": {
"lint": {
"builder": "@nrwl/linter:eslint",
"options": {
"lintFilePatterns": ["libs/red-cache/src/**/*.ts", "libs/red-cache/src/**/*.html"]
},
"outputs": ["{options.outputFile}"]
},
"test": {
"builder": "@nrwl/jest:jest",
"options": {
"jestConfig": "libs/red-cache/jest.config.ts",
"passWithNoTests": true
},
"outputs": ["coverage/libs/red-cache"]
}
},
"schematics": {
"@schematics/angular:component": {
"style": "scss"
}
},
"tags": []
}
},
"red-domain": {
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "library",
"root": "libs/red-domain",
"sourceRoot": "libs/red-domain/src",
"prefix": "red",
"architect": {
"test": {
"builder": "@nrwl/jest:jest",
"outputs": ["coverage/libs/red-domain"],
"options": {
"jestConfig": "libs/red-domain/jest.config.ts",
"passWithNoTests": true
}
},
"lint": {
"builder": "@nrwl/linter:eslint",
"options": {
"lintFilePatterns": ["libs/red-domain/src/**/*.ts", "libs/red-domain/src/**/*.html"]
},
"outputs": ["{options.outputFile}"]
}
}
"prefix": "red"
},
"red-ui": {
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "application",
"schematics": {
"@schematics/angular:component": {
"style": "scss"
"style": "scss",
"skipTests": true
},
"@schematics/angular:class": {
"skipTests": true
},
"@schematics/angular:directive": {
"skipTests": true
},
"@schematics/angular:guard": {
"skipTests": true
},
"@schematics/angular:module": {
"skipTests": true
},
"@schematics/angular:pipe": {
"skipTests": true
},
"@schematics/angular:service": {
"skipTests": true
}
},
"root": "apps/red-ui",
@ -99,7 +58,7 @@
"index": "apps/red-ui/src/index.html",
"main": "apps/red-ui/src/main.ts",
"polyfills": "apps/red-ui/src/polyfills.ts",
"tsConfig": "apps/red-ui/tsconfig.app.json",
"tsConfig": "apps/red-ui/tsconfig.json",
"baseHref": "/ui/",
"assets": [
"apps/red-ui/src/favicon.ico",
@ -193,24 +152,8 @@
"options": {
"browserTarget": "red-ui:build"
}
},
"lint": {
"builder": "@nrwl/linter:eslint",
"options": {
"lintFilePatterns": ["apps/red-ui/src/**/*.ts", "apps/red-ui/src/**/*.html"]
},
"outputs": ["{options.outputFile}"]
},
"test": {
"builder": "@nrwl/jest:jest",
"options": {
"jestConfig": "apps/red-ui/jest.config.ts",
"passWithNoTests": true
},
"outputs": ["coverage/apps/red-ui"]
}
},
"tags": []
}
}
}
}

View File

@ -3,35 +3,12 @@
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts"],
"extends": ["plugin:@nrwl/nx/angular", "plugin:@angular-eslint/template/process-inline-templates"],
"files": ["**/*.ts"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": ["apps/red-ui/tsconfig.*?.json"]
"project": ["apps/red-ui/tsconfig.json"]
},
"rules": {
"@angular-eslint/directive-selector": [
"error",
{
"type": "attribute",
"prefix": "redaction",
"style": "camelCase"
}
],
"@angular-eslint/component-selector": [
"error",
{
"type": "element",
"prefix": "redaction",
"style": "kebab-case"
}
]
},
"plugins": ["@angular-eslint/eslint-plugin", "@typescript-eslint"]
},
{
"files": ["*.html"],
"extends": ["plugin:@nrwl/nx/angular-template"],
"rules": {}
"extends": ["plugin:@typescript-eslint/recommended", "plugin:@typescript-eslint/recommended-requiring-type-checking"]
}
]
}

View File

@ -1,24 +0,0 @@
/* eslint-disable */
export default {
preset: '../../jest.preset.js',
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
globals: {
'ts-jest': {
stringifyContentPathRegex: '\\.(html|svg)$',
tsconfig: '<rootDir>/tsconfig.spec.json',
},
},
coverageDirectory: '../../coverage/apps/red-ui',
displayName: 'red-ui',
snapshotSerializers: [
'jest-preset-angular/build/serializers/no-ng-attributes',
'jest-preset-angular/build/serializers/ng-snapshot',
'jest-preset-angular/build/serializers/html-comment',
],
transform: {
'^.+.(ts|mjs|js|html)$': 'jest-preset-angular',
},
transformIgnorePatterns: ['node_modules/(?!.*.mjs$)'],
};

View File

@ -1 +0,0 @@
import 'jest-preset-angular/setup-jest';

View File

@ -1,9 +0,0 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"allowSyntheticDefaultImports": true
},
"files": ["src/main.ts", "src/polyfills.ts"],
"exclude": ["jest.config.ts"]
}

View File

@ -1,4 +0,0 @@
{
"extends": "./tsconfig.json",
"include": ["src/**/*.ts"]
}

View File

@ -1,16 +1,8 @@
{
"extends": "../../tsconfig.base.json",
"files": [],
"include": [],
"references": [
{
"path": "./tsconfig.app.json"
},
{
"path": "./tsconfig.spec.json"
}
],
"compilerOptions": {
"target": "es2020"
}
"outDir": "../../dist/out-tsc",
"allowSyntheticDefaultImports": true
},
"files": ["src/main.ts", "src/polyfills.ts"]
}

View File

@ -1,10 +0,0 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"module": "commonjs",
"types": ["jest", "node"]
},
"files": ["src/test-setup.ts"],
"include": ["**/*.spec.ts", "**/*.d.ts", "jest.config.ts"]
}

View File

@ -1,3 +0,0 @@
const { getJestProjects } = require('@nrwl/jest');
export default { projects: getJestProjects() };

View File

@ -1,11 +0,0 @@
const nxPreset = require('@nrwl/jest/preset').default;
module.exports = {
...nxPreset,
testMatch: ['**/+(*.)+(spec|test).+(ts|js)?(x)'],
transform: {
'^.+\\.(ts|js|html)$': 'ts-jest',
},
resolver: '@nrwl/jest/plugins/resolver',
moduleFileExtensions: ['ts', 'js', 'html'],
coverageReporters: ['html'],
};

@ -1 +1 @@
Subproject commit cca7401d26751800eab72b00c8522a5bba981f28
Subproject commit ceab57e1cd8c3d37707b507be731673c6f0860d8

View File

@ -3,10 +3,9 @@
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts"],
"extends": ["plugin:@nrwl/nx/angular", "plugin:@angular-eslint/template/process-inline-templates"],
"files": ["**/*.ts"],
"parserOptions": {
"project": ["libs/red-cache/tsconfig.*?.json"]
"project": ["libs/red-cache/tsconfig.json"]
},
"rules": {
"@angular-eslint/directive-selector": [
@ -26,13 +25,7 @@
}
],
"max-len": "off"
},
"plugins": ["@angular-eslint/eslint-plugin", "@typescript-eslint"]
},
{
"files": ["*.html"],
"extends": ["plugin:@nrwl/nx/angular-template"],
"rules": {}
}
}
]
}

View File

@ -1,24 +0,0 @@
/* eslint-disable */
export default {
preset: '../../jest.preset.js',
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
globals: {
'ts-jest': {
stringifyContentPathRegex: '\\.(html|svg)$',
tsconfig: '<rootDir>/tsconfig.spec.json',
},
},
coverageDirectory: '../../coverage/libs/red-cache',
displayName: 'red-cache',
snapshotSerializers: [
'jest-preset-angular/build/serializers/no-ng-attributes',
'jest-preset-angular/build/serializers/ng-snapshot',
'jest-preset-angular/build/serializers/html-comment',
],
transform: {
'^.+.(ts|mjs|js|html)$': 'jest-preset-angular',
},
transformIgnorePatterns: ['node_modules/(?!.*.mjs$)'],
};

View File

@ -1,17 +0,0 @@
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
import 'core-js/es7/reflect';
import 'zone.js';
import 'zone.js/testing';
import { getTestBed } from '@angular/core/testing';
import { BrowserDynamicTestingModule, platformBrowserDynamicTesting } from '@angular/platform-browser-dynamic/testing';
declare const require: any;
// First, initialize the Angular testing environment.
getTestBed().initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting());
// Then we find all the tests.
const context = require.context('./', true, /\.spec\.ts$/);
// And load the modules.
context.keys().map(context);

View File

@ -1,16 +1,15 @@
{
"extends": "../../tsconfig.base.json",
"files": [],
"include": [],
"references": [
{
"path": "./tsconfig.lib.json"
},
{
"path": "./tsconfig.spec.json"
}
],
"compilerOptions": {
"target": "es2020"
}
"outDir": "../../dist/out-tsc",
"declaration": true,
"declarationMap": true,
"inlineSources": true
},
"angularCompilerOptions": {
"skipTemplateCodegen": true,
"strictMetadataEmit": true,
"enableResourceInlining": true
},
"include": ["**/*.ts"]
}

View File

@ -1,19 +0,0 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"target": "es2015",
"declaration": true,
"declarationMap": true,
"inlineSources": true,
"types": [],
"lib": ["dom", "es2018"]
},
"angularCompilerOptions": {
"skipTemplateCodegen": true,
"strictMetadataEmit": true,
"enableResourceInlining": true
},
"exclude": ["src/test-setup.ts", "**/*.spec.ts", "jest.config.ts"],
"include": ["**/*.ts"]
}

View File

@ -1,10 +0,0 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"module": "commonjs",
"types": ["jest", "node"]
},
"files": ["src/test-setup.ts"],
"include": ["**/*.spec.ts", "**/*.d.ts", "jest.config.ts"]
}

View File

@ -4,17 +4,8 @@
"overrides": [
{
"files": ["*.ts"],
"extends": [
"plugin:@nrwl/nx/angular",
"plugin:@angular-eslint/template/process-inline-templates",
"plugin:@angular-eslint/recommended",
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"plugin:@angular-eslint/recommended--extra"
],
"parserOptions": {
"project": ["libs/red-domain/tsconfig.*?.json"]
"project": ["libs/red-domain/tsconfig.json"]
},
"rules": {
"@angular-eslint/directive-selector": [
@ -33,53 +24,34 @@
"style": "kebab-case"
}
],
"@angular-eslint/prefer-on-push-component-change-detection": "error",
"@angular-eslint/use-lifecycle-interface": "error",
"@angular-eslint/no-input-prefix": "error",
"@angular-eslint/no-input-rename": "error",
"@angular-eslint/no-output-on-prefix": "error",
"@angular-eslint/no-output-rename": "error",
"@angular-eslint/prefer-output-readonly": "error",
"@typescript-eslint/unbound-method": "error",
"@typescript-eslint/no-floating-promises": "off",
"@typescript-eslint/lines-between-class-members": "off",
"@typescript-eslint/naming-convention": [
"error",
{
"selector": "memberLike",
"modifiers": ["private"],
"format": ["camelCase"],
"leadingUnderscore": "require"
"leadingUnderscore": "allow"
},
{
"selector": "memberLike",
"modifiers": ["protected"],
"format": ["camelCase"],
"leadingUnderscore": "require"
"leadingUnderscore": "allow"
},
{
"selector": "memberLike",
"modifiers": ["private"],
"format": ["UPPER_CASE", "camelCase"],
"leadingUnderscore": "require"
"leadingUnderscore": "allow"
}
],
"import/prefer-default-export": "off",
"no-underscore-dangle": "off",
"no-param-reassign": "error",
"consistent-return": "off",
"class-methods-use-this": "off",
"@typescript-eslint/no-unsafe-call": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/restrict-template-expressions": "off"
},
"plugins": ["@angular-eslint/eslint-plugin", "@typescript-eslint"]
},
{
"files": ["*.html"],
"extends": ["plugin:@nrwl/nx/angular-template", "plugin:@angular-eslint/template/recommended"],
"plugins": ["prettier"],
"rules": {}
}
}
]
}

View File

@ -1,22 +0,0 @@
/* eslint-disable */
export default {
displayName: 'red-domain',
preset: '../../jest.preset.js',
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
globals: {
'ts-jest': {
tsconfig: '<rootDir>/tsconfig.spec.json',
stringifyContentPathRegex: '\\.(html|svg)$',
},
},
coverageDirectory: '../../coverage/libs/red-domain',
snapshotSerializers: [
'jest-preset-angular/build/serializers/no-ng-attributes',
'jest-preset-angular/build/serializers/ng-snapshot',
'jest-preset-angular/build/serializers/html-comment',
],
transform: {
'^.+.(ts|mjs|js|html)$': 'jest-preset-angular',
},
transformIgnorePatterns: ['node_modules/(?!.*.mjs$)'],
};

View File

@ -1,2 +0,0 @@
// eslint-disable-next-line import/no-extraneous-dependencies
import 'jest-preset-angular/setup-jest';

View File

@ -1,24 +1,14 @@
{
"extends": "../../tsconfig.base.json",
"files": [],
"include": [],
"references": [
{
"path": "./tsconfig.lib.json"
},
{
"path": "./tsconfig.spec.json"
}
],
"compilerOptions": {
"forceConsistentCasingInFileNames": true,
"outDir": "../../dist/out-tsc",
"declaration": true,
"declarationMap": true,
"inlineSources": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true
},
"angularCompilerOptions": {
"strictInjectionParameters": true,
"strictInputAccessModifiers": true,
"strictTemplates": true
}
"include": ["**/*.ts"]
}

View File

@ -1,15 +0,0 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"target": "es2015",
"declaration": true,
"declarationMap": true,
"inlineSources": true,
"strict": true,
"types": [],
"lib": ["dom", "es2018"]
},
"exclude": ["src/test-setup.ts", "**/*.spec.ts", "jest.config.ts"],
"include": ["**/*.ts"]
}

View File

@ -1,10 +0,0 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"module": "commonjs",
"types": ["jest", "node"]
},
"files": ["src/test-setup.ts"],
"include": ["**/*.spec.ts", "**/*.d.ts", "jest.config.ts"]
}

View File

@ -9,10 +9,8 @@
"build-paligo-styles": "mkdir -p dist/paligo-styles && sass --load-path=. paligo-styles/style.scss > dist/paligo-styles/redacto-theme.css",
"i18n:extract": "ngx-translate-extract --input ./apps/red-ui/src ./libs/common-ui/src --output apps/red-ui/src/assets/i18n/{en,de}.json --clean --sort --format namespaced-json && prettier apps/red-ui/src/assets/i18n/*.json --write",
"postinstall": "ngcc --properties es2020 browser module main",
"lint": "ng lint --project=red-domain --fix && ng lint --project=red-ui --fix && ng lint --project=common-ui --fix",
"nx": "nx",
"start": "nx serve",
"test": "nx test",
"update": "nx migrate latest",
"migrate": "nx migrate --run-migrations",
"workspace-generator": "nx workspace-generator",
@ -76,14 +74,12 @@
"@bartholomej/ngx-translate-extract": "^8.0.2",
"@nrwl/cli": "14.3.2",
"@nrwl/eslint-plugin-nx": "14.3.2",
"@nrwl/jest": "14.3.2",
"@nrwl/linter": "14.3.2",
"@nrwl/workspace": "14.3.2",
"@types/google.visualization": "^0.0.68",
"@types/jest": "28.1.1",
"@types/lodash-es": "^4.17.6",
"@types/node": "17.0.42",
"@types/puppeteer": "^5.4.6",
"@typescript-eslint/eslint-plugin": "5.24.0",
"@typescript-eslint/parser": "5.24.0",
"axios": "^0.27.2",
@ -97,9 +93,6 @@
"google-translate-api-browser": "^1.1.71",
"husky": "^8.0.1",
"lint-staged": "^13.0.2",
"jest": "28.1.1",
"jest-preset-angular": "12.1.0",
"ng-packagr": "14.0.2",
"nx": "14.3.2",
"postcss": "^8.4.14",
"postcss-import": "14.1.0",
@ -109,7 +102,6 @@
"sonarqube-scanner": "^2.8.1",
"superagent": "^7.1.6",
"superagent-promise": "^1.1.0",
"ts-jest": "28.0.5",
"ts-node": "10.8.1",
"typescript": "4.7.3",
"webpack": "^5.73.0",

View File

@ -9,7 +9,7 @@
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"importHelpers": true,
"target": "es2017",
"target": "es2020",
"module": "es2020",
"typeRoots": ["node_modules/@types"],
"lib": ["es2020", "dom"],

1276
yarn.lock

File diff suppressed because it is too large Load Diff