Skip to content

Commit 2fefb45

Browse files
committed
chore: config jest & eslint
1 parent b5e5ce5 commit 2fefb45

File tree

5 files changed

+58
-3
lines changed

5 files changed

+58
-3
lines changed

nodejs/.eslintrc.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
const path = require('path')
22

3-
module.exports = {
3+
/** @type {import('eslint').Linter.Config} */
4+
const config = {
45
"parser": "@typescript-eslint/parser",
56
"extends": [
67
"eslint:recommended",
@@ -17,10 +18,13 @@ module.exports = {
1718
},
1819
"parserOptions": {
1920
"project": [
20-
path.resolve(__dirname, "tsconfig.json")
21+
path.resolve(__dirname, "tsconfig.json"),
22+
path.resolve(__dirname, "tsconfig.eslint.json")
2123
]
2224
},
2325
"ignorePatterns": [
2426
".eslintrc.js"
2527
],
2628
}
29+
30+
module.exports = config

nodejs/jest.config.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import type { JestConfigWithTsJest } from "ts-jest"
2+
3+
const customJestConfig: JestConfigWithTsJest = {
4+
preset: "ts-jest",
5+
testEnvironment: "node",
6+
transformIgnorePatterns: ["<rootDir>/node_modules/"],
7+
extensionsToTreatAsEsm: [".ts"],
8+
}
9+
10+
export default customJestConfig

nodejs/package-lock.json

Lines changed: 33 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

nodejs/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
"build": "npm run clean && tsc -d",
1010
"watch": "npm run clean && tsc -w",
1111
"prepublishOnly": "npm run build",
12-
"lint": "eslint src --fix --ext .ts"
12+
"lint": "eslint src --fix --ext .ts",
13+
"test": "jest"
1314
},
1415
"keywords": [
1516
"HackMD",
@@ -27,6 +28,7 @@
2728
},
2829
"license": "MIT",
2930
"devDependencies": {
31+
"@types/eslint": "^8.21.0",
3032
"@types/jest": "^29.4.0",
3133
"@types/node": "^13.11.1",
3234
"@typescript-eslint/eslint-plugin": "^5.52.0",

nodejs/tsconfig.eslint.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"include": [
4+
"**/*.ts",
5+
]
6+
}

0 commit comments

Comments
 (0)