From 9c0e64e97721ff06620518740b8d9bbc29f8616d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Huan=20=28=E6=9D=8E=E5=8D=93=E6=A1=93=29?= Date: Sat, 18 Sep 2021 18:14:11 +0800 Subject: [PATCH] remote tslint --- README.md | 4 +++- package.json | 3 +-- scripts/npm-pack-testing.sh | 2 ++ src/eslint-rules.cjs | 2 ++ src/eslintrc.cjs | 6 +++--- tests/detect-patterns.spec.ts | 3 --- tests/fixtures/good-patterns/brace-style.ts | 4 ++-- 7 files changed, 13 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 4cc9632..953a78f 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,9 @@ Add the following config to `.vscode/settings.json` to enable linting TypeScript ## HISTORY -### main +### main v0.15 (Sep 18, 2021) + +1. Clean TSLint... ### v0.14 diff --git a/package.json b/package.json index 61e93ef..3f7d495 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@chatie/eslint-config", - "version": "0.14.6", + "version": "0.15.0", "description": "ESLint Sharable Configurations and Rules in Chatie Organization", "main": "./src/eslintrc.cjs", "scripts": { @@ -48,7 +48,6 @@ "glob": "^7.1.7", "markdownlint-cli": "^0.28.1", "pkg-up": "^3.1.0", - "tslint": "^6.1.3", "tstest": "^0.4.10", "typescript": "^4.4.3" }, diff --git a/scripts/npm-pack-testing.sh b/scripts/npm-pack-testing.sh index d18f0e3..6e5aad8 100755 --- a/scripts/npm-pack-testing.sh +++ b/scripts/npm-pack-testing.sh @@ -19,6 +19,8 @@ npm install --production \ @types/node \ @chatie/tsconfig \ blue-tape \ + eslint \ + eslint-plugin-promise \ glob \ typescript diff --git a/src/eslint-rules.cjs b/src/eslint-rules.cjs index 22078da..0039f8a 100644 --- a/src/eslint-rules.cjs +++ b/src/eslint-rules.cjs @@ -1,5 +1,7 @@ const ESLINT_RULES = { '@typescript-eslint/no-floating-promises': 'error', + '@typescript-eslint/no-misused-promises': 'error', + '@typescript-eslint/no-unnecessary-condition': 'error', '@typescript-eslint/no-useless-constructor': 'off', 'brace-style': ['error', '1tbs', { allowSingleLine: true }], 'comma-dangle': ['error', 'always-multiline'], diff --git a/src/eslintrc.cjs b/src/eslintrc.cjs index 4bdf3dd..e2c1efd 100644 --- a/src/eslintrc.cjs +++ b/src/eslintrc.cjs @@ -1,9 +1,9 @@ const { ESLINT_RULES } = require('./eslint-rules.cjs') -const { TSLINT_CONFIG } = require('./tslint-config.cjs') +// const { TSLINT_CONFIG } = require('./tslint-config.cjs') const rules = { ...ESLINT_RULES, - '@typescript-eslint/tslint/config': ['error', TSLINT_CONFIG], + // '@typescript-eslint/tslint/config': ['error', TSLINT_CONFIG], } const ESLINT_RC = { @@ -29,7 +29,7 @@ const ESLINT_RC = { }, plugins: [ '@typescript-eslint', - '@typescript-eslint/tslint', + // '@typescript-eslint/tslint', 'promise', ], rules, diff --git a/tests/detect-patterns.spec.ts b/tests/detect-patterns.spec.ts index d8dd5bb..1f2dd63 100755 --- a/tests/detect-patterns.spec.ts +++ b/tests/detect-patterns.spec.ts @@ -14,9 +14,6 @@ const cli = new ESLint({ useEslintrc: false, }) -// const TSLINT_JSON_FILE = path.join(__dirname, '..', 'tslint.json') -// const TSCONFIG_JSON_FILE = path.join(__dirname, '..', 'tsconfig.json') - const ANTI_PATTERNS_DIR = path.join(__dirname, 'fixtures/anti-patterns') const GOOD_PATTERNS_DIR = path.join(__dirname, 'fixtures/good-patterns') diff --git a/tests/fixtures/good-patterns/brace-style.ts b/tests/fixtures/good-patterns/brace-style.ts index 638fd28..b48094f 100644 --- a/tests/fixtures/good-patterns/brace-style.ts +++ b/tests/fixtures/good-patterns/brace-style.ts @@ -1,8 +1,8 @@ /** * https://stackoverflow.com/q/64089216/1123955 */ -const n = 42 +const n = Math.random() * 100 -if (n === 42) { console.info(n) } else { +if (n > 42) { console.info(n) } else { console.info(n + 1) }