vue3 - .eslintrc.js配置,包括开启debugger 等能力
在 package.json 文件 的 eslintConfig 配置部分加入
"no-debugger": "off", "no-console": "off",
意思为让eslint将debugger开启,并开启控制台

也可以在 .eslintrc.js 文件 里添加,这是等效的,因为 .eslintrc.js是eslint的专属配置文件,同时其配置也可以写在 package.json 文件中

这是我常用的.eslintrc.js配置
module.exports = { root: true, env: { node: true, "vue/setup-compiler-macros": true }, extends: [ "plugin:vue/vue3-essential", "eslint:recommended", "@vue/typescript/recommended", "@vue/prettier" ], parserOptions: { ecmaVersion: 2020, ecmaFeatures: { jsx: true } }, rules: { "no-console": "off", "no-debugger": "off", "generator-star-spacing": "off", "no-tabs": "off", "no-unused-vars": "off", "no-irregular-whitespace": "off", "@typescript-eslint/no-explicit-any": ["off"], "@typescript-eslint/no-var-requires": 0, "vue/multi-word-component-names": "off" } };
意思如下
开启控制台
"no-console": "off",
开启debugger "no-debugger": "off",
关闭代码编写时以空格开头 "generator-star-spacing": "off",
开启代码编写时可写tab键 "no-tabs": "off",
开启var定义 "no-unused-vars": "off",
开启不规则空白 "no-irregular-whitespace": "off",
关闭泛型为any的报错 "@typescript-eslint/no-explicit-any": ["off"],
使用require()方法引入文件赋值给常量时,关闭报错 "@typescript-eslint/no-var-requires": 0,
关闭强制组件命名时必须多个并驼峰名称 "vue/multi-word-component-names": "off"
本文来自博客园,作者:岑惜,转载请注明原文链接:https://www.cnblogs.com/c2g5201314/p/17271703.html
响应开源精神相互学习,内容良币驱除劣币

浙公网安备 33010602011771号