Skip to content

Commit

Permalink
feat(eslint): migrate tslint to eslint (DSP-1372) (#394)
Browse files Browse the repository at this point in the history
* 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 6ffc3b6
Show file tree
Hide file tree
Showing 105 changed files with 3,581 additions and 1,352 deletions.
11 changes: 11 additions & 0 deletions .eslintignore
@@ -0,0 +1,11 @@
# Ignore miscellaneous folders
.github/
.idea/
.vscode/
.yalc/
node_modules/
dist/
tmp/

# Ignore certain project files
docs/assets/js/
201 changes: 201 additions & 0 deletions .eslintrc.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": [
"/"
]
}
]
}
};
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Expand Up @@ -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
Expand Down
10 changes: 6 additions & 4 deletions docs/how-to-contribute/index.md
Expand Up @@ -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

Expand Down

0 comments on commit 6ffc3b6

Please sign in to comment.