Skip to content

Commit 6ffc3b6

Browse files
authored
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
1 parent b4f101b commit 6ffc3b6

105 files changed

Lines changed: 3581 additions & 1352 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.eslintignore‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Ignore miscellaneous folders
2+
.github/
3+
.idea/
4+
.vscode/
5+
.yalc/
6+
node_modules/
7+
dist/
8+
tmp/
9+
10+
# Ignore certain project files
11+
docs/assets/js/

‎.eslintrc.js‎

Lines changed: 201 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,201 @@
1+
/*
2+
👋 Hi! This file was autogenerated by tslint-to-eslint-config.
3+
https://github.com/typescript-eslint/tslint-to-eslint-config
4+
5+
It represents the closest reasonable ESLint configuration to this
6+
project's original TSLint configuration.
7+
8+
We recommend eventually switching this configuration to extend from
9+
the recommended rulesets in typescript-eslint.
10+
https://github.com/typescript-eslint/tslint-to-eslint-config/blob/master/docs/FAQs.md
11+
12+
Happy linting! 💖
13+
*/
14+
module.exports = {
15+
"env": {
16+
"browser": true,
17+
"es6": true,
18+
"node": true
19+
},
20+
"parser": "@typescript-eslint/parser",
21+
"parserOptions": {
22+
"project": "tsconfig.eslint.json",
23+
"sourceType": "module"
24+
},
25+
"plugins": [
26+
"eslint-plugin-import",
27+
"eslint-plugin-jsdoc",
28+
"@angular-eslint/eslint-plugin",
29+
"@typescript-eslint"
30+
],
31+
"rules": {
32+
"@angular-eslint/component-class-suffix": "error",
33+
"@angular-eslint/directive-class-suffix": "error",
34+
"@angular-eslint/no-host-metadata-property": "error",
35+
"@angular-eslint/no-input-rename": "error",
36+
"@angular-eslint/no-inputs-metadata-property": "error",
37+
"@angular-eslint/no-output-on-prefix": "error",
38+
"@angular-eslint/no-output-rename": "error",
39+
"@angular-eslint/no-outputs-metadata-property": "error",
40+
"@angular-eslint/use-lifecycle-interface": "error",
41+
"@angular-eslint/use-pipe-transform-interface": "error",
42+
"@typescript-eslint/consistent-type-definitions": "error",
43+
"@typescript-eslint/dot-notation": "off",
44+
"@typescript-eslint/explicit-member-accessibility": [
45+
"off",
46+
{
47+
"accessibility": "explicit"
48+
}
49+
],
50+
"@typescript-eslint/indent": "error",
51+
"@typescript-eslint/member-delimiter-style": [
52+
"error",
53+
{
54+
"multiline": {
55+
"delimiter": "semi",
56+
"requireLast": true
57+
},
58+
"singleline": {
59+
"delimiter": "semi",
60+
"requireLast": false
61+
}
62+
}
63+
],
64+
"@typescript-eslint/member-ordering": "error",
65+
"@typescript-eslint/naming-convention": [
66+
"error",
67+
{
68+
"selector": ["default"],
69+
"format": ["camelCase", "PascalCase", "UPPER_CASE"],
70+
"leadingUnderscore": "allow",
71+
"trailingUnderscore": "allow"
72+
},
73+
{
74+
"selector": ["classProperty", "classMethod"],
75+
"modifiers": ["private"],
76+
"format": ["camelCase"],
77+
"leadingUnderscore": "require"
78+
},
79+
{
80+
"selector": ["classProperty"],
81+
"modifiers": ["readonly"],
82+
"format": ["UPPER_CASE"],
83+
"trailingUnderscore": "allow"
84+
}
85+
],
86+
"@typescript-eslint/no-empty-function": "off",
87+
"@typescript-eslint/no-empty-interface": "error",
88+
"@typescript-eslint/no-inferrable-types": [
89+
"error",
90+
{
91+
"ignoreParameters": true
92+
}
93+
],
94+
"@typescript-eslint/no-misused-new": "error",
95+
"@typescript-eslint/no-non-null-assertion": "error",
96+
"@typescript-eslint/no-shadow": [
97+
"error",
98+
{
99+
"hoist": "all"
100+
}
101+
],
102+
"@typescript-eslint/no-unused-expressions": "error",
103+
"@typescript-eslint/no-use-before-define": "error",
104+
"@typescript-eslint/prefer-function-type": "error",
105+
"@typescript-eslint/quotes": [
106+
"error",
107+
"single",
108+
{
109+
"avoidEscape": true
110+
}
111+
],
112+
"@typescript-eslint/semi": [
113+
"error",
114+
"always"
115+
],
116+
"@typescript-eslint/type-annotation-spacing": "error",
117+
"@typescript-eslint/unified-signatures": "error",
118+
"arrow-body-style": "error",
119+
"brace-style": [
120+
"error",
121+
"1tbs"
122+
],
123+
"capitalized-comments": [
124+
"error",
125+
"never"
126+
],
127+
"constructor-super": "error",
128+
"curly": "error",
129+
"object-curly-spacing": [
130+
"error",
131+
"always"
132+
],
133+
"eol-last": "error",
134+
"eqeqeq": [
135+
"error",
136+
"smart"
137+
],
138+
"guard-for-in": "error",
139+
"id-blacklist": "off",
140+
"id-match": "off",
141+
"import/no-deprecated": "warn",
142+
"jsdoc/no-types": "off",
143+
"max-len": [
144+
"error",
145+
{
146+
"code": 200
147+
}
148+
],
149+
"no-bitwise": "error",
150+
"no-caller": "error",
151+
"no-console": [
152+
"warn",
153+
{
154+
"allow": [
155+
"dir",
156+
"timeLog",
157+
"assert",
158+
"clear",
159+
"count",
160+
"countReset",
161+
"group",
162+
"groupEnd",
163+
"table",
164+
"dirxml",
165+
"groupCollapsed",
166+
"Console",
167+
"profile",
168+
"profileEnd",
169+
"timeStamp",
170+
"context"
171+
]
172+
}
173+
],
174+
"no-debugger": "error",
175+
"no-empty": "off",
176+
"no-eval": "error",
177+
"no-fallthrough": "error",
178+
"no-new-wrappers": "error",
179+
"no-restricted-imports": [
180+
"error",
181+
"rxjs/Rx"
182+
],
183+
"no-throw-literal": "error",
184+
"no-trailing-spaces": "error",
185+
"no-undef-init": "error",
186+
"no-underscore-dangle": "off",
187+
"no-unused-labels": "error",
188+
"no-var": "error",
189+
"prefer-const": "error",
190+
"radix": "error",
191+
"spaced-comment": [
192+
"error",
193+
"always",
194+
{
195+
"markers": [
196+
"/"
197+
]
198+
}
199+
]
200+
}
201+
};

‎.github/workflows/main.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
npm run webdriver-update
3232
npm run test-e2e-protractor
3333
- name: Run lint
34-
run: npm run lint
34+
run: npm run lint-ci
3535

3636
release-please:
3737
name: Prepare next release

‎docs/how-to-contribute/index.md‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,13 @@ Run `npm run test-e2e-protractor` to execute the end-to-end tests via [Protracto
3030

3131
### Running code linter
3232

33-
Run `npm run lint` to execute the lint service via [tslint](https://palantir.github.io/tslint/).
33+
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`.
3434

35-
> :warning: **tslint is deprecated and will be replaced by eslint**
36-
>
37-
> Get more info here: <https://dasch.myjetbrains.com/youtrack/issue/DSP-1260>
35+
To integrate ESLint with Visual Studio Code, do the following:
36+
37+
* Install the [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) extension.
38+
* Create a task via the **Tasks: Configure Task** command and select `npm: lint-local`.
39+
* In the resulting `tasks.json` file, configure the problem matcher to be `$eslint-stylish`.
3840

3941
## Further help
4042

0 commit comments

Comments
 (0)