error: Unexpected console statement (no-console)

本文介绍如何在Vue项目中禁用控制台日志输出,包括通过修改package.json文件中的eslint配置来允许console.log的使用,以及直接使用window.console.log替代的方法。

nodejs的vue项目

1、修改package.json中的eslintConfig:{} 中的 “rules”:{},增加一行代码: "no-console":"off"

"eslintConfig": {
    "root": true,
    "env": {
      "node": true
    },
    "extends": [
      "plugin:vue/essential",
      "eslint:recommended"
    ],
    "rules": {
      "no-console": "off"
    },
    "parserOptions": {
      "parser": "babel-eslint"
    }
  },

 

2、或直接修改方法用 window.console.log("test")

 

转:https://www.cnblogs.com/qiu2841/p/11820750.html

[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、付费专栏及课程。

余额充值