Skip to content

Commit

Permalink
dev: suppoprt typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
greenhat616 committed Sep 3, 2020
1 parent 2da9552 commit 44beef4
Show file tree
Hide file tree
Showing 4 changed files with 268 additions and 44 deletions.
76 changes: 43 additions & 33 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,38 +1,48 @@
module.exports = {
root: true,
root: true,
parserOptions: {
parser: 'babel-eslint',
ecmaVersion: 2018,
sourceType: 'module'
},
plugins: ['html'],
env: {
browser: true,
node: true
},

parserOptions: {
parser: 'babel-eslint',
ecmaVersion: 2018,
sourceType: 'module'
},
plugins: ['html'],
env: {
browser: true
},
rules: {
indent: ['error', 2, { SwitchCase: 1 }],
'space-infix-ops': ['error', { int32Hint: false }],
'key-spacing': [
2,
{
beforeColon: false,
afterColon: true
}
],
'no-octal': 2,
'no-redeclare': 2,
'comma-spacing': 2,
'no-new-object': 2,
'arrow-spacing': 2,
quotes: [
2,
'single',
{
avoidEscape: true,
allowTemplateLiterals: true
}
]
},
overrides: [
{
files: ['**/*.ts'],
parser: '@typescript-eslint/parser',
extends: [
'plugin:@typescript-eslint/recommended' // Uses the recommended rules from the @typescript-eslint/eslint-plugin
],

rules: {
indent: ['error', 2, { SwitchCase: 1 }],
'space-infix-ops': ['error', { int32Hint: false }],
'key-spacing': [
2,
{
beforeColon: false,
afterColon: true
}
],
'no-octal': 2,
'no-redeclare': 2,
'comma-spacing': 2,
'no-new-object': 2,
'arrow-spacing': 2,
quotes: [
2,
'single',
{
avoidEscape: true,
allowTemplateLiterals: true
}
]
}
]
}
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,15 @@
"request": "^2.88.0"
},
"devDependencies": {
"eslint": "7.8.1",
"@typescript-eslint/eslint-plugin": "^4.0.1",
"@typescript-eslint/parser": "^4.0.1",
"eslint": "^7.8.1",
"eslint-plugin-html": "6.0.3",
"husky": "4.2.5",
"intelli-espower-loader": "1.0.1",
"lint-staged": "10.2.11",
"mocha": "8.1.3",
"power-assert": "1.6.1"
"power-assert": "1.6.1",
"typescript": "^4.0.2"
}
}
30 changes: 30 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"compilerOptions": {
"target": "ES2015",
"module": "commonjs",
"experimentalDecorators": true,
"moduleResolution": "node",
"lib": [
"esnext",
"esnext.asynciterable",
"dom"
],
"esModuleInterop": true,
"allowJs": true,
"sourceMap": true,
"strict": true,
"noEmit": true,
"baseUrl": ".",
"paths": {
"~/*": [
"./*"
],
"@/*": [
"./*"
]
},
},
"exclude": [
"node_modules"
]
}
Loading

0 comments on commit 44beef4

Please sign in to comment.