Skip to content

Commit

Permalink
Vue/ESLint: add @typescript-eslint/consistent-type-imports rule
Browse files Browse the repository at this point in the history
  • Loading branch information
qmonmert committed Nov 3, 2024
1 parent f936eef commit c14e2be
Show file tree
Hide file tree
Showing 15 changed files with 16 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ private Consumer<JHipsterModuleBuilder> patchEslintConfig(JHipsterModuleProperti
.add(eslintTypescriptVueRule("'vue/html-self-closing': 'off',", properties.indentation()))
.add(eslintTypescriptVueRule("'@typescript-eslint/no-explicit-any': 'off',", properties.indentation()))
.add(eslintTypescriptVueRule("'@typescript-eslint/no-empty-object-type': 'off',", properties.indentation()))
.add(eslintTypescriptVueRule("'@typescript-eslint/consistent-type-imports': 'error',", properties.indentation()))
.and()
.and();
//@formatter:on
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { HttpResponseInterceptor, RouteMatcher, StaticResponse } from 'cypress/types/net-stubbing';
import type { HttpResponseInterceptor, RouteMatcher, StaticResponse } from 'cypress/types/net-stubbing';

type ResponseSender = {
send: () => void;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Page } from '@playwright/test';
import { type Page } from '@playwright/test';

export class HomePage {
readonly page: Page;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ Location: `src/test/webapp/unit/auth/infrastructure/secondary/KeycloakStub.ts`
This file provides a stub for Keycloak to be used in tests.

```typescript
import Keycloak from 'keycloak-js';
import type Keycloak from 'keycloak-js';
import sinon from 'sinon';
import type { SinonStub } from 'sinon';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import HomepageVue from '@/home/infrastructure/primary/HomepageVue.vue';
import { shallowMount, VueWrapper } from '@vue/test-utils';
import { shallowMount, type VueWrapper } from '@vue/test-utils';
import { describe, expect, it } from 'vitest';

let wrapper: VueWrapper;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { AuthRepository } from '@/auth/domain/AuthRepository';
import { KeycloakAuthRepository } from '@/auth/infrastructure/secondary/KeycloakAuthRepository';
import { KeycloakHttp } from '@/auth/infrastructure/secondary/KeycloakHttp';
import { type KeycloakHttp } from '@/auth/infrastructure/secondary/KeycloakHttp';
import { provide } from '@/injections';
import { key } from 'piqure';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { AuthRepository } from '@/auth/domain/AuthRepository';
import type { AuthenticatedUser } from '@/auth/domain/AuthenticatedUser';
import { KeycloakHttp } from './KeycloakHttp';
import { type KeycloakHttp } from './KeycloakHttp';

export class KeycloakAuthRepository implements AuthRepository {
constructor(private readonly keycloakHttp: KeycloakHttp) {}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { AuthenticatedUser } from '@/auth/domain/AuthenticatedUser';
import Keycloak from 'keycloak-js';
import type Keycloak from 'keycloak-js';

export class KeycloakHttp {
private initialized: boolean = false;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Keycloak from 'keycloak-js';
import type Keycloak from 'keycloak-js';
import type { SinonStub } from 'sinon';
import sinon from 'sinon';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/// <reference types="vite/client" />

declare module '*.vue' {
import { DefineComponent } from 'vue';
import type DefineComponent from 'vue';
const component: DefineComponent<{}, {}, any>;
export default component;
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import HomepageVue from '@/home/infrastructure/primary/HomepageVue.vue';
import { routes } from '@/router';
import { mount, VueWrapper } from '@vue/test-utils';
import { mount, type VueWrapper } from '@vue/test-utils';
import { beforeEach, describe, expect, it } from 'vitest';
import { createRouter, createWebHistory, type Router } from 'vue-router';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ void shouldBuildVueOAuth2KeycloakModule() {
.hasFile("src/main/webapp/app/main.ts")
.containing("""
import { provideForAuth } from '@/auth/application/AuthProvider';
import { KeycloakHttp } from '@/auth/infrastructure/secondary/KeycloakHttp';
import Keycloak from 'keycloak-js';
import { type KeycloakHttp } from '@/auth/infrastructure/secondary/KeycloakHttp';
import type Keycloak from 'keycloak-js';
// jhipster-needle-main-ts-import\
"""
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import HomepageVue from '@/home/infrastructure/primary/HomepageVue.vue';
import { shallowMount, VueWrapper } from '@vue/test-utils';
import { shallowMount, type VueWrapper } from '@vue/test-utils';
import { describe, expect, it } from 'vitest';

let wrapper: VueWrapper;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export default typescript.config(
},
rules: {
quotes: ['error', 'single', { avoidEscape: true }],
'@typescript-eslint/consistent-type-imports': 'error',
'@typescript-eslint/no-empty-object-type': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'vue/html-self-closing': 'off',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AppVue } from '@/root/infrastructure/primary';
import { shallowMount, VueWrapper } from '@vue/test-utils';
import { shallowMount, type VueWrapper } from '@vue/test-utils';
import { describe, expect, it } from 'vitest';

let wrapper: VueWrapper;
Expand Down

0 comments on commit c14e2be

Please sign in to comment.