Add eslint for ts

This commit is contained in:
Sambo Chea 2021-03-10 13:49:04 +07:00
parent 589e0884e5
commit 52898734ab
3 changed files with 45 additions and 20 deletions

15
.eslintrc Normal file
View File

@ -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
}
}

View File

@ -7,10 +7,19 @@
"author": "Sambo Chea", "author": "Sambo Chea",
"license": "MIT", "license": "MIT",
"private": false, "private": false,
"dependencies": {},
"devDependencies": { "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": { "scripts": {
"lint": "prettier --config .prettierrc 'src/**/*.ts' --write" "build": "tsc -p tsconfig.json",
"lint": "eslint . --ext .ts",
"prettier": "prettier --config .prettierrc 'src/**/*.ts' --write"
} }
} }

View File

@ -1,20 +1,21 @@
{ {
"compilerOptions": { "compilerOptions": {
"target": "es5", "target": "es5",
"allowJs": true, "allowJs": true,
"skipLibCheck": true, "skipLibCheck": true,
"esModuleInterop": true, "esModuleInterop": true,
"allowSyntheticDefaultImports": true, "allowSyntheticDefaultImports": true,
"strict": true, "strict": true,
"forceConsistentCasingInFileNames": true, "forceConsistentCasingInFileNames": true,
"noFallthroughCasesInSwitch": true, "noFallthroughCasesInSwitch": true,
"module": "commonjs", "module": "commonjs",
"moduleResolution": "node", "moduleResolution": "node",
"resolveJsonModule": true, "resolveJsonModule": true,
"isolatedModules": true, "isolatedModules": true,
"noEmit": true, "noEmit": true,
"declaration": true, "declaration": true,
"outDir": "./dist" "outDir": "dist",
}, "rootDir": "src"
"include": ["src/**/*"] },
"include": ["src/**/*"]
} }