WebApp CI: Converting tslint to eslint

This commit is contained in:
Zoe Roux 2021-11-21 19:56:07 +01:00
parent b7050c3a01
commit efa94f47dc
No known key found for this signature in database
GPG Key ID: 8BB9CF5EF72AE933
8 changed files with 847 additions and 314 deletions

75
front/.eslintrc.json Normal file
View File

@ -0,0 +1,75 @@
{
"root": true,
"ignorePatterns": [
"projects/**/*"
],
"overrides": [
{
"files": [
"*.ts"
],
"parserOptions": {
"project": [
"tsconfig.json"
],
"createDefaultProgram": true
},
"extends": [
"plugin:@angular-eslint/recommended",
"plugin:@angular-eslint/template/process-inline-templates"
],
"rules": {
"@angular-eslint/component-selector": [
"error",
{
"prefix": "app",
"style": "kebab-case",
"type": "element"
}
],
"@angular-eslint/directive-selector": [
"error",
{
"prefix": "app",
"style": "camelCase",
"type": "attribute"
}
]
}
},
{
"files": [
"*.html"
],
"extends": [
"plugin:@angular-eslint/template/recommended"
],
"rules": {}
}
],
"rules": {
"indent": [
"error",
"tab",
{
"SwitchCase": 1
}
],
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"error",
"double"
],
"semi": [
"error",
"always"
],
"brace-style": [
"error",
"allman"
]
}
}

View File

@ -3,7 +3,8 @@
"version": 1,
"cli": {
"packageManager": "yarn",
"analytics": false
"analytics": false,
"defaultCollection": "@angular-eslint/schematics"
},
"newProjectRoot": "projects",
"projects": {
@ -44,7 +45,9 @@
"./node_modules/hls.js/dist/hls.js"
],
"stylePreprocessorOptions": {
"includePaths": ["src"]
"includePaths": [
"src"
]
}
},
"configurations": {
@ -105,12 +108,11 @@
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"builder": "@angular-eslint/builder:lint",
"options": {
"tsConfig": "tsconfig.json",
"exclude": [
"**/node_modules/**",
"dist"
"lintFilePatterns": [
"projects/host/**/*.ts",
"projects/host/**/*.html"
]
}
}

View File

@ -39,6 +39,11 @@
},
"devDependencies": {
"@angular-devkit/build-angular": "^13.0.3",
"@angular-eslint/builder": "13.0.1",
"@angular-eslint/eslint-plugin": "13.0.1",
"@angular-eslint/eslint-plugin-template": "13.0.1",
"@angular-eslint/schematics": "13.0.1",
"@angular-eslint/template-parser": "13.0.1",
"@angular/cli": "^13.0.3",
"@angular/compiler-cli": "^13.0.2",
"@angular/language-service": "^13.0.2",
@ -46,9 +51,10 @@
"@types/jquery": "^3.5.8",
"@types/node": "^16.11.9",
"@types/video.js": "^7.3.27",
"codelyzer": "^6.0.2",
"@typescript-eslint/eslint-plugin": "5.3.0",
"@typescript-eslint/parser": "5.3.0",
"eslint": "^8.2.0",
"ts-node": "~10.4.0",
"tslint": "^6.1.3",
"typescript": "4.4.4"
}
}

View File

@ -0,0 +1,43 @@
{
"extends": "../../.eslintrc.json",
"ignorePatterns": [
"!**/*"
],
"overrides": [
{
"files": [
"*.ts"
],
"parserOptions": {
"project": [
"tsconfig.json"
],
"createDefaultProgram": true
},
"rules": {
"@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"
],
"rules": {}
}
]
}

View File

@ -29,16 +29,21 @@ export class AppComponent
isLoading: boolean = false;
constructor(private libraryService: LibraryService,
constructor(
private libraryService: LibraryService,
private router: Router,
private location: Location,
public authManager: AuthService,
public dialog: MatDialog)
public dialog: MatDialog
)
{
libraryService.getAll().subscribe(result =>
libraryService.getAll().subscribe({
next: result =>
{
this.libraries = result.items;
}, error => console.error(error));
},
error: error => console.error(error)
});
this.router.events.subscribe((event: Event) =>
{
@ -85,8 +90,7 @@ export class AppComponent
this.router.navigate(["/search", query], {
replaceUrl: this.router.url.startsWith("/search")
});
}
else
} else
{
event.target.classList.remove("searching");
this.location.back();

View File

@ -1,6 +1,6 @@
import { Directive, ElementRef, HostListener, Input, Pipe, PipeTransform } from "@angular/core";
/* tslint:disable:directive-selector */
/* eslint-disable @angular-eslint/directive-selector */
@Directive({
selector: "img[fallback]"
})

View File

@ -1,145 +0,0 @@
{
"extends": "tslint:recommended",
"rulesDirectory": [
"codelyzer"
],
"rules": {
"align": {
"options": [
"parameters",
"statements"
]
},
"array-type": false,
"arrow-return-shorthand": true,
"deprecation": {
"severity": "warning"
},
"eofline": true,
"import-spacing": true,
"max-classes-per-file": false,
"max-line-length": [
true,
120
],
"member-ordering": [
true,
{
"order": [
"static-field",
"instance-field",
"static-method",
"instance-method"
]
}
],
"no-console": [
true,
"debug",
"info",
"time",
"timeEnd",
"trace"
],
"no-empty": false,
"no-inferrable-types": false,
"no-non-null-assertion": true,
"no-redundant-jsdoc": true,
"jsdoc-format": false,
"no-switch-case-fall-through": true,
"no-var-requires": true,
"object-literal-key-quotes": [
true,
"as-needed"
],
"quotemark": [
true,
"double"
],
"semicolon": {
"options": [
"always"
]
},
"space-before-function-paren": {
"options": {
"anonymous": "never",
"asyncArrow": "always",
"constructor": "never",
"method": "never",
"named": "never"
}
},
"typedef": [
true,
"call-signature",
"parameter",
"property-declaration",
"variable-declaration"
],
"typedef-whitespace": {
"options": [
{
"call-signature": "nospace",
"index-signature": "nospace",
"parameter": "nospace",
"property-declaration": "nospace",
"variable-declaration": "nospace"
},
{
"call-signature": "onespace",
"index-signature": "onespace",
"parameter": "onespace",
"property-declaration": "onespace",
"variable-declaration": "onespace"
}
]
},
"variable-name": {
"options": [
"ban-keywords",
"check-format",
"allow-leading-underscore",
"require-const-for-all-caps"
]
},
"whitespace": {
"options": [
"check-branch",
"check-decl",
"check-operator",
"check-separator",
"check-type",
"check-typecast",
"check-module"
]
},
"component-class-suffix": true,
"contextual-lifecycle": true,
"directive-class-suffix": true,
"no-conflicting-lifecycle": true,
"no-host-metadata-property": true,
"no-input-rename": true,
"no-inputs-metadata-property": true,
"no-output-native": true,
"no-output-on-prefix": true,
"no-output-rename": true,
"no-outputs-metadata-property": true,
"template-banana-in-box": true,
"template-no-negated-async": true,
"use-lifecycle-interface": true,
"use-pipe-transform-interface": true,
"directive-selector": [
true,
"attribute",
"app",
"camelCase"
],
"component-selector": [
true,
"element",
"app",
"kebab-case"
]
}
}

File diff suppressed because it is too large Load Diff