From 55d5e79d7d58684c29e1eb00fbf93333319bc8e9 Mon Sep 17 00:00:00 2001
From: quanyawei <401863037@qq.com>
Date: Mon, 13 Nov 2023 11:49:47 +0800
Subject: [PATCH] fix:eslint配置
---
.prettierrc | 15 +++-
package-lock.json | 18 +++++-
.eslintrc.js | 11 +++
.vscode/settings.json | 120 ++++++++++++++++++++++++++++++++++++++++
package.json | 4 +
5 files changed, 158 insertions(+), 10 deletions(-)
diff --git a/.eslintrc.js b/.eslintrc.js
index 54bb8f5..7351902 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -9,11 +9,20 @@
node: true,
es6: true,
},
- extends: ['plugin:vue/recommended', 'eslint:recommended'],
+ extends: [/* vue 2 ������ */
+ "plugin:vue/recommended",
+ "plugin:vue/essential",
+ "plugin:vue/strongly-recommended",
+ /* vue 3 ������ */
+ // "plugin:vue/vue3-recommended"
+ // "plugin:vue/vue3-essential"
+ // "plugin:vue/vue3-strongly-recommended"
+ ],
// add your custom rules here
//it is base on https://github.com/vuejs/eslint-config-vue
rules: {
+ 'vue/no-unused-vars': 'error',
'eqeqeq': ['error', 'always'], // ���������������������������
'semi': 0, // ���������������������������������
'no-use-before-define': [1, 'nofunc'], // ������������������������
diff --git a/.prettierrc b/.prettierrc
index 015396c..267f26c 100644
--- a/.prettierrc
+++ b/.prettierrc
@@ -1,6 +1,11 @@
{
- "eslintIntegration": true,
- "singleQuote": true,
- "semi": false
- }
-
\ No newline at end of file
+ "useTabs": true,
+ "arrowParens": "avoid",
+ "printWidth": 120,
+ "tabWidth": 2,
+ "semi": true,
+ "singleQuote": true,
+ "bracketSpacing": true,
+ "endOfLine": "auto",
+ "trailingComma": "none"
+}
diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644
index 0000000..2d94aac
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,120 @@
+{
+ "workbench.iconTheme": "material-icon-theme",
+ "editor.fontSize": 16,
+ // -------------------- ������eslint --------------------
+ //autoFixedOnSave ���������������������������������������������������(>1.41.0)������
+ "editor.codeActionsOnSave": {
+ "source.fixAll.eslint": true
+ },
+ "eslint.format.enable": true,
+ //autoFix������������������������������������������������
+ "eslint.validate": ["javascript", "vue", "html", "javascriptreact", "vue-html"],
+ // -------------------- ������eslint --------------------
+ // ���������������������������������������
+ "editor.defaultFormatter": "esbenp.prettier-vscode",
+ "[html]": {
+ "editor.defaultFormatter": "esbenp.prettier-vscode"
+ },
+ "[javascript]": {
+ "editor.defaultFormatter": "esbenp.prettier-vscode"
+ },
+ "[css]": {
+ "editor.defaultFormatter": "esbenp.prettier-vscode"
+ },
+ "[less]": {
+ "editor.defaultFormatter": "esbenp.prettier-vscode"
+ },
+ "[json]": {
+ "editor.defaultFormatter": "esbenp.prettier-vscode"
+ },
+ //������������������������������
+ "javascript.format.insertSpaceBeforeFunctionParenthesis": false,
+ // -------------------- vetur ������ --------------------
+ // vue������������������������������vetur
+ "[vue]": {
+ "editor.defaultFormatter": "octref.vetur"
+ },
+ // ���������������������������������
+ "vetur.format.defaultFormatter.html": "js-beautify-html",
+ // ���vue������js���������������������ts���������������������
+ // "vetur.format.defaultFormatter.js": "vscode-typescript",
+ // ���vue������js���prettier��������������� ���������
+ "vetur.format.defaultFormatter.js": "prettier",
+ "vetur.format.defaultFormatterOptions": {
+ "js": "prettier",
+ "js-beautify-html": {
+ "wrap_attributes": "aligned-multiple" //������������������������������������������������������
+ },
+ "prettyhtml": {
+ "tabWidth": 4, // ���������vetur���tabSize������
+ "printWidth": 100, //������100������
+ "singleQuote": true, //���������������������
+ "semi": false, // ���������������;
+ "wrapAttributes": false,
+ "sortAttributes": false
+ },
+ //vue������js������
+ "prettier": {
+ "semi": false, // ���������������;
+ "singleQuote": true, //���������������������
+ "trailingComma": "none" //������������������������
+ }
+ },
+ // -------------------- vetur ������ --------------------
+ // -------------------- koro1FileHeader ������ --------------------
+ // ������������
+ "fileheader.customMade": {
+ "Author": "AuthorName",
+ "Date": "Do not edit", // ������������������(������)
+ "LastEditors": "AuthorName", // ���������������������
+ "LastEditTime": "Do not edit", // ������������������������
+ "Description": ""
+ // "FilePath": "only file name", // ���������������
+ // "custom_string_obkoro1_copyright": "Copyright (C) ${now_year} AuthorName. All rights reserved.",
+ // "custom_string_obkoro1_date": "Do not edit" // ������Date���������������
+ },
+ // ������������
+ "fileheader.cursorMode": {
+ "description": "",
+ //"custom_string_obkoro1": "",
+ "param": "params",
+ "return": ""
+ },
+ // ���������������
+ "fileheader.configObj": {
+ "createHeader": false, // ���������������������������������������������������
+ "autoAdd": false, // ������������������������������������������������������������������������
+ "openFunctionParamsCheck": true, //������������������������������������������������������
+ "createFileTime": true, // ������������������������������������������false������������������������������������
+ "dateFormat": "YYYY-MM-DD HH:mm:ss", // ���������������������������������������������������
+ // ���������������������������������������
+ "atSymbol": ["@", "@"], // ������������������������������������������������������ @
+ "colon": [": ", ": "] // ������������������������������������������������������ :
+ // ���������������������������Date���LastEditTime���LastEditors���Description���FilePath
+ // "specialOptions": {
+ // "Date": "since",
+ // "LastEditTime": "lastTime",
+ // "LastEditors": "LastAuthor",
+ // "Description": "message",
+ // "FilePath": "������������������������������"
+ // }
+ // ������������������
+ // "functionParamsShape": "normal", // ������
+ // "functionParamsShape": "no bracket", // ���������������
+ // "functionParamsShape": "no type", // ������������
+ // "functionParamsShape": [ "{", "}"], // ��������������������������������������� {}
+ // "functionTypeSymbol": "*", // ��������������������������������� *
+ // ������������������������������������ {*}
+ // "functionParamsShape": "no type", // ������������
+ // "functionTypeSymbol": "" // ��������������������������������� *
+ },
+ // -------------------- koro1FileHeader ������ --------------------
+ // -------------------- prettier ������(������������������������.js) --------------------
+ "prettier.useEditorConfig": false, // ���������editorConfig���������������������������
+ "prettier.semi": false, // ���������������;
+ "prettier.singleQuote": true, //���������������������
+ "prettier.trailingComma": "none", //������������������������
+ // -------------------- prettier ������ --------------------
+ "git.confirmSync": false,
+ "security.workspace.trust.untrustedFiles": "open"
+}
diff --git a/package-lock.json b/package-lock.json
index f988a1f..75b4342 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1881,6 +1881,12 @@
"uniq": "^1.0.1"
}
},
+ "prettier": {
+ "version": "1.16.3",
+ "resolved": "https://registry.npmmirror.com/prettier/-/prettier-1.16.3.tgz",
+ "integrity": "sha512-kn/GU6SMRYPxUakNXhpP0EedT/KmaPzr0H5lIsDogrykbaxOpOfAFfk5XA7DZrJyMAv1wlMV3CPcZruGXVVUZw==",
+ "dev": true
+ },
"source-map": {
"version": "0.6.1",
"resolved": "https://registry.npm.taobao.org/source-map/download/source-map-0.6.1.tgz",
@@ -6923,6 +6929,12 @@
}
}
}
+ },
+ "eslint-config-prettier": {
+ "version": "9.0.0",
+ "resolved": "https://registry.npmmirror.com/eslint-config-prettier/-/eslint-config-prettier-9.0.0.tgz",
+ "integrity": "sha512-IcJsTkJae2S35pRsRAwoCE+925rJJStOdkKnLVgtE+tEpqU0EVVM7OqrwxqgptKdX29NUwC82I5pXsGFIgSevw==",
+ "dev": true
},
"eslint-config-standard": {
"version": "10.2.1",
@@ -16349,9 +16361,9 @@
"dev": true
},
"prettier": {
- "version": "1.16.3",
- "resolved": "https://registry.npm.taobao.org/prettier/download/prettier-1.16.3.tgz?cache=0&sync_timestamp=1606523097359&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fprettier%2Fdownload%2Fprettier-1.16.3.tgz",
- "integrity": "sha1-jGIWhFO63vcC80tFtu6JlXSmpl0=",
+ "version": "3.0.3",
+ "resolved": "https://registry.npmmirror.com/prettier/-/prettier-3.0.3.tgz",
+ "integrity": "sha512-L/4pUDMxcNa8R/EthV08Zt42WBO4h1rarVtK0K+QJG0X187OLo7l699jWw0GKuwzkPQ//jMFA/8Xm6Fh3J/DAg==",
"dev": true
},
"pretty": {
diff --git a/package.json b/package.json
index fd246cd..693d277 100644
--- a/package.json
+++ b/package.json
@@ -75,6 +75,7 @@
"chalk": "2.4.2",
"connect": "3.6.6",
"eslint": "^5.16.0",
+ "eslint-config-prettier": "^9.0.0",
"eslint-config-standard": "^10.2.1",
"eslint-friendly-formatter": "^3.0.0",
"eslint-loader": "^1.7.1",
@@ -86,6 +87,7 @@
"eslint-plugin-vue": "^5.2.3",
"html-webpack-plugin": "3.2.0",
"mockjs": "1.0.1-beta3",
+ "prettier": "3.0.3",
"runjs": "^4.3.2",
"sass-loader": "^7.1.0",
"script-ext-html-webpack-plugin": "2.1.3",
@@ -107,4 +109,4 @@
"**/@vue/cli-plugin-eslint",
"**/@vue/cli-plugin-eslint/**"
]
-}
\ No newline at end of file
+}
--
Gitblit v1.8.0