From 2240fa1f730a3acae0e22615bce963e2e1ce103f Mon Sep 17 00:00:00 2001 From: meteorlxy Date: Thu, 28 Nov 2019 17:09:55 +0800 Subject: [PATCH] build: refine typescript configs --- .eslintrc.js | 14 ++++++++++---- package.json | 10 ++++------ tsconfig.json | 4 ++-- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 8f1b66e2..e815e5eb 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -9,10 +9,6 @@ module.exports = { 'operator-linebreak': ['error', 'before'] }, overrides: [ - { - files: ['**/__tests__/**/*.spec.js'], - extends: ['plugin:jest/recommended'] - }, { files: ['*.ts'], extends: [ @@ -21,7 +17,17 @@ module.exports = { parser: 'vue-eslint-parser', parserOptions: { parser: '@typescript-eslint/parser' + }, + rules: { + 'no-useless-constructor': 'off' } + }, + { + files: [ + '**/__tests__/**/*.spec.js', + '**/__tests__/**/*.spec.ts' + ], + extends: ['plugin:jest/recommended'] } ] } diff --git a/package.json b/package.json index e15f105e..7cea2f8c 100644 --- a/package.json +++ b/package.json @@ -8,21 +8,19 @@ ], "scripts": { "boot": "node scripts/bootstrap.js", - "bootstrap": "yarn && yarn tsc", "build": "yarn tsc && yarn build:docs", "build:docs": "yarn workspace docs build", "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 2", "clean": "lerna clean && rm -rf node_modules", "dev": "yarn tsc && yarn dev:docs", "dev:docs": "yarn workspace docs dev", - "lerna:bootstrap": "lerna bootstrap", - "lint": "yarn lint:check --fix", - "lint:check": "eslint packages --ext .js,.vue", + "lint": "eslint packages --ext .js,.ts,.vue", "packages:changed": "lerna changed", "packages:diff": "lerna diff", "packages:list": "lerna ls -l", + "prepublishOnly": "yarn --pure-lockfile && yarn lint && yarn test && yarn build", "register-vuepress": "lerna exec --scope vuepress -- yarn link", - "release": "yarn --pure-lockfile && yarn tsc && node scripts/release.js", + "release": "node scripts/release.js", "remote-version": "node scripts/remote-version.js", "show-help": "yarn workspace docs show-help", "test": "node scripts/test.js", @@ -36,7 +34,7 @@ } }, "lint-staged": { - "*.{js,vue}": [ + "*.{js,ts,vue}": [ "eslint --fix", "git add" ], diff --git a/tsconfig.json b/tsconfig.json index ac719821..1c3088ba 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -8,12 +8,12 @@ "lib": ["es2015", "es2016.array.include"], "allowSyntheticDefaultImports": true, "stripInternal": true, - "noImplicitAny": true, + "noImplicitAny": false, "noImplicitReturns": true, "noImplicitThis": true, - "noUnusedLocals": true, "noUnusedParameters": true, "noFallthroughCasesInSwitch": true, + "resolveJsonModule": true, "strictNullChecks": true, "strictFunctionTypes": true, "alwaysStrict": true,