Skip to content

Commit 1ddbcd0

Browse files
committed
refactor: Lint with rxjs linter and stylelint
1 parent eeea39f commit 1ddbcd0

File tree

229 files changed

+3546
-14653
lines changed

Some content is hidden

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

229 files changed

+3546
-14653
lines changed

.eslintrc.json

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@
1818
"extends": [
1919
"plugin:@angular-eslint/recommended",
2020
"plugin:@angular-eslint/template/process-inline-templates",
21-
"plugin:prettier/recommended"
21+
"plugin:prettier/recommended",
22+
"plugin:rxjs/recommended"
2223
],
24+
"plugins": ["rxjs","rxjs-angular"],
2325
"rules": {
2426
"@angular-eslint/component-selector": [
2527
"error",
@@ -36,7 +38,13 @@
3638
"style": "camelCase",
3739
"type": "attribute"
3840
}
39-
]
41+
],
42+
"rxjs-angular/prefer-async-pipe": "off",
43+
"rxjs-angular/prefer-composition": "off",
44+
"rxjs-angular/prefer-takeuntil": "off",
45+
"rxjs/finnish": "error",
46+
"rxjs/no-compat": "error",
47+
"rxjs/no-sharereplay": "off"
4048
}
4149
},
4250
{

.gitlab-ci.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ build:
2121
- node_modules/
2222
script:
2323
- npm ci
24-
- ./node_modules/.bin/ng lint
24+
- npx ng lint
25+
- npx stylelint "src/**/*.scss"
2526
- sonar-scanner -Dsonar.login=$SONAR_TOKEN
2627
- ./node_modules/.bin/ng build --configuration production --no-progress --base-href=/ --extra-webpack-config webpack.extra.js
2728
- npx semantic-release

.stylelintrc.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"extends": [
3+
"stylelint-config-standard",
4+
"stylelint-config-prettier",
5+
"stylelint-config-standard-scss",
6+
"stylelint-config-prettier-scss"
7+
],
8+
"rules": {
9+
"no-descending-specificity": null
10+
}
11+
}

package-lock.json

Lines changed: 1591 additions & 13138 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,12 @@
7676
"@types/leaflet": "^1.9.0",
7777
"@types/node": "^18.11.10",
7878
"@typescript-eslint/eslint-plugin": "^5.45.0",
79-
"@typescript-eslint/parser": "^5.45.0",
79+
"@typescript-eslint/parser": "^5.50.0",
8080
"eslint": "^8.29.0",
8181
"eslint-config-prettier": "^8.5.0",
8282
"eslint-plugin-prettier": "^4.2.1",
83+
"eslint-plugin-rxjs": "^5.0.2",
84+
"eslint-plugin-rxjs-angular": "^2.0.0",
8385
"google-protobuf": "^3.21.2",
8486
"grpc-web": "^1.4.2",
8587
"html-comment-regex": "^1.1.2",
@@ -88,6 +90,11 @@
8890
"prettier": "^2.8.1",
8991
"prettier-eslint": "^15.0.1",
9092
"showdown": "^2.1.0",
93+
"stylelint": "^14.16.1",
94+
"stylelint-config-prettier": "^9.0.4",
95+
"stylelint-config-prettier-scss": "^0.0.1",
96+
"stylelint-config-standard": "^29.0.0",
97+
"stylelint-config-standard-scss": "^6.1.0",
9198
"ts-node": "^10.9.1",
9299
"webpack": "^5.73.0",
93100
"webpack-bundle-analyzer": "^4.7.0",

