Skip to content

Commit bafdb09

Browse files
chore: lint angular templates (#173)
Signed-off-by: David Dal Busco <david.dalbusco@outlook.com>
1 parent ef14af2 commit bafdb09

11 files changed

Lines changed: 40 additions & 13 deletions

File tree

templates/angular-example/angular.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,17 @@
8585
"styles": ["src/styles.css"],
8686
"scripts": []
8787
}
88+
},
89+
"lint": {
90+
"builder": "@angular-eslint/builder:lint",
91+
"options": {
92+
"lintFilePatterns": ["src/**/*.ts", "src/**/*.html"]
93+
}
8894
}
8995
}
9096
}
97+
},
98+
"cli": {
99+
"schematicCollections": ["angular-eslint"]
91100
}
92101
}

templates/angular-example/package.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
"test": "ng test",
1111
"format": "prettier --write .",
1212
"postinstall:copy-auth": "node -e \"require('fs').cpSync('node_modules/@junobuild/core/dist/workers/', './src/assets/workers', {recursive: true});\"",
13-
"postinstall": "npm run postinstall:copy-auth"
13+
"postinstall": "npm run postinstall:copy-auth",
14+
"lint": "ng lint"
1415
},
1516
"private": true,
1617
"dependencies": {
@@ -35,6 +36,8 @@
3536
"@angular/compiler-cli": "^20.0.5",
3637
"@tailwindcss/postcss": "^4.1.10",
3738
"@types/jasmine": "~5.1.8",
39+
"angular-eslint": "20.2.0",
40+
"eslint": "^9.33.0",
3841
"jasmine-core": "~5.8.0",
3942
"karma": "~6.4.4",
4043
"karma-chrome-launcher": "~3.2.0",
@@ -45,7 +48,8 @@
4548
"prettier": "^3.6.1",
4649
"prettier-plugin-tailwindcss": "^0.6.13",
4750
"tailwindcss": "^4.1.10",
48-
"typescript": "~5.8.3"
51+
"typescript": "~5.8.3",
52+
"typescript-eslint": "8.40.0"
4953
},
5054
"overrides": {
5155
"@angular-devkit/build-angular": {

templates/angular-example/src/app/app.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component } from '@angular/core';
1+
import { Component, OnInit } from '@angular/core';
22
import { initSatellite } from '@junobuild/core';
33
import { environment } from '../environments/environment';
44
import { HomeComponent } from './components/home/home.component';
@@ -8,7 +8,7 @@ import { HomeComponent } from './components/home/home.component';
88
imports: [HomeComponent],
99
templateUrl: './app.component.html',
1010
})
11-
export class AppComponent {
11+
export class AppComponent implements OnInit {
1212
title = 'Juno / Angular Example';
1313

1414
async ngOnInit() {

templates/angular-example/src/app/components/backdrop/backdrop.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component, input, Input } from '@angular/core';
1+
import { Component, input } from '@angular/core';
22

33
@Component({
44
selector: 'app-backdrop',
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import { NgClass } from '@angular/common';
2-
import { Component, input, Input } from '@angular/core';
2+
import { Component, input } from '@angular/core';
33

44
@Component({
55
selector: 'app-button',
66
imports: [NgClass],
77
templateUrl: './button.component.html',
88
})
99
export class ButtonComponent {
10-
disabled = input.required<boolean>()
11-
10+
disabled = input.required<boolean>();
1211
}

templates/angular-example/src/app/components/table/table.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
>
1212
<span
1313
role="cell"
14-
aria-rowindex="{index}"
14+
[attr.aria-rowindex]="i + 1"
1515
class="align-center flex min-w-max p-1"
1616
>
1717
{{ i + 1 }}

templates/angular-example/src/main.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { appConfig } from './app/app.config';
55
// Agent-js requires a polyfill 😕
66
// I've reported this issue multiple times. Hopefully, it will be addressed in the future.
77
// ERROR ReferenceError: global is not defined
8+
// eslint-disable-next-line
89
(window as any).global = window;
910

1011
bootstrapApplication(AppComponent, appConfig).catch((err) =>

templates/angular-starter/angular.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,17 @@
8585
"styles": ["src/styles.css"],
8686
"scripts": []
8787
}
88+
},
89+
"lint": {
90+
"builder": "@angular-eslint/builder:lint",
91+
"options": {
92+
"lintFilePatterns": ["src/**/*.ts", "src/**/*.html"]
93+
}
8894
}
8995
}
9096
}
97+
},
98+
"cli": {
99+
"schematicCollections": ["angular-eslint"]
91100
}
92101
}

templates/angular-starter/package.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
"test": "ng test",
1111
"format": "prettier --write .",
1212
"postinstall:copy-auth": "node -e \"require('fs').cpSync('node_modules/@junobuild/core/dist/workers/', './src/assets/workers', {recursive: true});\"",
13-
"postinstall": "npm run postinstall:copy-auth"
13+
"postinstall": "npm run postinstall:copy-auth",
14+
"lint": "ng lint"
1415
},
1516
"private": true,
1617
"dependencies": {
@@ -34,6 +35,8 @@
3435
"@angular/compiler-cli": "^20.0.5",
3536
"@tailwindcss/postcss": "^4.1.10",
3637
"@types/jasmine": "~5.1.8",
38+
"angular-eslint": "20.2.0",
39+
"eslint": "^9.33.0",
3740
"jasmine-core": "~5.8.0",
3841
"karma": "~6.4.4",
3942
"karma-chrome-launcher": "~3.2.0",
@@ -44,7 +47,8 @@
4447
"prettier": "^3.6.1",
4548
"prettier-plugin-tailwindcss": "^0.6.13",
4649
"tailwindcss": "^4.1.10",
47-
"typescript": "~5.8.3"
50+
"typescript": "~5.8.3",
51+
"typescript-eslint": "8.40.0"
4852
},
4953
"overrides": {
5054
"@angular-devkit/build-angular": {

templates/angular-starter/src/app/app.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component } from '@angular/core';
1+
import { Component, OnInit } from '@angular/core';
22
import { initSatellite } from '@junobuild/core';
33
import { environment } from '../environments/environment';
44
import { HomeComponent } from './components/home/home.component';
@@ -8,7 +8,7 @@ import { HomeComponent } from './components/home/home.component';
88
imports: [HomeComponent],
99
templateUrl: './app.component.html',
1010
})
11-
export class AppComponent {
11+
export class AppComponent implements OnInit {
1212
title = 'Juno / Angular Starter';
1313

1414
async ngOnInit() {

0 commit comments

Comments
 (0)