Skip to content

Commit

Permalink
Merge pull request #10464 from murdos/simplify-generated-tsconfig
Browse files Browse the repository at this point in the history
Simplify generated tsconfig for vue and react
  • Loading branch information
murdos authored Jul 31, 2024
2 parents e1659aa + 59bf425 commit 8bf2d39
Show file tree
Hide file tree
Showing 14 changed files with 20 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public JHipsterModule buildModule(JHipsterModuleProperties properties) {
.addDevDependency(packageName("@types/node"), COMMON)
.addDevDependency(packageName("@types/react"), REACT)
.addDevDependency(packageName("@types/react-dom"), REACT)
.addDevDependency(packageName("@tsconfig/vite-react"), REACT)
.addDevDependency(packageName("@typescript-eslint/eslint-plugin"), COMMON)
.addDevDependency(packageName("@vitejs/plugin-react"), REACT)
.addDevDependency(packageName("@vitest/coverage-istanbul"), COMMON)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public JHipsterModule buildVueModule(JHipsterModuleProperties properties) {
.addDevDependency(packageName("@vue/eslint-config-typescript"), VUE)
.addDevDependency(packageName("@vue/eslint-config-prettier"), VUE)
.addDevDependency(packageName("@vue/test-utils"), VUE)
.addDevDependency(packageName("@vue/tsconfig"), VUE)
.addDevDependency(packageName("@vitest/coverage-istanbul"), COMMON)
.addDevDependency(packageName("eslint"), COMMON)
.addDevDependency(packageName("eslint-plugin-vue"), VUE)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DisplayedOnPage } from './DisplayedOnPage';
import type { DisplayedOnPage } from './DisplayedOnPage';

export type Page<Content> = {
currentPage: number;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Page } from '@/shared/pagination/domain/Page';
import type { Page } from '@/shared/pagination/domain/Page';

export type RestData<T> = {
data: T;
Expand Down
23 changes: 5 additions & 18 deletions src/main/resources/generator/client/react/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,15 @@
{
"extends": "@tsconfig/vite-react/tsconfig.json",
"compilerOptions": {
"target": "ESNext",
"useDefineForClassFields": true,
"lib": ["DOM", "DOM.Iterable", "ESNext"],
"allowJs": false,
"skipLibCheck": true,
"esModuleInterop": false,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx",
"composite": false,
"module": "esnext",
"moduleResolution": "node",
"baseUrl": "src",
"baseUrl": ".",
"types": ["vitest/globals"],
"paths": {
"@/*": ["main/webapp/app/*"],
"@assets/*": ["main/webapp/assets/*"]
"@/*": ["src/main/webapp/app/*"],
"@assets/*": ["src/main/webapp/assets/*"]
}
},
"include": ["vite.config.ts", "src"],
"exclude": ["src/test/javascript/integration/**/*spec.ts", "node_modules"]
"include": ["src/main/webapp/**/*", "src/test/javascript/spec/**/*"]
}
21 changes: 2 additions & 19 deletions src/main/resources/generator/client/vue/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,30 +1,13 @@
{
"extends": "@vue/tsconfig/tsconfig.dom.json",
"compilerOptions": {
"target": "esnext",
"useDefineForClassFields": true,
"module": "esnext",
"moduleResolution": "node",
"strict": true,
"jsx": "preserve",
"skipLibCheck": true,
"allowJs": true,
"sourceMap": true,
"resolveJsonModule": true,
"esModuleInterop": true,
"lib": ["esnext", "dom"],
"types": ["vite/client", "vitest/globals"],
"baseUrl": ".",
"paths": {
"@/*": ["src/main/webapp/app/*"]
}
},
"include": [
"src/main/webapp/**/*.ts",
"src/main/webapp/**/*.d.ts",
"src/main/webapp/**/*.tsx",
"src/main/webapp/**/*.vue",
"src/test/javascript/spec/**/*.ts",
"src/test/javascript/spec/**/*.vue"
],
"exclude": ["./node_modules"]
"include": ["src/main/webapp/**/*", "src/test/javascript/spec/**/*"]
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Message } from '@/common/domain/Message';
import type { Message } from '@/common/domain/Message';

export interface Logger {
error(message: Message, error: Error): void;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Logger } from '@/common/domain/Logger';
import { Message } from '@/common/domain/Message';
import type { Logger } from '@/common/domain/Logger';
import type { Message } from '@/common/domain/Message';

export default class ConsoleLogger implements Logger {
constructor(private readonly logger: Console) {}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios';
import type { AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios';

export type AxiosHttpResponse<T> = AxiosResponse<T>;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PropType } from 'vue';
import type { PropType } from 'vue';

export const objectType = <T>() => Object as PropType<T>;
export const arrayType = <T>() => Array as PropType<T[]>;
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"devDependencies": {
"@testing-library/dom": "10.4.0",
"@testing-library/react": "16.0.0",
"@tsconfig/vite-react": "3.0.2",
"@types/react": "18.3.3",
"@types/react-dom": "18.3.0",
"@vitejs/plugin-react": "4.3.1",
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/generator/dependencies/vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"@vue/eslint-config-prettier": "9.0.0",
"@vue/eslint-config-typescript": "13.0.0",
"@vue/test-utils": "2.4.6",
"@vue/tsconfig": "0.5.1",
"eslint-plugin-vue": "9.27.0",
"sinon": "18.0.0",
"vue-tsc": "2.0.29"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ void shouldBuildModuleWithStyle() {
.containing(nodeDependency("@types/node"))
.containing(nodeDependency("@types/react"))
.containing(nodeDependency("@types/react-dom"))
.containing(nodeDependency("@tsconfig/vite-react"))
.containing(nodeDependency("@typescript-eslint/eslint-plugin"))
.containing(nodeDependency("@vitejs/plugin-react"))
.containing(nodeDependency("@vitest/coverage-istanbul"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ void shouldCreateVueModule() {
.containing(nodeDependency("@vue/eslint-config-typescript"))
.containing(nodeDependency("@vue/eslint-config-prettier"))
.containing(nodeDependency("@vue/test-utils"))
.containing(nodeDependency("@vue/tsconfig"))
.containing(nodeDependency("@vitest/coverage-istanbul"))
.containing(nodeDependency("eslint"))
.containing(nodeDependency("eslint-plugin-vue"))
Expand Down

0 comments on commit 8bf2d39

Please sign in to comment.