From de5a06fa3aff5aa05594a68240c7dbd2aae32809 Mon Sep 17 00:00:00 2001 From: ScarletFlash Date: Sat, 22 Jun 2024 16:54:05 +0200 Subject: [PATCH] ci: essential linting --- angular.json | 2 + eslint.config.js | 51 +++-- src/app/app.component.html | 386 ------------------------------------- src/app/app.component.ts | 5 +- src/index.html | 6 +- src/main.ts | 6 +- 6 files changed, 35 insertions(+), 421 deletions(-) diff --git a/angular.json b/angular.json index 7030296..487d0df 100644 --- a/angular.json +++ b/angular.json @@ -111,6 +111,8 @@ "lint": { "builder": "@angular-eslint/builder:lint", "options": { + "quiet": true, + "eslintConfig": "eslint.config.js", "lintFilePatterns": ["src/**/*.ts", "src/**/*.html"] } } diff --git a/eslint.config.js b/eslint.config.js index 3f49e50..992b486 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -1,40 +1,33 @@ // @ts-check -const eslint = require('@eslint/js'); -const tseslint = require('typescript-eslint'); -const angular = require('angular-eslint'); +const ESLint = require('@eslint/js'); +const AngularESLint = require('angular-eslint'); +const TypeScriptESLint = require('typescript-eslint'); -module.exports = tseslint.config( +module.exports = TypeScriptESLint.config( { + languageOptions: { + parser: TypeScriptESLint.parser, + parserOptions: { + ecmaFeatures: { modules: true }, + ecmaVersion: 'latest', + project: './tsconfig.app.json' + } + }, files: ['**/*.ts'], extends: [ - eslint.configs.recommended, - ...tseslint.configs.recommended, - ...tseslint.configs.stylistic, - ...angular.configs.tsRecommended + ESLint.configs.recommended, + ...TypeScriptESLint.configs.strictTypeChecked, + ...TypeScriptESLint.configs.stylisticTypeChecked, + ...AngularESLint.configs.tsAll ], - processor: angular.processInlineTemplates, - rules: { - '@angular-eslint/directive-selector': [ - 'error', - { - type: 'attribute', - prefix: 'app', - style: 'camelCase' - } - ], - '@angular-eslint/component-selector': [ - 'error', - { - type: 'element', - prefix: 'app', - style: 'kebab-case' - } - ] - } + processor: AngularESLint.processInlineTemplates, + rules: {} }, { files: ['**/*.html'], - extends: [...angular.configs.templateRecommended, ...angular.configs.templateAccessibility], - rules: {} + extends: [...AngularESLint.configs.templateAll], + rules: { + '@angular-eslint/template/i18n': 'off' + } } ); diff --git a/src/app/app.component.html b/src/app/app.component.html index db2668d..67e7bd4 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -1,387 +1 @@ - - - - - - - - - - - -
-
-
- -

Hello, {{ title }}

-

Congratulations! Your app is running. 🎉

-
- -
-
- @for ( - item of [ - { title: 'Explore the Docs', link: 'https://angular.dev' }, - { title: 'Learn with Tutorials', link: 'https://angular.dev/tutorials' }, - { title: 'CLI Docs', link: 'https://angular.dev/tools/cli' }, - { title: 'Angular Language Service', link: 'https://angular.dev/tools/language-service' }, - { - title: - 'Angular - DevTools', - link: 'https://angular.dev/tools/devtools' - } - ]; - track item.title - ) { - - {{ item.title }} - - - - - } -
- -
-
-
- - - - - - - - - diff --git a/src/app/app.component.ts b/src/app/app.component.ts index bf6972d..77d05ba 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -1,11 +1,12 @@ -import { Component } from '@angular/core'; +import { ChangeDetectionStrategy, Component } from '@angular/core'; import { RouterOutlet } from '@angular/router'; @Component({ selector: 'app-root', standalone: true, imports: [RouterOutlet], - templateUrl: './app.component.html' + templateUrl: './app.component.html', + changeDetection: ChangeDetectionStrategy.OnPush }) export class AppComponent { title = 'frontend'; diff --git a/src/index.html b/src/index.html index 5e4b72a..14fdfcc 100644 --- a/src/index.html +++ b/src/index.html @@ -2,19 +2,21 @@ - Frontend + Frontend - + diff --git a/src/main.ts b/src/main.ts index 17447a5..a131253 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,5 +1,7 @@ import { bootstrapApplication } from '@angular/platform-browser'; -import { appConfig } from './app/app.config'; import { AppComponent } from './app/app.component'; +import { appConfig } from './app/app.config'; -bootstrapApplication(AppComponent, appConfig).catch((err) => console.error(err)); +bootstrapApplication(AppComponent, appConfig).catch((error: unknown) => { + console.error(error); +});