Skip to content
Permalink
Browse files
feat(eslint): migrate tslint to eslint (DSP-1372) (#394)
* test(eslint): migrate from tslint to eslint

* chore(eslint): two commands to run lint tool

* refactor(eslint): automatically fixed errors by esLint rules

* refactor(user): refactor code by following ESLint rules

* refactor(user): refactor code by following ESLint rules

* refactor(main): refactor code by following ESLint rules

* refactor(user): refactor code by following ESLint rules

* refactor(comments): undo ugly tODO comment but still following esLint rules

* refactor(ontology): refactor code by following ESLint rules

* refactor(ontology): refactor code by following ESLint rules

* refactor(ontology-visualizer): refactor code by following ESLint rules

* refactor(ontology): refactor code by following ESLint rules

* refactor(permission): refactor code by following ESLint rules

* refactor(system): refactor code by following ESLint rules

* refactor(user): refactor code by following ESLint rules

* refactor(main): refactor code by following ESLint rules

* refactor(project): refactor code by following ESLint rules

* refactor(system): refactor code by following ESLint rules

* refactor(project): refactor code by following ESLint rules

* refactor(user): refactor code by following ESLint rules

* test(ontology): bug fix in res class form service

* chore(gh-ci): use new eslint

* docs(contribution): update linter section with new eslint config

* refactor(tests): delete tslint

* refactor(ontology): refactor code by following ESLint rules

* fix(deps): delete tslint

* refactor(eslint): delete empty tslint-to-eslint log file

* fix(deps): reactivate eslint-plugin tslint

* docs(contribution): update linter section with new eslint config

* fix(eslint): reactivate old tslint config

* fix(eslint): delete old tslint config rules

* refactor(eslint): delete old tslint config files

* chore(eslint): update eslint config

* chore(eslint): update eslint config

* refactor(ontology): fix eslint issue

* refactor(cache): following our naming convention

* test(eslint): update naming convention rules

* refactor(eslint): delete unused config file

* Update package-lock.json

* refactor: refactor code by following our name conventions

* chore(eslint): disallow console.log and .error

* chore(deps): update package-lock.json

* fix(eslint): bug fixing in eslint config

* refactor: fixed errors from eslint

* chore(eslint): update config

* refactor: undo previous changes

* fix(deps): update package-lock.json

* refactor: refactor code to make eslint happy

* refactor(eslint): delete redundant config

* chore(deps): update package-lock.json

* chore(eslint): fixed eslint issue automatically

* chore(eslint): strict rule for spaces in objects

Set eslint rule for https://docs.google.com/document/d/1SIVMxoV0N8xYqhVk_0hhuqSuUF47D1YYrDESqdmipfM/edit#heading=h.awf6ef8h98ze
  • Loading branch information
kilchenmann committed Mar 4, 2021
1 parent b4f101b commit 6ffc3b6b8803ddf0e47a1f921ff85b7881f027d2
Showing with 3,581 additions and 1,352 deletions.
  1. +11 −0 .eslintignore
  2. +201 −0 .eslintrc.js
  3. +1 −1 .github/workflows/main.yml
  4. +6 −4 docs/how-to-contribute/index.md
  5. +2,541 −380 package-lock.json
  6. +9 −3 package.json
  7. +1 −1 src/app/app.component.ts
  8. +3 −5 src/app/app.module.ts
  9. +27 −27 src/app/main/cache/cache.service.ts
  10. +9 −9 src/app/main/cookie-policy/cookie-policy.component.ts
  11. +9 −9 src/app/main/dialog/dialog-header/dialog-header.component.ts
  12. +1 −1 src/app/main/dialog/dialog.component.ts
  13. +31 −32 src/app/main/directive/base-value.directive.ts
  14. +3 −3 src/app/main/directive/external-links.directive.ts
  15. +1 −1 src/app/main/directive/invalid-control-scroll.directive.spec.ts
  16. +4 −4 src/app/main/directive/invalid-control-scroll.directive.ts
  17. +2 −2 src/app/main/error/error.component.ts
  18. +22 −22 src/app/main/grid/grid.component.spec.ts
  19. +2 −2 src/app/main/header/header.component.spec.ts
  20. +6 −6 src/app/main/header/header.component.ts
  21. +1 −1 src/app/main/login/login.component.ts
  22. +21 −13 src/app/main/main.component.spec.ts
  23. +4 −4 src/app/main/main.component.ts
  24. +7 −7 src/app/main/select-language/language.service.spec.ts
  25. +8 −8 src/app/main/select-language/language.service.ts
  26. +8 −8 src/app/main/services/component-communication-event.service.spec.ts
  27. +3 −3 src/app/main/services/component-communication-event.service.ts
  28. +2 −6 src/app/project/board/board.component.spec.ts
  29. +6 −6 src/app/project/board/board.component.ts
  30. +3 −3 src/app/project/board/contacts-tab-view/contacts-tab-view.component.spec.ts
  31. +3 −4 src/app/project/board/dataset-tab-view/dataset-tab-view.component.spec.ts
  32. +5 −5 src/app/project/board/person-template/person-template.component.spec.ts
  33. +17 −17 src/app/project/board/project-tab-view/project-tab-view.component.spec.ts
  34. +1 −2 src/app/project/board/project-tab-view/project-tab-view.component.ts
  35. +2 −2 src/app/project/board/terms-tab-view/terms-tab-view.component.spec.ts
  36. +9 −9 src/app/project/collaboration/add-user/add-user.component.ts
  37. +2 −6 src/app/project/collaboration/collaboration.component.spec.ts
  38. +5 −5 src/app/project/collaboration/collaboration.component.ts
  39. +9 −8 src/app/project/collaboration/select-group/select-group.component.ts
  40. +4 −3 src/app/project/list/list-info-form/list-info-form.component.ts
  41. +26 −26 src/app/project/list/list-item-form/edit-list-item/edit-list-item.component.spec.ts
  42. +16 −11 src/app/project/list/list-item-form/edit-list-item/edit-list-item.component.ts
  43. +4 −4 src/app/project/list/list-item-form/list-item-form.component.spec.ts
  44. +24 −24 src/app/project/list/list-item-form/list-item-form.component.ts
  45. +53 −53 src/app/project/list/list-item/list-item.component.spec.ts
  46. +3 −3 src/app/project/list/list-item/list-item.component.ts
  47. +20 −20 src/app/project/list/list.component.spec.ts
  48. +3 −3 src/app/project/list/list.component.ts
  49. +19 −19 src/app/project/ontology/default-data/default-properties.ts
  50. +4 −3 src/app/project/ontology/ontology-form/ontology-form.component.ts
  51. +13 −13 src/app/project/ontology/ontology-visualizer/ontology-visualizer.component.spec.ts
  52. +9 −9 src/app/project/ontology/ontology-visualizer/ontology-visualizer.component.ts
  53. +2 −2 src/app/project/ontology/ontology-visualizer/visualizer/visualizer.component.html
  54. +18 −18 src/app/project/ontology/ontology-visualizer/visualizer/visualizer.component.spec.ts
  55. +13 −13 src/app/project/ontology/ontology-visualizer/visualizer/visualizer.component.ts
  56. +2 −6 src/app/project/ontology/ontology.component.spec.ts
  57. +9 −9 src/app/project/ontology/ontology.component.ts
  58. +3 −3 src/app/project/ontology/property-form/property-form.component.html
  59. +5 −5 src/app/project/ontology/property-form/property-form.component.ts
  60. +6 −6 src/app/project/ontology/property-info/property-info.component.spec.ts
  61. +2 −2 src/app/project/ontology/property-info/property-info.component.ts
  62. +16 −15 src/app/project/ontology/resource-class-form/resource-class-form.component.ts
  63. +7 −6 src/app/project/ontology/resource-class-form/resource-class-form.service.ts
  64. +1 −1 src/app/project/ontology/resource-class-info/resource-class-info.component.spec.ts
  65. +16 −16 src/app/project/permission/add-group/add-group.component.spec.ts
  66. +10 −10 src/app/project/permission/add-group/add-group.component.ts
  67. +2 −6 src/app/project/permission/permission.component.spec.ts
  68. +4 −3 src/app/project/permission/permission.component.ts
  69. +13 −13 src/app/project/project-form/project-form.component.ts
  70. +6 −6 src/app/project/project.component.ts
  71. +7 −7 src/app/system/groups/groups.component.ts
  72. +2 −6 src/app/system/projects/projects-list/projects-list.component.spec.ts
  73. +17 −16 src/app/system/projects/projects-list/projects-list.component.ts
  74. +6 −6 src/app/system/projects/projects.component.ts
  75. +2 −6 src/app/system/system.component.spec.ts
  76. +2 −2 src/app/system/system.component.ts
  77. +2 −6 src/app/system/users/users-list/users-list.component.spec.ts
  78. +12 −11 src/app/system/users/users-list/users-list.component.ts
  79. +4 −4 src/app/user/account/account.component.ts
  80. +1 −1 src/app/user/collection-list/collection-list.component.ts
  81. +2 −6 src/app/user/dashboard/dashboard.component.spec.ts
  82. +2 −2 src/app/user/dashboard/dashboard.component.ts
  83. +6 −6 src/app/user/membership/membership.component.ts
  84. +4 −4 src/app/user/profile/profile.component.ts
  85. +2 −6 src/app/user/user-form/password-form/password-form.component.spec.ts
  86. +16 −13 src/app/user/user-form/password-form/password-form.component.ts
  87. +25 −25 src/app/user/user-form/user-form.component.ts
  88. +2 −6 src/app/user/user-menu/user-menu.component.spec.ts
  89. +1 −1 src/app/user/user-menu/user-menu.component.ts
  90. +2 −6 src/app/user/user.component.spec.ts
  91. +1 −1 src/app/user/user.component.ts
  92. +15 −15 src/app/workspace/resource/resource-instance-form/resource-instance-form.component.spec.ts
  93. +8 −8 src/app/workspace/resource/resource-instance-form/resource-instance-form.component.ts
  94. +9 −9 src/app/workspace/resource/resource-instance-form/select-ontology/select-ontology.component.spec.ts
  95. +3 −3 src/app/workspace/resource/resource-instance-form/select-ontology/select-ontology.component.ts
  96. +9 −9 src/app/workspace/resource/resource-instance-form/select-project/select-project.component.spec.ts
  97. +4 −4 ...p/workspace/resource/resource-instance-form/select-properties/select-properties.component.spec.ts
  98. +20 −14 src/app/workspace/resource/resource-instance-form/select-properties/select-properties.component.ts
  99. +9 −9 ...ce/resource-instance-form/select-properties/switch-properties/switch-properties.component.spec.ts
  100. +3 −3 ...esource/resource-instance-form/select-properties/switch-properties/switch-properties.component.ts
  101. +14 −14 ...ace/resource/resource-instance-form/select-resource-class/select-resource-class.component.spec.ts
  102. +0 −22 src/tslint.json
  103. +8 −0 tsconfig.eslint.json
  104. +22 −0 tslint-to-eslint-config.log
  105. +0 −141 tslint.json
@@ -0,0 +1,11 @@
# Ignore miscellaneous folders
.github/
.idea/
.vscode/
.yalc/
node_modules/
dist/
tmp/

# Ignore certain project files
docs/assets/js/
@@ -0,0 +1,201 @@
/*
👋 Hi! This file was autogenerated by tslint-to-eslint-config.
https://github.com/typescript-eslint/tslint-to-eslint-config
It represents the closest reasonable ESLint configuration to this
project's original TSLint configuration.
We recommend eventually switching this configuration to extend from
the recommended rulesets in typescript-eslint.
https://github.com/typescript-eslint/tslint-to-eslint-config/blob/master/docs/FAQs.md
Happy linting! 💖
*/
module.exports = {
"env": {
"browser": true,
"es6": true,
"node": true
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "tsconfig.eslint.json",
"sourceType": "module"
},
"plugins": [
"eslint-plugin-import",
"eslint-plugin-jsdoc",
"@angular-eslint/eslint-plugin",
"@typescript-eslint"
],
"rules": {
"@angular-eslint/component-class-suffix": "error",
"@angular-eslint/directive-class-suffix": "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-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",
"@typescript-eslint/consistent-type-definitions": "error",
"@typescript-eslint/dot-notation": "off",
"@typescript-eslint/explicit-member-accessibility": [
"off",
{
"accessibility": "explicit"
}
],
"@typescript-eslint/indent": "error",
"@typescript-eslint/member-delimiter-style": [
"error",
{
"multiline": {
"delimiter": "semi",
"requireLast": true
},
"singleline": {
"delimiter": "semi",
"requireLast": false
}
}
],
"@typescript-eslint/member-ordering": "error",
"@typescript-eslint/naming-convention": [
"error",
{
"selector": ["default"],
"format": ["camelCase", "PascalCase", "UPPER_CASE"],
"leadingUnderscore": "allow",
"trailingUnderscore": "allow"
},
{
"selector": ["classProperty", "classMethod"],
"modifiers": ["private"],
"format": ["camelCase"],
"leadingUnderscore": "require"
},
{
"selector": ["classProperty"],
"modifiers": ["readonly"],
"format": ["UPPER_CASE"],
"trailingUnderscore": "allow"
}
],
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-empty-interface": "error",
"@typescript-eslint/no-inferrable-types": [
"error",
{
"ignoreParameters": true
}
],
"@typescript-eslint/no-misused-new": "error",
"@typescript-eslint/no-non-null-assertion": "error",
"@typescript-eslint/no-shadow": [
"error",
{
"hoist": "all"
}
],
"@typescript-eslint/no-unused-expressions": "error",
"@typescript-eslint/no-use-before-define": "error",
"@typescript-eslint/prefer-function-type": "error",
"@typescript-eslint/quotes": [
"error",
"single",
{
"avoidEscape": true
}
],
"@typescript-eslint/semi": [
"error",
"always"
],
"@typescript-eslint/type-annotation-spacing": "error",
"@typescript-eslint/unified-signatures": "error",
"arrow-body-style": "error",
"brace-style": [
"error",
"1tbs"
],
"capitalized-comments": [
"error",
"never"
],
"constructor-super": "error",
"curly": "error",
"object-curly-spacing": [
"error",
"always"
],
"eol-last": "error",
"eqeqeq": [
"error",
"smart"
],
"guard-for-in": "error",
"id-blacklist": "off",
"id-match": "off",
"import/no-deprecated": "warn",
"jsdoc/no-types": "off",
"max-len": [
"error",
{
"code": 200
}
],
"no-bitwise": "error",
"no-caller": "error",
"no-console": [
"warn",
{
"allow": [
"dir",
"timeLog",
"assert",
"clear",
"count",
"countReset",
"group",
"groupEnd",
"table",
"dirxml",
"groupCollapsed",
"Console",
"profile",
"profileEnd",
"timeStamp",
"context"
]
}
],
"no-debugger": "error",
"no-empty": "off",
"no-eval": "error",
"no-fallthrough": "error",
"no-new-wrappers": "error",
"no-restricted-imports": [
"error",
"rxjs/Rx"
],
"no-throw-literal": "error",
"no-trailing-spaces": "error",
"no-undef-init": "error",
"no-underscore-dangle": "off",
"no-unused-labels": "error",
"no-var": "error",
"prefer-const": "error",
"radix": "error",
"spaced-comment": [
"error",
"always",
{
"markers": [
"/"
]
}
]
}
};
@@ -31,7 +31,7 @@ jobs:
npm run webdriver-update
npm run test-e2e-protractor
- name: Run lint
run: npm run lint
run: npm run lint-ci

release-please:
name: Prepare next release
@@ -30,11 +30,13 @@ Run `npm run test-e2e-protractor` to execute the end-to-end tests via [Protracto

### Running code linter

Run `npm run lint` to execute the lint service via [tslint](https://palantir.github.io/tslint/).
Run `npm run lint-local` to execute the lint service via [ESLint](https://eslint.org). This command uses the `--fix` flag which fixes simple errors like redundant type if you have default value assigned. In the Github Actions (CI) workflow the linter runs as `npm run lint-ci`.

> :warning: **tslint is deprecated and will be replaced by eslint**
>
> Get more info here: <https://dasch.myjetbrains.com/youtrack/issue/DSP-1260>
To integrate ESLint with Visual Studio Code, do the following:

* Install the [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) extension.
* Create a task via the **Tasks: Configure Task** command and select `npm: lint-local`.
* In the resulting `tasks.json` file, configure the problem matcher to be `$eslint-stylish`.

## Further help

Loading

0 comments on commit 6ffc3b6

Please sign in to comment.