Skip to content

Commit fdd2255

Browse files
committed
Typescript setup copying nuxt/create-nuxt-app#207
1 parent 26197f5 commit fdd2255

File tree

5 files changed

+494
-200
lines changed

5 files changed

+494
-200
lines changed

.eslintrc.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,27 @@ module.exports = {
55
node: true
66
},
77
parserOptions: {
8-
parser: 'babel-eslint'
8+
parser: '@typescript-eslint/parser',
9+
sourceType: 'module',
10+
project: './tsconfig.json',
11+
ecmaFeatures: { "legacyDecorators": true },
912
},
1013
extends: [
1114
'@nuxtjs',
1215
'prettier',
16+
'prettier/@typescript-eslint',
1317
'prettier/vue',
1418
'plugin:prettier/recommended',
1519
'plugin:nuxt/recommended'
1620
],
1721
plugins: [
18-
'prettier'
22+
'prettier',
23+
'@typescript-eslint'
1924
],
2025
// add your custom rules here
2126
rules: {
22-
'nuxt/no-cjs-in-config': 'off'
27+
'nuxt/no-cjs-in-config': 'off',
28+
'no-unused-vars': 'off',
29+
'@typescript-eslint/no-unused-vars': 'error'
2330
}
2431
}

nuxt.config.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ module.exports = {
5555
/*
5656
** You can extend webpack config here
5757
*/
58-
extend(config, ctx) {}
58+
// extend(config, ctx) {}
59+
},
60+
typescript: {
61+
typeCheck: false
5962
}
6063
}

package.json

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"build": "nuxt build",
1010
"start": "cross-env NODE_ENV=production node server/index.js",
1111
"generate": "nuxt generate",
12-
"lint": "eslint --ext .js,.vue --ignore-path .gitignore .",
12+
"lint": "eslint --ext .ts,.js,.vue --ignore-path .gitignore .",
1313
"test": "jest"
1414
},
1515
"lint-staged": {
@@ -21,19 +21,29 @@
2121
}
2222
},
2323
"dependencies": {
24-
"nuxt": "^2.0.0",
24+
"nuxt": "^2.6.3",
2525
"cross-env": "^5.2.0",
2626
"koa": "^2.6.2",
2727
"@nuxtjs/axios": "^5.3.6",
28-
"@nuxtjs/pwa": "^3.0.0-0"
28+
"@nuxtjs/pwa": "^3.0.0-0",
29+
"ts-node": "^8.2.0",
30+
"typescript": "^3.5.1",
31+
"nuxt-property-decorator": "^2.1.3"
2932
},
3033
"devDependencies": {
31-
"nodemon": "^1.18.9",
32-
"@nuxtjs/eslint-config": "^1.0.1",
33-
"@nuxtjs/eslint-module": "^1.0.0",
34+
"nodemon": "^1.18.11",
35+
"@nuxtjs/eslint-config": "^0.0.1",
36+
"@nuxtjs/eslint-module": "^0.0.1",
3437
"babel-eslint": "^10.0.1",
35-
"eslint": "^6.1.0",
38+
"eslint": "^5.15.1",
39+
"eslint-config-standard": ">=12.0.0",
40+
"eslint-plugin-import": ">=2.16.0",
41+
"eslint-plugin-jest": ">=22.3.0",
42+
"eslint-plugin-node": ">=8.0.1",
3643
"eslint-plugin-nuxt": ">=0.4.2",
44+
"eslint-plugin-promise": ">=4.0.1",
45+
"eslint-plugin-standard": ">=4.0.0",
46+
"eslint-plugin-vue": "^5.2.2",
3747
"eslint-config-prettier": "^4.1.0",
3848
"eslint-plugin-prettier": "^3.0.1",
3949
"prettier": "^1.16.4",
@@ -42,6 +52,9 @@
4252
"@vue/test-utils": "^1.0.0-beta.27",
4353
"babel-jest": "^24.1.0",
4454
"jest": "^24.1.0",
45-
"vue-jest": "^4.0.0-0"
55+
"vue-jest": "^4.0.0-0",
56+
"@nuxt/typescript": "^2.6.3",
57+
"@typescript-eslint/parser": "^1.9.0",
58+
"@typescript-eslint/eslint-plugin": "^1.9.0"
4659
}
4760
}

tsconfig.json

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

0 commit comments

Comments
 (0)