From 52898734ab35e6fa6f7c4d1404b5fec769b0c19e Mon Sep 17 00:00:00 2001 From: Sambo Chea Date: Wed, 10 Mar 2021 13:49:04 +0700 Subject: [PATCH] Add eslint for ts --- .eslintrc | 15 +++++++++++++++ package.json | 13 +++++++++++-- tsconfig.json | 37 +++++++++++++++++++------------------ 3 files changed, 45 insertions(+), 20 deletions(-) create mode 100644 .eslintrc diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 0000000..b6f4034 --- /dev/null +++ b/.eslintrc @@ -0,0 +1,15 @@ +{ + "root": true, + "parser": "@typescript-eslint/parser", + "plugins": ["@typescript-eslint", "prettier"], + "extends": [ + "eslint:recommended", + "plugin:@typescript-eslint/eslint-recommended", + "plugin:@typescript-eslint/recommended", + "prettier" + ], + "rules": { + "no-console": 1, + "prettier/prettier": 2 + } +} diff --git a/package.json b/package.json index e62b337..ac0c21d 100644 --- a/package.json +++ b/package.json @@ -7,10 +7,19 @@ "author": "Sambo Chea", "license": "MIT", "private": false, + "dependencies": {}, "devDependencies": { - "prettier": "^2.2.1" + "@typescript-eslint/eslint-plugin": "^4.17.0", + "@typescript-eslint/parser": "^4.17.0", + "eslint": "^7.21.0", + "eslint-config-prettier": "^8.1.0", + "eslint-plugin-prettier": "^3.3.1", + "prettier": "^2.2.1", + "typescript": "^4.2.3" }, "scripts": { - "lint": "prettier --config .prettierrc 'src/**/*.ts' --write" + "build": "tsc -p tsconfig.json", + "lint": "eslint . --ext .ts", + "prettier": "prettier --config .prettierrc 'src/**/*.ts' --write" } } diff --git a/tsconfig.json b/tsconfig.json index d06079f..cefe09a 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,20 +1,21 @@ { - "compilerOptions": { - "target": "es5", - "allowJs": true, - "skipLibCheck": true, - "esModuleInterop": true, - "allowSyntheticDefaultImports": true, - "strict": true, - "forceConsistentCasingInFileNames": true, - "noFallthroughCasesInSwitch": true, - "module": "commonjs", - "moduleResolution": "node", - "resolveJsonModule": true, - "isolatedModules": true, - "noEmit": true, - "declaration": true, - "outDir": "./dist" - }, - "include": ["src/**/*"] + "compilerOptions": { + "target": "es5", + "allowJs": true, + "skipLibCheck": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "strict": true, + "forceConsistentCasingInFileNames": true, + "noFallthroughCasesInSwitch": true, + "module": "commonjs", + "moduleResolution": "node", + "resolveJsonModule": true, + "isolatedModules": true, + "noEmit": true, + "declaration": true, + "outDir": "dist", + "rootDir": "src" + }, + "include": ["src/**/*"] }