Skip to content

Commit 44beef4

Browse files
committed
dev: suppoprt typescript
1 parent 2da9552 commit 44beef4

File tree

4 files changed

+268
-44
lines changed

4 files changed

+268
-44
lines changed

.eslintrc.js

+43-33
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,48 @@
11
module.exports = {
2-
root: true,
2+
root: true,
3+
parserOptions: {
4+
parser: 'babel-eslint',
5+
ecmaVersion: 2018,
6+
sourceType: 'module'
7+
},
8+
plugins: ['html'],
9+
env: {
10+
browser: true,
11+
node: true
12+
},
313

4-
parserOptions: {
5-
parser: 'babel-eslint',
6-
ecmaVersion: 2018,
7-
sourceType: 'module'
8-
},
9-
plugins: ['html'],
10-
env: {
11-
browser: true
12-
},
14+
rules: {
15+
indent: ['error', 2, { SwitchCase: 1 }],
16+
'space-infix-ops': ['error', { int32Hint: false }],
17+
'key-spacing': [
18+
2,
19+
{
20+
beforeColon: false,
21+
afterColon: true
22+
}
23+
],
24+
'no-octal': 2,
25+
'no-redeclare': 2,
26+
'comma-spacing': 2,
27+
'no-new-object': 2,
28+
'arrow-spacing': 2,
29+
quotes: [
30+
2,
31+
'single',
32+
{
33+
avoidEscape: true,
34+
allowTemplateLiterals: true
35+
}
36+
]
37+
},
38+
overrides: [
39+
{
40+
files: ['**/*.ts'],
41+
parser: '@typescript-eslint/parser',
42+
extends: [
43+
'plugin:@typescript-eslint/recommended' // Uses the recommended rules from the @typescript-eslint/eslint-plugin
44+
],
1345

14-
rules: {
15-
indent: ['error', 2, { SwitchCase: 1 }],
16-
'space-infix-ops': ['error', { int32Hint: false }],
17-
'key-spacing': [
18-
2,
19-
{
20-
beforeColon: false,
21-
afterColon: true
22-
}
23-
],
24-
'no-octal': 2,
25-
'no-redeclare': 2,
26-
'comma-spacing': 2,
27-
'no-new-object': 2,
28-
'arrow-spacing': 2,
29-
quotes: [
30-
2,
31-
'single',
32-
{
33-
avoidEscape: true,
34-
allowTemplateLiterals: true
35-
}
36-
]
3746
}
47+
]
3848
}

package.json

+5-2
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,15 @@
4343
"request": "^2.88.0"
4444
},
4545
"devDependencies": {
46-
"eslint": "7.8.1",
46+
"@typescript-eslint/eslint-plugin": "^4.0.1",
47+
"@typescript-eslint/parser": "^4.0.1",
48+
"eslint": "^7.8.1",
4749
"eslint-plugin-html": "6.0.3",
4850
"husky": "4.2.5",
4951
"intelli-espower-loader": "1.0.1",
5052
"lint-staged": "10.2.11",
5153
"mocha": "8.1.3",
52-
"power-assert": "1.6.1"
54+
"power-assert": "1.6.1",
55+
"typescript": "^4.0.2"
5356
}
5457
}

tsconfig.json

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"compilerOptions": {
3+
"target": "ES2015",
4+
"module": "commonjs",
5+
"experimentalDecorators": true,
6+
"moduleResolution": "node",
7+
"lib": [
8+
"esnext",
9+
"esnext.asynciterable",
10+
"dom"
11+
],
12+
"esModuleInterop": true,
13+
"allowJs": true,
14+
"sourceMap": true,
15+
"strict": true,
16+
"noEmit": true,
17+
"baseUrl": ".",
18+
"paths": {
19+
"~/*": [
20+
"./*"
21+
],
22+
"@/*": [
23+
"./*"
24+
]
25+
},
26+
},
27+
"exclude": [
28+
"node_modules"
29+
]
30+
}

0 commit comments

Comments
 (0)