Skip to content

Commit

Permalink
fix(template): 添加 @typescript-eslint/eslint-plugin 并更新模版配置 #5207
Browse files Browse the repository at this point in the history
  • Loading branch information
Garfield550 committed Dec 30, 2019
1 parent ed6f261 commit 899dacf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
13 changes: 10 additions & 3 deletions packages/taro-cli/templates/default/_eslintrc
Original file line number Diff line number Diff line change
@@ -1,19 +1,26 @@
{
<%if (!locals.typescript) {-%>
"extends": ["taro"],
"rules": {
"no-unused-vars": ["error", { "varsIgnorePattern": "Taro" }],
"react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx", ".tsx"] }]
},
<%if (!locals.typescript) {-%>
"parser": "babel-eslint"
<%} else { -%>
<%} else {-%>
"extends": ["taro", "plugin:@typescript-eslint/recommended"],
"parser": "@typescript-eslint/parser",
"rules": {
"no-unused-vars": ["error", { "varsIgnorePattern": "Taro" }],
"react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx", ".tsx"] }],
"@typescript-eslint/explicit-function-return-type": 0,
"@typescript-eslint/no-empty-function": ["warn"]
},
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"useJSXTextNode": true,
"project": "./tsconfig.json"
}
<%}-%>
<%}-%>
}
3 changes: 2 additions & 1 deletion packages/taro-cli/templates/default/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@
"stylelint-config-taro-rn": "<%= version %>",
"stylelint-taro-rn": "<%= version %>",
"eslint-plugin-taro": "<%= version %>"<% if (typescript) {%>,
"@typescript-eslint/parser": "^1.6.0",
"@typescript-eslint/eslint-plugin": "^2.13.0",
"@typescript-eslint/parser": "^2.13.0",
"typescript": "^3.0.1"<%}%>
}
}

0 comments on commit 899dacf

Please sign in to comment.