Skip to content

Commit

Permalink
build: refactor tsconfig & eslint config
Browse files Browse the repository at this point in the history
  • Loading branch information
liaoliaots committed Sep 21, 2024
1 parent 54a9ae3 commit 1250048
Show file tree
Hide file tree
Showing 10 changed files with 69 additions and 76 deletions.
6 changes: 3 additions & 3 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';
import globals from 'globals';
import prettier from 'eslint-plugin-prettier/recommended';
import prettierPlugin from 'eslint-plugin-prettier/recommended';
// @ts-ignore
import jest from 'eslint-plugin-jest';

const jestFiles = ['packages/*/test/**/*', 'packages/**/*.spec.ts'];
const jestFiles = ['packages/*/test/**/*', 'packages/*/lib/**/*.spec.ts'];

export default tseslint.config(
{
Expand All @@ -22,7 +22,7 @@ export default tseslint.config(
files: jestFiles,
...jest.configs['flat/style']
},
prettier,
prettierPlugin,
{
languageOptions: {
globals: {
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"devDependencies": {
"@commitlint/cli": "19.5.0",
"@commitlint/config-conventional": "19.5.0",
"@eslint/js": "9.10.0",
"@eslint/js": "9.11.0",
"@nestjs/common": "10.4.3",
"@nestjs/core": "10.4.3",
"@nestjs/platform-fastify": "10.4.3",
Expand All @@ -22,7 +22,7 @@
"@types/jest": "29.5.13",
"@types/node": "20.16.5",
"concurrently": "9.0.1",
"eslint": "9.10.0",
"eslint": "9.11.0",
"eslint-config-prettier": "9.1.0",
"eslint-plugin-jest": "28.8.3",
"eslint-plugin-prettier": "5.2.1",
Expand Down
7 changes: 3 additions & 4 deletions packages/node-redis/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
{
"extends": "../tsconfig.build.json",
"extends": "../tsconfig.base.json",
"compilerOptions": {
"baseUrl": ".",
"outDir": "./dist",
"outDir": "dist",
"paths": {
"@/*": ["lib/*"]
"@/*": ["./lib/*"]
}
},
"include": ["lib", "test"],
Expand Down
3 changes: 1 addition & 2 deletions packages/redis-health/test/cluster/e2e/health.e2e-spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Test, TestingModule } from '@nestjs/testing';
import { NestFastifyApplication, FastifyAdapter } from '@nestjs/platform-fastify';
import { FastifyInstance } from 'fastify';
import { AppModule } from '../src/app.module';

describe('HealthController (e2e)', () => {
Expand All @@ -12,7 +11,7 @@ describe('HealthController (e2e)', () => {
}).compile();
app = module.createNestApplication<NestFastifyApplication>(new FastifyAdapter());
await app.init();
await (app.getHttpAdapter().getInstance() as FastifyInstance).ready();
await app.getHttpAdapter().getInstance().ready();
});

afterAll(async () => {
Expand Down
3 changes: 1 addition & 2 deletions packages/redis-health/test/redis/e2e/health.e2e-spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Test, TestingModule } from '@nestjs/testing';
import { NestFastifyApplication, FastifyAdapter } from '@nestjs/platform-fastify';
import { FastifyInstance } from 'fastify';
import { AppModule } from '../src/app.module';

describe('HealthController (e2e)', () => {
Expand All @@ -12,7 +11,7 @@ describe('HealthController (e2e)', () => {
}).compile();
app = module.createNestApplication<NestFastifyApplication>(new FastifyAdapter());
await app.init();
await (app.getHttpAdapter().getInstance() as FastifyInstance).ready();
await app.getHttpAdapter().getInstance().ready();
});

afterAll(async () => {
Expand Down
7 changes: 3 additions & 4 deletions packages/redis-health/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
{
"extends": "../tsconfig.build.json",
"extends": "../tsconfig.base.json",
"compilerOptions": {
"baseUrl": ".",
"outDir": "./dist",
"outDir": "dist",
"paths": {
"@/*": ["../redis/lib/*"],
"@health/*": ["lib/*"]
"@health/*": ["./lib/*"]
}
},
"include": ["lib", "test"],
Expand Down
7 changes: 3 additions & 4 deletions packages/redis/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
{
"extends": "../tsconfig.build.json",
"extends": "../tsconfig.base.json",
"compilerOptions": {
"baseUrl": ".",
"outDir": "./dist",
"outDir": "dist",
"paths": {
"@/*": ["lib/*"]
"@/*": ["./lib/*"]
}
},
"include": ["lib", "test"],
Expand Down
4 changes: 1 addition & 3 deletions packages/tsconfig.build.json → packages/tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@
"declaration": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
"target": "ES2021",
"lib": ["ES2023"],
"esModuleInterop": true,
"importHelpers": true,
"strict": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true
"skipLibCheck": true
}
}
Loading

0 comments on commit 1250048

Please sign in to comment.