From 494e870226214293d4d4e27f614de43c9324d886 Mon Sep 17 00:00:00 2001 From: LongYinan Date: Mon, 24 Aug 2020 17:06:26 +0800 Subject: [PATCH] build: fix ts file build --- .eslintrc.yml | 8 ++++++++ package.json | 27 +++++++-------------------- test_module/tsconfig.json | 7 +++++++ tsconfig.json | 1 + 4 files changed, 23 insertions(+), 20 deletions(-) create mode 100644 test_module/tsconfig.json diff --git a/.eslintrc.yml b/.eslintrc.yml index ef17a47d..93929a96 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -204,3 +204,11 @@ rules: ], }, ] + +overrides: + - files: + - ./test_module/**/*.{ts,js} + plugins: + - '@typescript-eslint' + parserOptions: + project: ./test_module/tsconfig.json diff --git a/package.json b/package.json index 21bae0e7..8c27383c 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "format:rs": "cargo fmt", "format:source": "prettier --config ./package.json --write './**/*.js'", "format:yaml": "prettier --parser yaml --write './**/*.{yml,yaml}'", - "lint": "eslint -c .eslintrc.yml", + "lint": "eslint -c .eslintrc.yml './src/**/*.ts' './test_module/**/*.{ts,js}'", "test": "ava" }, "bugs": { @@ -44,29 +44,16 @@ "trailingComma": "all", "arrowParens": "always" }, - "files": [ - "scripts", - "LICENSE" - ], + "files": ["scripts", "LICENSE"], "lint-staged": { - "*.js": [ - "prettier --write" - ], - "*.@(yml|yaml)": [ - "prettier --parser yaml --write" - ], - "*.json": [ - "prettier --parser json --write" - ], - "*.md": [ - "prettier --parser markdown --write" - ] + "*.js": ["prettier --write"], + "*.@(yml|yaml)": ["prettier --parser yaml --write"], + "*.json": ["prettier --parser json --write"], + "*.md": ["prettier --parser markdown --write"] }, "ava": { "extensions": ["ts", "tsx"], - "files": [ - "test_module/__test__/**/*.spec.ts" - ], + "files": ["test_module/__test__/**/*.spec.ts"], "require": ["@swc-node/register"] }, "husky": { diff --git a/test_module/tsconfig.json b/test_module/tsconfig.json new file mode 100644 index 00000000..b4c49e2f --- /dev/null +++ b/test_module/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../tsconfig.json", + "include": ["."], + "compilerOptions": { + "outDir": "./dist" + } +} diff --git a/tsconfig.json b/tsconfig.json index 6b9438e0..58de7e13 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -39,5 +39,6 @@ "esnext" ] }, + "include": ["./src"], "exclude": ["node_modules"] }