Add ESLint

This commit is contained in:
aditya.chandel
2025-01-12 20:24:47 -07:00
parent b9ab4b4a66
commit 84255e6598
5 changed files with 1779 additions and 5 deletions
+14
View File
@@ -109,8 +109,22 @@
], ],
"scripts": [] "scripts": []
} }
},
"lint": {
"builder": "@angular-eslint/builder:lint",
"options": {
"lintFilePatterns": [
"src/**/*.ts",
"src/**/*.html"
]
}
} }
} }
} }
},
"cli": {
"schematicCollections": [
"angular-eslint"
]
} }
} }
+43
View File
@@ -0,0 +1,43 @@
// @ts-check
const eslint = require("@eslint/js");
const tseslint = require("typescript-eslint");
const angular = require("angular-eslint");
module.exports = tseslint.config(
{
files: ["**/*.ts"],
extends: [
eslint.configs.recommended,
...tseslint.configs.recommended,
...tseslint.configs.stylistic,
...angular.configs.tsRecommended,
],
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",
},
],
},
},
{
files: ["**/*.html"],
extends: [
...angular.configs.templateRecommended,
...angular.configs.templateAccessibility,
],
rules: {},
}
);
+1714 -1
View File
File diff suppressed because it is too large Load Diff
+7 -3
View File
@@ -6,7 +6,8 @@
"start": "ng serve", "start": "ng serve",
"build": "ng build", "build": "ng build",
"watch": "ng build --watch --configuration development", "watch": "ng build --watch --configuration development",
"test": "ng test" "test": "ng test",
"lint": "ng lint"
}, },
"private": true, "private": true,
"dependencies": { "dependencies": {
@@ -39,7 +40,9 @@
"@angular/cli": "^19.0.2", "@angular/cli": "^19.0.2",
"@angular/compiler-cli": "^19.0.0", "@angular/compiler-cli": "^19.0.0",
"@types/jasmine": "~5.1.0", "@types/jasmine": "~5.1.0",
"angular-eslint": "19.0.2",
"autoprefixer": "^10.4.20", "autoprefixer": "^10.4.20",
"eslint": "^9.16.0",
"jasmine-core": "~5.4.0", "jasmine-core": "~5.4.0",
"karma": "~6.4.0", "karma": "~6.4.0",
"karma-chrome-launcher": "~3.2.0", "karma-chrome-launcher": "~3.2.0",
@@ -48,6 +51,7 @@
"karma-jasmine-html-reporter": "~2.1.0", "karma-jasmine-html-reporter": "~2.1.0",
"postcss": "^8.4.49", "postcss": "^8.4.49",
"tailwindcss": "^3.4.17", "tailwindcss": "^3.4.17",
"typescript": "~5.6.2" "typescript": "~5.6.2",
"typescript-eslint": "8.18.0"
} }
} }
@@ -11,7 +11,7 @@
<p-checkbox <p-checkbox
[(ngModel)]="isSelected" [(ngModel)]="isSelected"
binary="true" binary="true"
id="select-checkbox-{{book?.id}}" id="select-checkbox-{{book.id}}"
class="select-checkbox" class="select-checkbox"
(ngModelChange)="toggleSelection(isSelected || false)"></p-checkbox> (ngModelChange)="toggleSelection(isSelected || false)"></p-checkbox>
<p-button [rounded]="true" icon="pi pi-info" class="read-btn" (click)="openBookInfo(book)"></p-button> <p-button [rounded]="true" icon="pi pi-info" class="read-btn" (click)="openBookInfo(book)"></p-button>