Skip to content

Commit

Permalink
mgr/dashboard: tslint to eslint migration
Browse files Browse the repository at this point in the history
Fixes: https://tracker.ceph.com/issues/48258
Signed-off-by: Nizamudeen A <[email protected]>
  • Loading branch information
nizamial09 committed Nov 14, 2022
1 parent c31f699 commit 31a0a4f
Show file tree
Hide file tree
Showing 27 changed files with 1,511 additions and 470 deletions.
4 changes: 2 additions & 2 deletions CodingStyle
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,9 @@ For Angular code, we follow the official Angular style guide:
https://angular.io/guide/styleguide

To check whether your code is conformant with the style guide, we use a
combination of TSLint, Codelyzer and Prettier:
combination of ESLint, Codelyzer and Prettier:

https://palantir.github.io/tslint/
https://eslint.org/
http://codelyzer.com/
https://prettier.io/

2 changes: 1 addition & 1 deletion doc/dev/developer_guide/dash-devel.rst
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ HTML files:
- `html-linter <https://github.com/chinchiheather/html-linter>`_
- `htmllint-cli <https://github.com/htmllint/htmllint-cli>`_
- `Prettier <https://prettier.io/>`_
- `TSLint <https://palantir.github.io/tslint/>`_
- `ESLint <https://eslint.org/>`_
- `stylelint <https://stylelint.io/>`_

We added 2 npm scripts to help run these tools:
Expand Down
87 changes: 87 additions & 0 deletions src/pybind/mgr/dashboard/frontend/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
{
"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"
}
}
]
}
133 changes: 105 additions & 28 deletions src/pybind/mgr/dashboard/frontend/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,59 @@
"projects": {
"ceph-dashboard": {
"i18n": {
"sourceLocale": { "code": "en-US", "baseHref": "" },
"sourceLocale": {
"code": "en-US",
"baseHref": ""
},
"locales": {
"cs": { "translation": "src/locale/messages.cs.xlf", "baseHref": "" },
"de": { "translation": "src/locale/messages.de-DE.xlf", "baseHref": "" },
"es": { "translation": "src/locale/messages.es-ES.xlf", "baseHref": "" },
"fr": { "translation": "src/locale/messages.fr-FR.xlf", "baseHref": "" },
"id": { "translation": "src/locale/messages.id-ID.xlf", "baseHref": "" },
"it": { "translation": "src/locale/messages.it-IT.xlf", "baseHref": "" },
"ja": { "translation": "src/locale/messages.ja-JP.xlf", "baseHref": "" },
"ko": { "translation": "src/locale/messages.ko-KR.xlf", "baseHref": "" },
"pl": { "translation": "src/locale/messages.pl-PL.xlf", "baseHref": "" },
"pt": { "translation": "src/locale/messages.pt-BR.xlf", "baseHref": "" },
"zh-Hans": { "translation": "src/locale/messages.zh-CN.xlf", "baseHref": "" },
"zh-Hant": { "translation": "src/locale/messages.zh-TW.xlf", "baseHref": "" }
"cs": {
"translation": "src/locale/messages.cs.xlf",
"baseHref": ""
},
"de": {
"translation": "src/locale/messages.de-DE.xlf",
"baseHref": ""
},
"es": {
"translation": "src/locale/messages.es-ES.xlf",
"baseHref": ""
},
"fr": {
"translation": "src/locale/messages.fr-FR.xlf",
"baseHref": ""
},
"id": {
"translation": "src/locale/messages.id-ID.xlf",
"baseHref": ""
},
"it": {
"translation": "src/locale/messages.it-IT.xlf",
"baseHref": ""
},
"ja": {
"translation": "src/locale/messages.ja-JP.xlf",
"baseHref": ""
},
"ko": {
"translation": "src/locale/messages.ko-KR.xlf",
"baseHref": ""
},
"pl": {
"translation": "src/locale/messages.pl-PL.xlf",
"baseHref": ""
},
"pt": {
"translation": "src/locale/messages.pt-BR.xlf",
"baseHref": ""
},
"zh-Hans": {
"translation": "src/locale/messages.zh-CN.xlf",
"baseHref": ""
},
"zh-Hant": {
"translation": "src/locale/messages.zh-TW.xlf",
"baseHref": ""
}
}
},
"root": "",
Expand Down Expand Up @@ -60,7 +99,9 @@
"node_modules/ngx-toastr/toastr.css",
"src/styles.scss"
],
"scripts": ["node_modules/chart.js/dist/Chart.bundle.js"],
"scripts": [
"node_modules/chart.js/dist/Chart.bundle.js"
],
"stylePreprocessorOptions": {
"includePaths": [
"src"
Expand Down Expand Up @@ -96,43 +137,69 @@
]
},
"cs": {
"localize": ["cs"]
"localize": [
"cs"
]
},
"de": {
"localize": ["de"]
"localize": [
"de"
]
},
"en-US": {
"localize": ["en-US"]
"localize": [
"en-US"
]
},
"es": {
"localize": ["es"]
"localize": [
"es"
]
},
"fr": {
"localize": ["fr"]
"localize": [
"fr"
]
},
"id": {
"localize": ["id"]
"localize": [
"id"
]
},
"it": {
"localize": ["it"]
"localize": [
"it"
]
},
"ja": {
"localize": ["ja"]
"localize": [
"ja"
]
},
"ko": {
"localize": ["ko"]
"localize": [
"ko"
]
},
"pl": {
"localize": ["pl"]
"localize": [
"pl"
]
},
"pt": {
"localize": ["pt"]
"localize": [
"pt"
]
},
"zh-Hans": {
"localize": ["zh-Hans"]
"localize": [
"zh-Hans"
]
},
"zh-Hant": {
"localize": ["zh-Hant"]
"localize": [
"zh-Hant"
]
}
},
"defaultConfiguration": ""
Expand Down Expand Up @@ -193,6 +260,15 @@
"options": {
"browserTarget": "ceph-dashboard:build"
}
},
"lint": {
"builder": "@angular-eslint/builder:lint",
"options": {
"lintFilePatterns": [
"src/**/*.ts",
"src/**/*.html"
]
}
}
},
"cli": {}
Expand All @@ -209,6 +285,7 @@
}
},
"cli": {
"analytics": false
"analytics": false,
"defaultCollection": "@angular-eslint/schematics"
}
}
Loading

0 comments on commit 31a0a4f

Please sign in to comment.