mgr/dashboard: add more html lint rules and fixer

deprecate the older eslint packages and install the unified official
packages for eslint and migrate .eslintrc to eslint.config.js.

also bump prettier

Fixes: https://tracker.ceph.com/issues/77112
Signed-off-by: Nizamudeen A <nia@redhat.com>
This commit is contained in:
Nizamudeen A 2026-07-09 13:19:59 +05:30
parent 944f1b6b01
commit 8ae8c8177f
5 changed files with 654 additions and 6714 deletions

View File

@ -1,95 +0,0 @@
{
"root": true,
"ignorePatterns": [
"projects/**/*"
],
"overrides": [
{
"files": [
"*.ts"
],
"parserOptions": {
"project": [
"tsconfig.json"
],
"createDefaultProgram": true
},
"extends": [
"plugin:@angular-eslint/recommended",
"plugin:@angular-eslint/template/process-inline-templates"
],
"rules": {
"no-multiple-empty-lines": [
"error",
{
"max": 2,
"maxEOF": 1
}
],
"spaced-comment": [
"error",
"always",
{
"exceptions": ["-", "+", "*"]
}
],
"curly": [
"error",
"multi-line"
],
"guard-for-in": "error",
"no-restricted-imports": ["error", {
"paths": ["rxjs/Rx", {
"name" : "@angular/core/testing",
"importNames": ["async"]
}],
"patterns": ["(\\.{1,2}/){2,}"]
}],
"no-console": [
"error",
{
"allow": [
"debug",
"info",
"time",
"timeEnd",
"trace"
]
}
],
"no-trailing-spaces": "error",
"no-caller": "error",
"no-bitwise": "error",
"no-duplicate-imports": "error",
"no-eval": "error",
"@angular-eslint/directive-selector": [
"error",
{ "type": "attribute", "prefix": "cd", "style": "camelCase" }
],
"@angular-eslint/component-selector": [
"error",
{ "type": "element", "prefix": "cd", "style": "kebab-case" }
]
}
},
{
"files": [
"*.html"
],
"extends": [
"plugin:@angular-eslint/template/recommended"
],
"rules": {
"@angular-eslint/template/eqeqeq": "off",
// HTML validation rules for template files
"@angular-eslint/template/alt-text": "error",
"@angular-eslint/template/no-duplicate-attributes": "error",
"@angular-eslint/template/no-distracting-elements": "error",
"@angular-eslint/template/valid-aria": "error",
"@angular-eslint/template/table-scope": "error",
"@angular-eslint/template/no-positive-tabindex": "error"
}
}
]
}

View File

@ -2,5 +2,10 @@
"arrowParens": "always",
"printWidth": 100,
"singleQuote": true,
"trailingComma": "none"
"trailingComma": "none",
"tabWidth": 2,
"useTabs": false,
"endOfLine": "lf",
"singleAttributePerLine": true,
"htmlWhitespaceSensitivity": "css"
}

View File

