error ‘test‘ is assigned a value but never used no-unused-vars

本文介绍了当使用eslint-loader进行语法检查时遇到'test'变量未使用导致的错误信息。通过在vue.config.js中配置关闭lintOnSave选项,可以消除该报错。重新启动项目后,报错信息成功消失,这是一个快速解决eslint未使用变量警告的方法。

1、相关报错信息

error  'test' is assigned a value but never used  no-unused-vars

2、报错原因

使用了eslint-loader进行了相关的语法检查,因为test变量没有被使用过,不符合相关的语法规则,则报错输出。

3、关闭相关语法检查

  1. 在相关项目的根目录下新建vue.config.js文件
    在这里插入图片描述
  2. vue.config.js文件中进行如下配置
module.exports = {
    // 关闭语法检查
    lintOnSave: false
}
  1. 最后重新启动项目后发现相关的报错信息消失

具体可参见:Vue CLI 配置参数

由于错误,无法检查工作树中是否有未合并的文件。 Progress: resolved 1, reused 0, downloaded 0, added 0 Progress: resolved 35, reused 34, downloaded 1, added 0 Packages: +39 +++++++++++++++++++++++++++++++++++++++ Progress: resolved 39, reused 38, downloaded 1, added 39, done [33m[STARTED] Backing up original state... [32m[COMPLETED] Backed up original state in git stash (a8ccf171) [33m[STARTED] Running tasks for staged files... [33m[STARTED] package.json — 14 files [33m[STARTED] src/**/*.{js,vue} — 14 files [33m[STARTED] eslint --fix [31m[FAILED] eslint --fix [FAILED] [31m[FAILED] eslint --fix [FAILED] [32m[COMPLETED] Running tasks for staged files... [33m[STARTED] Applying modifications from tasks... [33m[SKIPPED] Skipped because of errors from tasks. [33m[STARTED] Reverting to original state because of errors... [32m[COMPLETED] Reverting to original state because of errors... [33m[STARTED] Cleaning up temporary files... [32m[COMPLETED] Cleaning up temporary files... ✖ eslint --fix: (node:59904) ExperimentalWarning: Importing JSON modules is an experimental feature and might change at any time (Use `node --trace-warnings ...` to show where the warning was created) D:\purchase-receipt-sys\src\api\new-product\purchase-follow.js 199:1 warning Missing JSDoc @returns description jsdoc/require-returns-description 225:1 warning Missing JSDoc @returns description jsdoc/require-returns-description D:\purchase-receipt-sys\src\views\new-product\purchase-follow\children\offer-entry\index.vue 34:7 error 'components' is assigned a value but never used. Allowed unused vars must match /^_/u ts/no-unused-vars 38:9 error 'PRODUCT_CATEGORY' is assigned a value but never used. Allowed unused vars must match /^_/u ts/no-unused-vars 64:10 warning 'getNowTime' was used before it was defined ts/no-use-before-define 167:28 error 'rule' is defined but never used. Allowed unused args must match /^_/u ts/no-unused-vars 465:18 error This line has 2 statements. Maximum allowed is 1 style/max-statements-per-line 466:3 warning 'loading' was used before it was defined ts/no-use-before-define 472:5 warning 'loading' was used before it was defined ts/no-use-before-define 487:18 error 'upload' is assigned a value but never used. Allowed unused vars must match /^_/u ts/no-unused-vars 519:40 error Irregular whitespace not allowed no-irregular-whitespace 519:40 error Irregular whitespace not allowed vue/no-irregular-whitespace 519:43 error Irregular whitespace not allowed no-irregular-whitespace 519:43 error Irregular whitespace not allowed vue/no-irregular-whitespace 519:45 error Irregular whitespace not allowed no-irregular-whitespace 519:45 error Irregular whitespace not allowed vue/no-irregular-whitespace 519:60 error Irregular whitespace not allowed no-irregular-whitespace 519:60 error Irregular whitespace not allowed vue/no-irregular-whitespace 520:42 error Irregular whitespace not allowed no-irregular-whitespace 520:42 error Irregular whitespace not allowed vue/no-irregular-whitespace 520:45 error Irregular whitespace not allowed no-irregular-whitespace 520:45 error Irregular whitespace not allowed vue/no-irregular-whitespace 520:47 error Irregular whitespace not allowed no-irregular-whitespace 520:47 error Irregular whitespace not allowed vue/no-irregular-whitespace 520:62 error Irregular whitespace not allowed no-irregular-whitespace 520:62 error Irregular whitespace not allowed vue/no-irregular-whitespace 619:3 warning 'getPaymentDaysType' was used before it was defined ts/no-use-before-define 648:7 error 'purchaseData' is assigned a value but never used. Allowed unused vars must match /^_/u ts/no-unused-vars 660:7 warning 'defaultAssignment' was used before it was defined ts/no-use-before-define 802:20 warning 'findValueFromQCArea' was used before it was defined ts/no-use-before-define 802:40 warning 'qcAreaList' was used before it was defined ts/no-use-before-define D:\purchase-receipt-sys\src\views\new-product\purchase-follow\children\purchase-detail\components\quote-information.vue 2:7 error 'props' is assigned a value but never used. Allowed unused vars must match /^_/u ts/no-unused-vars 103:34 warning Unexpected mutation of "data" prop vue/no-mutating-props 135:34 warning Unexpected mutation of "data" prop vue/no-mutating-props 143:34 warning Unexpected mutation of "data" prop vue/no-mutating-props D:\purchase-receipt-sys\src\views\new-product\purchase-follow\children\sample-edit\index.vue 49:28 error 'rule' is defined but never used. Allowed unused args must match /^_/u ts/no-unused-vars 94:23 error 'val' is defined but never used. Allowed unused args must match /^_/u ts/no-unused-vars 115:40 error Irregular whitespace not allowed no-irregular-whitespace 115:40 error Irregular whitespace not allowed vue/no-irregular-whitespace 115:43 error Irregular whitespace not allowed no-irregular-whitespace 115:43 error Irregular whitespace not allowed vue/no-irregular-whitespace 115:45 error Irregular whitespace not allowed no-irregular-whitespace 115:45 error Irregular whitespace not allowed vue/no-irregular-whitespace 115:60 error Irregular whitespace not allowed no-irregular-whitespace 115:60 error Irregular whitespace not allowed vue/no-irregular-whitespace 116:42 error Irregular whitespace not allowed no-irregular-whitespace 116:42 error Irregular whitespace not allowed vue/no-irregular-whitespace 116:45 error Irregular whitespace not allowed no-irregular-whitespace 116:45 error Irregular whitespace not allowed vue/no-irregular-whitespace 116:47 error Irregular whitespace not allowed no-irregular-whitespace 116:47 error Irregular whitespace not allowed vue/no-irregular-whitespace 116:62 error Irregular whitespace not allowed no-irregular-whitespace 116:62 error Irregular whitespace not allowed vue/no-irregular-whitespace 153:50 error 'visitedViews' is defined but never used. Allowed unused args must match /^_/u ts/no-unused-vars 201:8 warning 'changeCompletionTime' was used before it was defined ts/no-use-before-define 242:7 error 'StatusMap' is assigned a value but never used. Allowed unused vars must match /^_/u ts/no-unused-vars D:\purchase-receipt-sys\src\views\product\product-management\children\product-enter\components\basic-info.vue 48:7 error 'components' is assigned a value but never used. Allowed unused vars must match /^_/u ts/no-unused-vars 107:18 error 'upload' is assigned a value but never used. Allowed unused vars must match /^_/u ts/no-unused-vars 140:24 warning 'handleExceed' was used before it was defined ts/no-use-before-define 161:52 error This line has 2 statements. Maximum allowed is 1 style/max-statements-per-line 166:5 warning Unexpected mutation of "modelValue" prop vue/no-mutating-props 181:3 warning Unexpected mutation of "modelValue" prop vue/no-mutating-props 194:3 warning 'myCountryList' was used before it was defined t ...
09-20
[plugin:vite-plugin-eslint] D:\物联网\src\views\SceneManagement\list\index.vue 6:14 warning Expected a linebreak before this attribute vue/first-attribute-linebreak 16:78 warning Attribute "v-if" should go before ":content" vue/attributes-order 19:39 warning Attribute "v-else" should go before "class" vue/attributes-order 36:23 warning Expected a linebreak before this attribute vue/first-attribute-linebreak 38:23 warning Expected a linebreak before this attribute vue/first-attribute-linebreak 41:19 warning Expected a linebreak before this attribute vue/first-attribute-linebreak 86:23 warning Expected a linebreak before this attribute vue/first-attribute-linebreak 88:23 warning Expected a linebreak before this attribute vue/first-attribute-linebreak 108:24 warning Expected a linebreak before this attribute vue/first-attribute-linebreak 122:27 warning Expected a linebreak before this attribute vue/first-attribute-linebreak 132:22 warning Expected a linebreak before this attribute vue/first-attribute-linebreak 136:26 warning Expected a linebreak before this attribute vue/first-attribute-linebreak 148:37 warning Expected a linebreak before this attribute vue/first-attribute-linebreak 151:30 warning Expected a linebreak before this attribute vue/first-attribute-linebreak 156:31 warning Expected a linebreak before this attribute vue/first-attribute-linebreak 169:14 warning Expected a linebreak before this attribute vue/first-attribute-linebreak 225:27 warning Expected a linebreak before this attribute vue/first-attribute-linebreak 228:24 warning Expected a linebreak before this attribute vue/first-attribute-linebreak 268:19 warning Expected a linebreak before this attribute vue/first-attribute-linebreak 282:14 warning Expected a linebreak before this attribute vue/first-attribute-linebreak 299:19 warning Expected a linebreak before this attribute vue/first-attribute-linebreak 322:20 warning Expected a linebreak before this attribute vue/first-attribute-linebreak 331:24 warning Expected a linebreak before this attribute vue/first-attribute-linebreak 349:23 warning Expected a linebreak before this attribute vue/first-attribute-linebreak 364:15 warning 'Dayjs' is defined but never used @typescript-eslint/no-unused-vars 365:96 warning 'GetIrCtrlCode' is defined but never used @typescript-eslint/no-unused-vars 365:128 warning 'sendDoorControls' is defined but never used @typescript-eslint/no-unused-vars 365:146 warning 'setAirConditionParams' is defined but never used @typescript-eslint/no-unused-vars 365:233 warning 'GetModelOutputItem' is defined but never used @typescript-eslint/no-unused-vars 372:8 warning 'D:\物联网\node_modules\@arco-design\web-vue\es\icon\index.d.ts' imported multiple times import/no-duplicates 374:3 warning 'IconCalendar' is defined but never used @typescript-eslint/no-unused-vars 375:3 warning 'IconHome' is defined but never used @typescript-eslint/no-unused-vars 376:3 warning 'IconLeft' is defined but never used @typescript-eslint/no-unused-vars 377:3 warning 'IconRight' is defined but never used @typescript-eslint/no-unused-vars 378:8 warning 'D:\物联网\node_modules\@arco-design\web-vue\es\icon\index.d.ts' imported multiple times import/no-duplicates 380:8 warning 'axios' is defined but never used @typescript-eslint/no-unused-vars 381:8 warning 'JsSHA' is defined but never used @typescript-eslint/no-unused-vars 382:10 warning 'generateEventConfig' is defined but never used @typescript-eslint/no-unused-vars 388:8 warning 'DateCell' is defined but never used @typescript-eslint/no-unused-vars 456:5 error The "OperationBar" component has been registered but not used vue/no-unused-components 601:14 warning 'getStatusText' is defined but never used @typescript-eslint/no-unused-vars 611:14 warning 'getPatternText' is defined but never used @typescript-eslint/no-unused-vars 621:14 warning 'getSpeedText' is defined but never used @typescript-eslint/no-unused-vars 651:14 warning 'getControlText' is defined but never used @typescript-eslint/no-unused-vars 660:14 warning 'getDeviceNameByDoorId' is defined but never used @typescript-eslint/no-unused-vars 1064:13 warning Unexpected console statement no-console 1186:9 warning Unexpected console statement no-console 1188:9 warning Unexpected console statement no-console 1234:9 warning Unexpected console statement no-console 1266:9 warning Unexpected console statement no-console 1269:9 warning Unexpected console statement no-console 1304:7 warning Unexpected console statement no-console 1305:7 warning Unexpected console statement no-console 1308:9 warning Unexpected console statement no-console 1343:15 warning Unexpected console statement no-console 1410:7 warning Unexpected console statement no-console 1419:11 warning Unexpected console statement no-console 1426:11 warning Unexpected console statement no-console 1432:11 warning Unexpected console statement no-console 1437:7 warning Unexpected console statement no-console 1536:15 warning Unexpected console statement no-console 1642:9 warning Unexpected console statement no-console 1644:9 warning Unexpected console statement no-console 1668:13 warning Unexpected console statement no-console 1801:7 warning Unexpected console statement no-console 1803:7 warning Unexpected console statement no-console 1804:7 warning Unexpected console statement no-console 1809:9 warning Unexpected console statement no-console 1813:9 warning Unexpected console statement no-console 1838:14 warning 'fillDetailFormFromChannelList' is defined but never used @typescript-eslint/no-unused-vars 1906:7 warning Unexpected console statement no-console 1917:11 warning 'sendControl' is assigned a value but never used @typescript-eslint/no-unused-vars 1953:7 warning Unexpected console statement no-console 1968:9 warning Unexpected console statement no-console 1970:9 warning Unexpected console statement no-console 2062:9 warning Unexpected console statement no-console 2064:9 warning Unexpected console statement no-console 2068:9 warning Unexpected console statement no-console 2070:9 warning Unexpected console statement no-console 2091:9 warning Unexpected console statement no-console 2092:9 warning Unexpected console statement no-console 2095:9 warning Unexpected console statement no-console 2096:9 warning Unexpected console statement no-console 2102:9 warning Unexpected console statement no-console 2122:13 warning Unexpected console statement no-console 2126:11 warning Unexpected console statement no-console 2134:11 warning Unexpected console statement no-console 2138:9 warning Unexpected console statement no-console 2145:9 warning Unexpected console statement no-console 2146:9 warning Unexpected console statement no-console 2149:9 warning Unexpected console statement no-console 2150:9 warning Unexpected console statement no-console 2154:9 warning Unexpected console statement no-console 2156:9 warning Unexpected console statement no-console 2231:7 warning Unexpected console statement no-console 2258:9 warning Unexpected console statement no-console 2259:9 warning Unexpected console statement no-console 2356:7 warning Unexpected console statement no-console 2360:7 warning Unexpected console statement no-console ✖ 99 problems (1 error, 98 warnings) 0 errors and 25 warnings potentially fixable with the `--fix` option. D:/物联网/src/views/SceneManagement/list/index.vue at formatError (file:///D:/%E7%89%A9%E8%81%94%E7%BD%91/node_modules/vite/dist/node/chunks/dep-3e87c7b2.js:40359:46) at TransformContext.error (file:///D:/%E7%89%A9%E8%81%94%E7%BD%91/node_modules/vite/dist/node/chunks/dep-3e87c7b2.js:40355:19) at TransformContext.transform (D:\物联网\node_modules\vite-plugin-eslint\dist\index.js:1:2469) at async Object.transform (file:///D:/%E7%89%A9%E8%81%94%E7%BD%91/node_modules/vite/dist/node/chunks/dep-3e87c7b2.js:40612:30) at async loadAndTransform (file:///D:/%E7%89%A9%E8%81%94%E7%BD%91/node_modules/vite/dist/node/chunks/dep-3e87c7b2.js:36998:29 Click outside or fix the code to dismiss. You can also disable this overlay by setting server.hmr.overlay to false in vite.config.js.
最新发布
09-26
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值