Skip to content

Commit 0dca7d3

Browse files
committed
Fixed eslint
1 parent cc7cb9d commit 0dca7d3

File tree

25 files changed

+106
-79
lines changed

25 files changed

+106
-79
lines changed

.eslintrc.json

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"multiline-ternary": 0,
3636
"new-cap": 0, // babel/new-cap
3737
"array-element-newline": [1, "consistent"],
38-
"comma-dangle": [1, "always-multiline"],
38+
"comma-dangle": 0, // using typescript-eslint/comma-dangle
3939
"function-call-argument-newline": [1, "consistent"],
4040
"max-len": [1, { "code": 120, "ignorePattern": "http?s:\/\/", "ignoreTrailingComments": true}], // override 80 that is too low
4141
"padded-blocks": [1, "never"],
@@ -68,13 +68,23 @@
6868
"enforceConst": true
6969
}
7070
],
71+
"@typescript-eslint/comma-dangle": [1, "always-multiline"],
72+
"@typescript-eslint/method-signature-style": [1, "method"],
73+
"@typescript-eslint/init-declarations": 0, // let a ; try {a = funct()} catch (e) throw e; if a.sdfsd . In this example we can't have instant init
74+
"@typescript-eslint/prefer-readonly-parameter-types": 0, // too many issues, we can't mofidy arguments, we can' use type like number[], because rule @typescript-eslint/array-type
75+
"@typescript-eslint/naming-convention": [1,
76+
{
77+
"selector": "property",
78+
"format": ["PascalCase", "camelCase"] // PascalCase for Vue-property-decorator components: {AppAlert}
79+
}
80+
],
7181
"babel/object-curly-spacing": 1,
7282
"babel/quotes": 1,
7383
"babel/semi": 1,
7484
"babel/no-unused-expressions": 1,
7585
"babel/valid-typeof": 1,
7686
"babel/new-cap": 1,
77-
"babel/camelcase": 1,
87+
"babel/camelcase": 0, // use typescript-eslint/naming-convention
7888
"babel/no-invalid-this": 1,
7989
"import/no-named-as-default": 1, //is not part of default sert
8090
"import/no-unresolved": 0,
@@ -154,21 +164,22 @@
154164
],
155165
"vuetify/grid-unknown-attributes": 1,
156166
"vuetify/no-legacy-grid": 0,
157-
"vuetify/no-deprecated-classes": 1
167+
"vuetify/no-deprecated-classes": 1,
168+
"class-methods-use-this": 0,
169+
"@typescript-eslint/no-unnecessary-condition": 0 // too many times we want to make sure that variable that is not null is present or not. Let's say window.RTPConnection is declaread as non-nullable but we still check it in runtime
158170
},
159171
"overrides": [
160172
{
161173
"files": ["*.vue", "*.d.ts"],
162174
"rules": {
163-
"import/no-default-export": 0,
164-
"class-methods-use-this": 0
175+
"import/no-default-export": 0
176+
165177
}
166178
},
167179
{
168180
"files": ["*.vue"],
169181
"rules": {
170182
"@typescript-eslint/prefer-readonly": 0, // can be used in template
171-
"class-methods-use-this": 0,
172183
"import/unambiguous": 0 // vue SFC can miss script tags
173184
}
174185
}

cypress/integration/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
declare namespace Cypress {
1+
declare namespace Cypress { // eslint-disable-line @typescript-eslint/no-unused-vars
22
interface cy {
33

44
/**

cypress/integration/pages/branches.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ describe("Branches page", (): void => {
2828
cy.visit("/branches");
2929
cy.get("[data-cy=hamburger-icon]").click();
3030
cy.contains("Home").click();
31-
cy.url().should("eq", `${Cypress.config().baseUrl}/`);
31+
cy.url().should("eq", `${String(Cypress.config().baseUrl)}/`);
3232
cy.get("[data-cy=hamburger-icon]").click();
3333
cy.contains("Branches").click();
3434
cy.assertCalledTimes("get-branches", 1);

cypress/integration/unit/xhr.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@ describe("Xhr", (): void => {
9797
url: "/test",
9898
});
9999
cy.get("@test-get").should((req: JQuery) => {
100-
// @ts-ignore next-line
100+
// @ts-expect-error
101+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
101102
expect(req.request.headers).to.include({"app-version": "app-v1"});
102103
});
103104
});
@@ -120,7 +121,8 @@ describe("Xhr", (): void => {
120121
url: "/test",
121122
});
122123
cy.get("@test-get").should((req: JQuery) => {
123-
// @ts-ignore next-line
124+
// @ts-expect-error
125+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
124126
expect(req.request.body).to.be.deep.eq({aa: 1});
125127
});
126128
});

src/components/App.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,17 @@
1515
<script lang="ts">
1616
import {AlertsState, alertsModule} from "@/store/modules/alerts";
1717
import {Component, Vue} from "vue-property-decorator";
18-
import {AlertModel} from "@/types/model";
18+
import type {AlertModel} from "@/types/model";
1919
import AppAlert from "@/components/ui/AppAlert.vue";
2020
2121
@Component({
2222
components: {AppAlert},
2323
})
2424
export default class App extends Vue {
2525
@AlertsState
26-
public alerts!: AlertModel[];
26+
public readonly alerts!: AlertModel[];
2727
28-
private close(alert: AlertModel): void {
28+
private close(alert: Readonly<AlertModel>): void {
2929
alertsModule.removeAlert(alert);
3030
}
3131
}

src/components/pages/RepoBranchesPage.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@
2626
<script lang="ts">
2727
import {Component, Vue} from "vue-property-decorator";
2828
import {GithubState, githubModule} from "@/store/modules/github";
29-
import {Branch} from "@/types/model";
30-
import ResourceLoader from "@/components/ui/ResourceLoader.vue";
29+
import type {Branch} from "@/types/model";
3130
import {ResolveHandler} from "@/utils/decorators";
31+
import ResourceLoader from "@/components/ui/ResourceLoader.vue";
3232
3333
/**
3434
* Represent list of github repositories

src/components/pages/RepoCommitPage.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@
2525

2626
<script lang="ts">
2727
import {Component, Prop, Vue} from "vue-property-decorator";
28-
import {CommitResponse} from "@/types/gitCommit";
29-
import ResourceLoader from "@/components/ui/ResourceLoader.vue";
28+
import type {CommitResponse} from "@/types/gitCommit";
3029
import {ResolveHandler} from "@/utils/decorators";
30+
import ResourceLoader from "@/components/ui/ResourceLoader.vue";
31+
3132
@Component({
3233
components: {ResourceLoader},
3334
})

src/components/ui/AppAlert.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
<script lang="ts">
1414
import {Component, Emit, Prop, Vue} from "vue-property-decorator";
15-
import {AlertModel} from "@/types/model";
15+
import type {AlertModel} from "@/types/model";
1616
1717
@Component
1818
export default class AppAlert extends Vue {

src/components/ui/ResourceLoader.vue

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
</template>
1414
<script lang="ts">
1515
import {Component, Prop, Vue} from "vue-property-decorator";
16-
import {AlertModel} from "@/types/model";
16+
import type {AlertModel} from "@/types/model";
1717
import AppAlert from "@/components/ui/AppAlert.vue";
1818
import {HandleLoading} from "vuex-module-decorators-state";
1919
@@ -49,21 +49,21 @@ import {HandleLoading} from "vuex-module-decorators-state";
4949
components: {AppAlert},
5050
})
5151
export default class ResourceLoader extends Vue {
52-
public serverError: AlertModel|null = null;
53-
54-
public loading: boolean = false;
55-
5652
@Prop({
5753
default: "Loading",
5854
})
5955
public readonly loadingTitle!: string;
6056
57+
public serverError: AlertModel|null = null;
58+
59+
public loading: boolean = false;
60+
6161
@HandleLoading({
6262
errPropNameOrCB: "serverError",
6363
loadingPropName: "loading",
6464
})
6565
private async created(): Promise<void> {
66-
await new Promise((resolve: Function, reject: Function) => {
66+
await new Promise((resolve: () => void, reject: () => void) => {
6767
this.$emit("load", {
6868
reject,
6969
resolve,

src/components/ui/SubmitForm.vue

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,8 @@
2121
</template>
2222
<script lang="ts">
2323
import {Component, Emit, Prop, Ref, Vue} from "vue-property-decorator";
24-
import {AlertModel} from "@/types/model";
24+
import type {AlertModel} from "@/types/model";
2525
import AppAlert from "@/components/ui/AppAlert.vue";
26-
import {ResolveHandler} from "@/utils/decorators";
2726
import {HandleLoading} from "vuex-module-decorators-state";
2827
2928
/**
@@ -59,12 +58,6 @@ import {HandleLoading} from "vuex-module-decorators-state";
5958
components: {AppAlert},
6059
})
6160
export default class SubmitForm extends Vue {
62-
public serverError: AlertModel|null = null;
63-
64-
public loading: boolean = false;
65-
66-
public valid: boolean = false;
67-
6861
@Prop()
6962
public readonly value!: boolean;
7063
@@ -74,6 +67,12 @@ export default class SubmitForm extends Vue {
7467
@Ref()
7568
private readonly form!: HTMLFormElement;
7669
70+
public serverError: AlertModel|null = null;
71+
72+
public loading: boolean = false;
73+
74+
public valid: boolean = false;
75+
7776
@Emit()
7877
public input(valid: boolean): boolean {
7978
this.valid = valid;
@@ -84,12 +83,13 @@ export default class SubmitForm extends Vue {
8483
errPropNameOrCB: "serverError",
8584
loadingPropName: "loading",
8685
})
87-
private async handleClick(event: Event): Promise<void> {
86+
private async handleClick(event: Readonly<Event>): Promise<void> {
8887
event.preventDefault();
89-
if (!this.form.validate()) {
88+
// TODO eslint rule
89+
if (!this.form.validate()) { // eslint-disable-line @typescript-eslint/no-unsafe-call
9090
return;
9191
}
92-
await new Promise((resolve: Function, reject: Function) => {
92+
await new Promise((resolve: () => void, reject: () => void) => {
9393
this.$emit("submit", {
9494
reject,
9595
resolve,

0 commit comments

Comments
 (0)