VUE项目配置ESlint后一些报错解决方式

//* 【==== 符号 ====】

// 强制所有控制语句使用一致的括号风格

‘curly’: [2, ‘multi-line’],

// 强制在代码块中使用一致的大括号风格

‘brace-style’: [2, ‘1tbs’, {‘allowSingleLine’: true}],

// 要求或禁止末尾逗号

‘comma-dangle’: [2, ‘never’],

// 强烈使用一致的反勾号``、双引号’‘或单引号’’

‘quotes’: [2, ‘single’, {

// 允许字符串使用单引号或者双引号,只要字符串中包含了一个其他引号,否则需要转义

‘avoidEscape’: true,

// 允许字符串使用反勾号

‘allowTemplateLiterals’: true

}],

// 禁止不必要的括号

‘no-extra-parens’: [2, ‘functions’],

// 要求使用 =和 !

‘eqeqeq’: [1, ‘allow-null’],

//* 【==== 空格 ====】

// 强制使用一致的缩进

‘indent’: [2, 2, {‘SwitchCase’: 1}],

// 禁止属性前有空白

‘no-whitespace-before-property’: 2,

// 强制generator函数中*号周围使用一致的空格

‘generator-star-spacing’: [2, {‘before’: true, ‘after’: true}],

// 强制在逗号前后使用一致的空格

‘comma-spacing’: [2, {‘before’: false, ‘after’: true}],

// 强制在逗号前后使用一致的空格

‘comma-style’: [2, ‘last’],

// 禁止在函数标识符和其调用之间有空格

‘func-call-spacing’: 2,

// 强制在块之前使用一致的空格

‘space-before-blocks’: [2, ‘always’],

// 要求操作符周围有空格

‘space-infix-ops’: 2,

// * 【==== 注释 ====】

// 强制在注释// 或/*使用一致的空格

‘spaced-comment’: [2, ‘always’, {‘markers’: [‘global’, ‘globals’, ‘eslint’, ‘eslint-disable’, ‘*package’, ‘!’, ‘,’]}],

// 禁止在字符串和注释之外不规则的空白

‘no-irregular-whitespace’: 2,

// 强制行注释的位置

‘line-comment-position’: [2, {‘position’: ‘above’}],

// 强制对多行注释使用特定风格

‘multiline-comment-style’: [2, ‘bare-block’],

// * 【==== 命名 ====】

// 要求使用 let 或 const 而不是 var

‘no-var’: 2,

// name 必填

‘vue/require-name-property’: 2,

// name名称强制kebab-case

‘vue/component-definition-name-casing’: [2, ‘kebab-case’],

// prop名称强制camelCase

‘vue/prop-name-casing’: [2, ‘camelCase’],

// 获取当前执行环境的上下文时,强制使用一致的命名(此处强制使用 ‘_this’)。

‘consistent-this’: [2, ‘_this’],

// 不允许标签与变量同名

‘no-label-var’: 2,

// 禁止将标识符定义为受限的名字

‘no-shadow-restricted-names’: 2,

// * 【==== 结构 ====】

‘vue/order-in-components’: [2, {

‘order’: [

‘el’,

‘name’,

‘key’,

‘parent’,

‘functional’,

‘mixins’,

[‘delimiters’, ‘comments’],

[‘components’, ‘directives’, ‘filters’],

‘extends’,

[‘provide’, ‘inject’],

‘ROUTER_GUARDS’,

‘layout’,

‘middleware’,

‘validate’,

‘scrollToTop’,

‘transition’,

‘loading’,

‘inheritAttrs’,

‘model’,

[‘props’, ‘propsData’],

‘emits’,

‘setup’,

‘asyncData’,

‘data’,

‘fetch’,

‘head’,

‘computed’,

‘watch’,

‘watchQuery’,

‘LIFECYCLE_HOOKS’,

‘methods’,

[‘template’, ‘render’],

‘renderError’

]

}],

// * 【==== 关闭配置 ====】

// 强制使用驼峰拼写法命名规定

‘camelcase’: [0, {‘properties’: ‘never’}],

// 未声明的变量,除非它们在/*global */注释中被提到

‘no-undef’: 0,

// 在注释中使用特定的警告术语

‘no-warning-comments’: 0,

// prop校验

‘vue/no-unused-properties’: 0,

// 使用指定的 import 加载的模块

‘no-restricted-imports’: 0,

最后

文章到这里就结束了,如果觉得对你有帮助可以点个赞哦

‘no-warning-comments’: 0,

// prop校验

‘vue/no-unused-properties’: 0,

// 使用指定的 import 加载的模块

‘no-restricted-imports’: 0,

最后

文章到这里就结束了,如果觉得对你有帮助可以点个赞哦

[外链图片转存中…(img-CKbXf245-1718041444781)]

  • 4
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值