Skip to content

Commit

Permalink
chore: update typescript & eslint configuration (#541)
Browse files Browse the repository at this point in the history
  • Loading branch information
liaoliaots authored Sep 19, 2024
1 parent e9b2034 commit 470f6dc
Show file tree
Hide file tree
Showing 7 changed files with 183 additions and 163 deletions.
5 changes: 5 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
root = true

[*]
indent_style = space
indent_size = 2
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pnpm exec lint-staged
2 changes: 1 addition & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# enable-pre-post-scripts: disabled by default(pnpm 8).
enable-pre-post-scripts=true
enable-pre-post-scripts=true
59 changes: 34 additions & 25 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,32 +1,41 @@
import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';
import globals from 'globals';
import prettier from 'eslint-plugin-prettier/recommended';
// @ts-ignore
import jest from 'eslint-plugin-jest';
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';

export default tseslint.config({
extends: [
eslint.configs.recommended,
...tseslint.configs.recommendedTypeChecked,
{
...jest.configs['flat/recommended']
},
{
...jest.configs['flat/style']
},
eslintPluginPrettierRecommended
],
languageOptions: {
parserOptions: {
project: ['./packages/*/tsconfig.json'],
tsconfigRootDir: import.meta.dirname
},
ecmaVersion: 2023,
sourceType: 'commonjs',
globals: {
...globals.node,
...globals.jest
export default tseslint.config(
{
ignores: ['.prettierrc.js', 'eslint.config.js', 'sample', '**/dist', 'packages/*/*.js']
},
eslint.configs.recommended,
...tseslint.configs.recommendedTypeChecked,
...tseslint.configs.stylisticTypeChecked,
{
files: ['packages/**/test/**', 'packages/**/*.spec.ts'],
...jest.configs['flat/recommended']
},
{
files: ['packages/**/test/**', 'packages/**/*.spec.ts'],
...jest.configs['flat/style']
},
prettier,
{
languageOptions: {
globals: {
...globals.node,
...globals.jest
},
parserOptions: {
project: ['./packages/*/tsconfig.json'],
tsconfigRootDir: import.meta.dirname
}
}
},
ignores: ['.prettierrc.js', 'eslint.config.js', '**/dist/**/*']
});
{
linterOptions: {
reportUnusedDisableDirectives: true
}
}
);
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
"@commitlint/cli": "19.5.0",
"@commitlint/config-conventional": "19.5.0",
"@eslint/js": "9.10.0",
"@nestjs/common": "10.4.1",
"@nestjs/core": "10.4.1",
"@nestjs/platform-fastify": "10.4.1",
"@nestjs/common": "10.4.3",
"@nestjs/core": "10.4.3",
"@nestjs/platform-fastify": "10.4.3",
"@nestjs/terminus": "10.2.3",
"@nestjs/testing": "10.4.1",
"@nestjs/testing": "10.4.3",
"@tsconfig/node20": "20.1.4",
"@types/eslint__js": "8.42.3",
"@types/jest": "29.5.13",
Expand All @@ -41,7 +41,7 @@
"ts-jest": "29.2.5",
"tsc-alias": "1.8.10",
"typescript": "5.6.2",
"typescript-eslint": "8.5.0"
"typescript-eslint": "8.6.0"
},
"engines": {
"node": ">=20",
Expand Down
Loading

0 comments on commit 470f6dc

Please sign in to comment.