src/app/about/about.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ export class AboutComponent implements OnInit {
9797
ids.push(about.beTranslator);
9898
ids.push(about.ptBrTranslator);
9999

100-
return this.userService.getUserMap(ids).pipe(
100+
return this.userService.getUserMap$(ids).pipe(
101101
map((users) => ({
102102
users,
103103
aboutText,

src/app/account/accounts/accounts.component.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ export class AccountAccountsComponent implements OnInit {
2929
next: (response) => {
3030
this.accounts = response.items;
3131
},
32-
error: (response) => {
33-
this.toastService.response(response);
32+
error: (response: unknown) => {
33+
this.toastService.handleError(response);
3434
},
3535
});
3636
}
@@ -51,8 +51,8 @@ export class AccountAccountsComponent implements OnInit {
5151
next: (response) => {
5252
window.location.href = response.url;
5353
},
54-
error: (response) => {
55-
this.toastService.response(response);
54+
error: (response: unknown) => {
55+
this.toastService.handleError(response);
5656
},
5757
});
5858
}
@@ -64,9 +64,9 @@ export class AccountAccountsComponent implements OnInit {
6464

6565
this.load();
6666
},
67-
error: (response) => {
67+
error: (response: unknown) => {
6868
this.disconnectFailed = true;
69-
this.toastService.response(response);
69+
this.toastService.handleError(response);
7070
},
7171
});
7272
}

src/app/account/contacts/contacts.component.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export class AccountContactsComponent {
2929
setTimeout(() => this.pageEnv.set({pageId: 198}), 0);
3030

3131
this.auth
32-
.getUser()
32+
.getUser$()
3333
.pipe(
3434
map((user) => {
3535
if (!user) {
@@ -42,7 +42,7 @@ export class AccountContactsComponent {
4242
return user;
4343
}),
4444
switchMap(() =>
45-
this.contactsService.getContacts({
45+
this.contactsService.getContacts$({
4646
fields: ['avatar', 'gravatar', 'last_online'],
4747
})
4848
)
@@ -51,22 +51,22 @@ export class AccountContactsComponent {
5151
next: (response) => {
5252
this.items = response.items;
5353
},
54-
error: (response) => this.toastService.response(response),
54+
error: (response: unknown) => this.toastService.handleError(response),
5555
});
5656
}
5757

5858
public deleteContact(id: string) {
59-
this.contacts.deleteContact(new DeleteContactRequest({userId: id})).subscribe(
60-
() => {
59+
this.contacts.deleteContact(new DeleteContactRequest({userId: id})).subscribe({
60+
next: () => {
6161
for (let i = 0; i < this.items.length; i++) {
6262
if (this.items[i].contactUserId === id) {
6363
this.items.splice(i, 1);
6464
break;
6565
}
6666
}
6767
},
68-
(response) => this.toastService.response(response)
69-
);
68+
error: (response: unknown) => this.toastService.handleError(response),
69+
});
7070
return false;
7171
}
7272
}

src/app/account/delete/delete.component.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {APIDeleteUserRequest} from '@grpc/spec.pb';
88
import {extractFieldViolations, fieldViolations2InvalidParams} from '../../grpc';
99
import {InvalidParams} from '../../utils/invalid-params.pipe';
1010
import {switchMap} from 'rxjs/operators';
11+
import {GrpcStatusEvent} from '@ngx-grpc/common';
1112

1213
@Component({
1314
selector: 'app-account-delete',
@@ -31,7 +32,7 @@ export class AccountDeleteComponent {
3132

3233
public submit() {
3334
this.auth
34-
.getUser()
35+
.getUser$()
3536
.pipe(
3637
switchMap((user) =>
3738
this.usersGrpc.deleteUser(
@@ -44,12 +45,12 @@ export class AccountDeleteComponent {
4445
)
4546
.subscribe({
4647
next: () => {
47-
this.auth.signOut();
48+
this.auth.signOut$();
4849
this.router.navigate(['/account/delete/deleted']);
4950
},
50-
error: (response) => {
51-
this.toastService.grpcErrorResponse(response);
52-
if (response.statusCode === 3) {
51+
error: (response: unknown) => {
52+
this.toastService.handleError(response);
53+
if (response instanceof GrpcStatusEvent && response.statusCode === 3) {
5354
const fieldViolations = extractFieldViolations(response);
5455
this.invalidParams = fieldViolations2InvalidParams(fieldViolations);
5556
}

src/app/account/email/email.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export class AccountEmailComponent {
2121
next: (response) => {
2222
this.email = response.email;
2323
},
24-
error: (response) => this.toastService.response(response),
24+
error: (response: unknown) => this.toastService.handleError(response),
2525
});
2626
}
2727
}

0 commit comments

Comments
 (0)