Skip to content

Commit

Permalink
chore: config jest & eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
Yukaii committed Feb 14, 2023
1 parent b5e5ce5 commit 2fefb45
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 3 deletions.
8 changes: 6 additions & 2 deletions nodejs/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const path = require('path')

module.exports = {
/** @type {import('eslint').Linter.Config} */
const config = {
"parser": "@typescript-eslint/parser",
"extends": [
"eslint:recommended",
Expand All @@ -17,10 +18,13 @@ module.exports = {
},
"parserOptions": {
"project": [
path.resolve(__dirname, "tsconfig.json")
path.resolve(__dirname, "tsconfig.json"),
path.resolve(__dirname, "tsconfig.eslint.json")
]
},
"ignorePatterns": [
".eslintrc.js"
],
}

module.exports = config
10 changes: 10 additions & 0 deletions nodejs/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import type { JestConfigWithTsJest } from "ts-jest"

const customJestConfig: JestConfigWithTsJest = {
preset: "ts-jest",
testEnvironment: "node",
transformIgnorePatterns: ["<rootDir>/node_modules/"],
extensionsToTreatAsEsm: [".ts"],
}

export default customJestConfig
33 changes: 33 additions & 0 deletions nodejs/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion nodejs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"build": "npm run clean && tsc -d",
"watch": "npm run clean && tsc -w",
"prepublishOnly": "npm run build",
"lint": "eslint src --fix --ext .ts"
"lint": "eslint src --fix --ext .ts",
"test": "jest"
},
"keywords": [
"HackMD",
Expand All @@ -27,6 +28,7 @@
},
"license": "MIT",
"devDependencies": {
"@types/eslint": "^8.21.0",
"@types/jest": "^29.4.0",
"@types/node": "^13.11.1",
"@typescript-eslint/eslint-plugin": "^5.52.0",
Expand Down
6 changes: 6 additions & 0 deletions nodejs/tsconfig.eslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": "./tsconfig.json",
"include": [
"**/*.ts",
]
}

0 comments on commit 2fefb45

Please sign in to comment.