🔧 Add recommended ESLint rules
parent
7980719b9a
commit
d8fc7d06a3
|
@ -0,0 +1 @@
|
|||
src/test.ts
|
|
@ -19,6 +19,8 @@
|
|||
"createDefaultProgram": true
|
||||
},
|
||||
"extends": [
|
||||
"plugin:@typescript-eslint/recommended",
|
||||
"plugin:@typescript-eslint/recommended-requiring-type-checking",
|
||||
"plugin:@angular-eslint/all",
|
||||
"plugin:@angular-eslint/recommended--extra",
|
||||
"plugin:@angular-eslint/template/process-inline-templates"
|
||||
|
|
|
@ -24,15 +24,10 @@ build:
|
|||
paths:
|
||||
- dist/angular
|
||||
|
||||
lint:
|
||||
stage: test
|
||||
script:
|
||||
- pnpm run lint
|
||||
|
||||
test:
|
||||
stage: test
|
||||
script:
|
||||
- pnpm run test
|
||||
- pnpm run lint
|
||||
|
||||
pages:
|
||||
stage: deploy
|
||||
|
|
|
@ -4,7 +4,7 @@ import { AppComponent } from './app.component'
|
|||
|
||||
describe('AppComponent', (): void => {
|
||||
beforeEach(waitForAsync((): void => {
|
||||
TestBed.configureTestingModule({
|
||||
void TestBed.configureTestingModule({
|
||||
imports: [
|
||||
RouterTestingModule,
|
||||
],
|
||||
|
@ -19,7 +19,7 @@ describe('AppComponent', (): void => {
|
|||
if (!(fixture.debugElement.componentInstance instanceof AppComponent)) throw new Error("Expected AppComponent")
|
||||
|
||||
const app: AppComponent = fixture.debugElement.componentInstance
|
||||
expect(app).toBeTruthy()
|
||||
void expect(app).toBeTruthy()
|
||||
})
|
||||
|
||||
it(`should have a themeService`, (): void => {
|
||||
|
@ -27,7 +27,7 @@ describe('AppComponent', (): void => {
|
|||
if (!(fixture.debugElement.componentInstance instanceof AppComponent)) throw new Error("Expected AppComponent")
|
||||
|
||||
const app: AppComponent = fixture.debugElement.componentInstance
|
||||
expect(app.themeService).toBeTruthy()
|
||||
void expect(app.themeService).toBeTruthy()
|
||||
})
|
||||
|
||||
it('should render title', (): void => {
|
||||
|
@ -36,10 +36,10 @@ describe('AppComponent', (): void => {
|
|||
if (!isHTMLElement(fixture.debugElement.nativeElement)) throw new Error("Expected HTMLElement")
|
||||
|
||||
const compiled: HTMLElement = fixture.debugElement.nativeElement
|
||||
expect(compiled.querySelector('h1')?.textContent).toContain('Public Gateway Cacher')
|
||||
void expect(compiled.querySelector('h1')?.textContent).toContain('Public Gateway Cacher')
|
||||
})
|
||||
})
|
||||
|
||||
function isHTMLElement(element: any): element is HTMLElement {
|
||||
return element.__proto__ instanceof HTMLElement
|
||||
function isHTMLElement(element: unknown): element is HTMLElement {
|
||||
return Object.getPrototypeOf(element) instanceof HTMLElement
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ describe('PagesComponent', (): void => {
|
|||
let fixture: ComponentFixture<PagesComponent>
|
||||
|
||||
beforeEach(waitForAsync((): void => {
|
||||
TestBed.configureTestingModule({
|
||||
void TestBed.configureTestingModule({
|
||||
imports: [HttpClientTestingModule],
|
||||
declarations: [PagesComponent]
|
||||
})
|
||||
|
@ -22,6 +22,6 @@ describe('PagesComponent', (): void => {
|
|||
})
|
||||
|
||||
it('should create', (): void => {
|
||||
expect(component).toBeTruthy()
|
||||
void expect(component).toBeTruthy()
|
||||
})
|
||||
})
|
||||
|
|
|
@ -10,6 +10,6 @@ describe('GatewayService', (): void => {
|
|||
|
||||
it('should be created', (): void => {
|
||||
const service: GatewayService = TestBed.inject(GatewayService)
|
||||
expect(service).toBeTruthy()
|
||||
void expect(service).toBeTruthy()
|
||||
})
|
||||
})
|
||||
|
|
|
@ -18,7 +18,7 @@ export class GatewayService {
|
|||
return this.http.get<string[]>(
|
||||
environment.base_href && environment.base_href !== '/'
|
||||
? `${environment.base_href}/assets/json/gateways.json`
|
||||
: `${document.querySelector('base')?.href}assets/json/gateways.json`
|
||||
: `${document.querySelector('base')?.href ?? ''}assets/json/gateways.json`
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,6 @@ describe('ThemeService', (): void => {
|
|||
})
|
||||
|
||||
it('should be created', (): void => {
|
||||
expect(service).toBeTruthy()
|
||||
void expect(service).toBeTruthy()
|
||||
})
|
||||
})
|
||||
|
|
|
@ -45,8 +45,7 @@
|
|||
/***************************************************************************************************
|
||||
* Zone JS is required by default for Angular itself.
|
||||
*/
|
||||
import 'zone.js'; // Included with Angular CLI.
|
||||
|
||||
import 'zone.js' // Included with Angular CLI.
|
||||
|
||||
/***************************************************************************************************
|
||||
* APPLICATION IMPORTS
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
|
||||
import 'zone.js/testing'
|
||||
|
||||
import { getTestBed } from '@angular/core/testing'
|
||||
import { BrowserDynamicTestingModule, platformBrowserDynamicTesting } from '@angular/platform-browser-dynamic/testing'
|
||||
import 'zone.js/testing'
|
||||
|
||||
declare const require: any
|
||||
|
||||
|
|
Loading…
Reference in New Issue