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",
"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"
}
}

View File

@ -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/**/*"]
}