@ -0,0 +1,103 @@
import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';
import angular from 'angular-eslint';
export default tseslint.config(
{
ignores: ['projects/**/*']
},
{
files: ['**/*.ts'],
extends: [
eslint.configs.recommended,
...tseslint.configs.recommended,
...tseslint.configs.recommendedTypeChecked,
...angular.configs.tsRecommended
],
processor: angular.processInlineTemplates,
languageOptions: {
parserOptions: {
project: ['tsconfig.json'],
createDefaultProgram: true
}
},
rules: {
'no-multiple-empty-lines': [
'error',
{
max: 2,
maxEOF: 1
}
],
'spaced-comment': [
'error',
'always',
{
exceptions: ['-', '+', '*']
}
],
curly: ['error', 'multi-line'],
'guard-for-in': 'error',
'no-restricted-imports': [
'error',
{
paths: [
'rxjs/Rx',
{
name: '@angular/core/testing',
importNames: ['async']
}
],
patterns: ['(\\.{1,2}/){2,}']
}
],
'no-console': [
'error',
{
allow: ['debug', 'info', 'time', 'timeEnd', 'trace']
}
],
'no-trailing-spaces': 'error',
'no-caller': 'error',
'no-bitwise': 'error',
'no-duplicate-imports': 'error',
'no-eval': 'error',
'@angular-eslint/directive-selector': [
'error',
{
type: 'attribute',
prefix: 'cd',
style: 'camelCase'
}
],
'@angular-eslint/component-selector': [
'error',
{
type: 'element',
prefix: 'cd',
style: 'kebab-case'
}
]
}
},
{
files: ['**/*.html'],
extends: [
...angular.configs.templateRecommended
],
rules: {
'@angular-eslint/template/eqeqeq': 'off',
'@angular-eslint/template/alt-text': 'error',
'@angular-eslint/template/no-duplicate-attributes': 'error',
'@angular-eslint/template/no-distracting-elements': 'error',
'@angular-eslint/template/valid-aria': 'error',
'@angular-eslint/template/table-scope': 'error',
'@angular-eslint/template/no-positive-tabindex': 'error',
'@angular-eslint/template/button-has-type': 'error',
'@angular-eslint/template/interactive-supports-focus': 'error',
'@angular-eslint/template/click-events-have-key-events': 'error',
'@angular-eslint/template/label-has-associated-control': 'error',
'@angular-eslint/template/elements-content': 'error'
}
}
);

File diff suppressed because it is too large Load Diff

View File

@ -27,7 +27,7 @@
"lint:eslint": "ng lint",
"lint:gherkin": "gherkin-lint -c .gherkin-lintrc cypress/e2e",
"lint:prettier": "prettier --list-different \"{src,cypress}/**/*.{ts,scss,html}\"",
"lint:html": "prettier --check \"src/**/*.html\"",
"lint:html": "eslint \"src/**/*.html\" && prettier --check \"src/**/*.html\"",
"lint:tsc": "tsc -p tsconfig.app.json --noEmit && tsc -p tsconfig.spec.json --noEmit && tsc -p cypress/tsconfig.json --noEmit",
"lint:scss": "stylelint '**/*.scss'",
"lint": "run-p -csl --aggregate-output lint:*",
@ -88,11 +88,8 @@
"@angular-devkit/build-angular": "19.2.27",
"@angular-devkit/core": "19.2.27",
"@angular-devkit/schematics": "19.2.27",
"@angular-eslint/builder": "18.4.0",
"@angular-eslint/eslint-plugin": "18.4.0",
"@angular-eslint/eslint-plugin-template": "18.4.0",
"@angular-eslint/schematics": "18.4.0",
"@angular-eslint/template-parser": "18.4.0",
"@angular-eslint/builder": "19.8.1",
"@angular-eslint/schematics": "19.8.1",
"@angular/cli": "19.2.27",
"@angular/compiler-cli": "19.2.25",
"@angular/language-service": "19.2.25",
@ -110,8 +107,7 @@
"@types/node": "22.19.3",
"@types/validator": "13.15.10",
"@types/xml2js": "0.4.14",
"@typescript-eslint/eslint-plugin": "8.14.0",
"@typescript-eslint/parser": "8.14.0",
"angular-eslint": "19.8.1",
"axe-core": "4.4.3",
"cypress": "12.17.4",
"cypress-axe": "1.5.0",
@ -132,7 +128,7 @@
"ng-mocks": "14.13.1",
"npm-run-all": "4.1.5",
"postcss-scss": "4.0.9",
"prettier": "2.1.2",
"prettier": "3.9.4",
"pretty-quick": "3.0.2",
"start-server-and-test": "2.0.3",
"stylelint": "16.20.0",
@ -141,6 +137,7 @@
"table": "6.8.0",
"ts-node": "10.9.2",
"typescript": "5.8.3",
"typescript-eslint": "8.63.0",
"validator": "13.15.23"
},
"cypress-cucumber-preprocessor": {