Skip to content

Commit

Permalink
Activate Angular template linter
Browse files Browse the repository at this point in the history
  • Loading branch information
oxy-rj committed Sep 19, 2024
1 parent 3019fe9 commit 58de3f8
Show file tree
Hide file tree
Showing 7 changed files with 79 additions and 23 deletions.
57 changes: 45 additions & 12 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
"*.js",
"*.jsx"
],
"plugins": [
"@angular-eslint/eslint-plugin"
],
"rules": {
"@nx/enforce-module-boundaries": [
"error",
Expand All @@ -29,29 +32,59 @@
}
]
}
]
],
"@angular-eslint/component-selector": [
"error",
{
"type": "element",
"prefix": "app",
"style": "kebab-case"
}
],
"@angular-eslint/directive-selector": [
"error",
{
"type": "attribute",
"prefix": "app",
"style": "camelCase"
}
],
"no-bitwise": "off",
"security-node/detect-crlf": "off",
"@angular-eslint/no-conflicting-lifecycle": "error",
"@angular-eslint/no-host-metadata-property": "error",
"@angular-eslint/no-input-rename": "error",
"@angular-eslint/no-inputs-metadata-property": "error",
"@angular-eslint/no-output-native": "error",
"@angular-eslint/no-output-on-prefix": "error",
"@angular-eslint/no-output-rename": "error",
"@angular-eslint/no-outputs-metadata-property": "error",
"@angular-eslint/use-lifecycle-interface": "error",
"@angular-eslint/use-pipe-transform-interface": "error"
}
},
{
"files": [
"*.ts",
"*.tsx"
],
"extends": [
"plugin:@nx/typescript"
"*.html"
],
"rules": {
"@typescript-eslint/no-extra-semi": "error",
"no-extra-semi": "off"
}
"no-irregular-whitespace": "off",
"@angular-eslint/template/banana-in-box": "error",
"@angular-eslint/template/no-negated-async": "error",
"@angular-eslint/template/eqeqeq": "error",
"@angular-eslint/template/no-inline-styles": "error"
},
"plugins": [
"@angular-eslint/eslint-plugin-template"
]
},
{
"files": [
"*.js",
"*.jsx"
"*.ts",
"*.tsx"
],
"extends": [
"plugin:@nx/javascript"
"plugin:@nx/typescript"
],
"rules": {
"@typescript-eslint/no-extra-semi": "error",
Expand Down
1 change: 1 addition & 0 deletions apps/angular-app/src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ <h1>Welcome to angular-app!</h1>
alt="Nx - Powerful, Extensible Dev Tools" />
</div>
<div>Message: {{ hello$ | async | json }}</div>
<div>{{ someObject?.thisIsAlwaysThere?.str }}</div>

<app-simple-classic-component></app-simple-classic-component>
<app-simple-standalone-component></app-simple-standalone-component>
7 changes: 7 additions & 0 deletions apps/angular-app/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,20 @@ import { Component } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Message } from '@happynrwl/api-interfaces';

interface ISomeObject {
thisIsAlwaysThere: { str: string };
}

@Component({
selector: 'happynrwl-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss'],
})
export class AppComponent {
hello$ = this.http.get<Message>('/api/hello');
protected someObject: ISomeObject = {
thisIsAlwaysThere: { str: 'Here I am' },
}

constructor(
private http: HttpClient,
Expand Down
10 changes: 8 additions & 2 deletions apps/angular-app/tsconfig.app.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"outDir": "../../dist/out-tsc",
"types": [],
"target": "ES2022",
"useDefineForClassFields": false
"useDefineForClassFields": false,
"strict": true
},
"files": [
"src/main.ts",
Expand All @@ -18,5 +19,10 @@
"**/*.cy.js",
"**/*.cy.tsx",
"**/*.cy.jsx"
]
],
"angularCompilerOptions": {
"strictInjectionParameters": true,
"strictInputAccessModifiers": true,
"strictTemplates": true
}
}
21 changes: 14 additions & 7 deletions apps/angular-app/tsconfig.editor.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
{
"extends": "./tsconfig.json",
"include": ["**/*.ts"],
"compilerOptions": {
"types": ["jest", "node"]
},
"exclude": ["jest.config.ts"]
}
"extends": "./tsconfig.json",
"include": [
"**/*.ts"
],
"compilerOptions": {
"types": [
"jest",
"node"
]
},
"exclude": [
"jest.config.ts"
]
}
Empty file removed libs/.gitkeep
Empty file.
6 changes: 4 additions & 2 deletions nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@
"style": "scss",
"linter": "eslint",
"unitTestRunner": "jest",
"e2eTestRunner": "cypress"
"e2eTestRunner": "cypress",
"strict": true
},
"@nx/angular:library": {
"linter": "eslint",
"unitTestRunner": "jest"
"unitTestRunner": "jest",
"strict": true
},
"@nx/angular:component": {
"style": "scss"
Expand Down

0 comments on commit 58de3f8

Please sign in to comment.