坑爹的eslint配置

标题eslint 版本不一致 导致很多问题 比如无法保存的时候校验,首行缩进无效等 babel-eslint这个依赖的版本不一致非常坑

vscode我这里保存下两个版本下的配置
插件eslint 自己下载

1.webpack创建的项目

eslint版本
“eslint”: “^4.19.1”,
“eslint-friendly-formatter”: “4.0.1”,
“eslint-loader”: “2.0.0”,
“eslint-plugin-html”: “^6.0.2”,
“eslint-plugin-vue”: “4.7.1”,
“babel-eslint”: “^7.2.3”,

2.vue-cli项目

“eslint”: “^6.7.2”,
“eslint-plugin-html”: “^6.0.2”,
“eslint-plugin-import”: “^2.20.2”,
“eslint-plugin-vue”: “^6.2.2”,
“@vue/eslint-config-airbnb”: “^5.0.2”,
“babel-eslint”: “8.0.1”,
“@vue/cli-plugin-eslint”: “~4.4.0”,

公共的.vscode文件 保存时走selint校验

// 将设置放入此文件中以覆盖默认值和用户设置。
{// 配置语言关联优先级"files.associations": {"*.vue": "vue"},// 保存格式化"files.autoSave": "off",// eslint检查的文件类型"eslint.validate": ["javascript","javascriptreact",{"language": "vue","autoFix": true}],"eslint.options": {"plugins": ["html"]},// 保存时校验 走eslint 自动格式化"eslint.enable": true,"editor.codeActionsOnSave": {"source.fixAll.eslint": "explicit"},//配置内配置对 .vue 文件的格式化"[vue]": {"editor.defaultFormatter": "rvest.vs-code-prettier-eslint"},//配置内配置对 .ts 文件的格式化"[typescript]": {"editor.defaultFormatter": "esbenp.prettier-vscode"},//配置内配置对 .js 文件的格式化"[javascript]": {"editor.defaultFormatter": "esbenp.prettier-vscode"},//配置内配置对 .json 文件的格式化"[jsonc]": {"editor.defaultFormatter": "esbenp.prettier-vscode"},"git.mergeEditor": false,"merge-conflict.autoNavigateNextConflict.enabled": true,"i18n-ally.localesPaths": ["src/lang"],"vetur.languageFeatures.semanticTokens": false,
}

.eslintrc.js

module.exports = {globals: {'SdAgent': false},root: true,parserOptions: {parser: 'babel-eslint',sourceType: 'module'},env: {browser: true,node: true,jquery: true,es6: true,},extends: ['plugin:vue/recommended', 'eslint:recommended'],// add your custom rules here//it is base on https://github.com/vuejs/eslint-config-vuerules: {"vue/html-self-closing": 0,"vue/max-attributes-per-line": [2, {"singleline": 5,"multiline": {"max": 1,"allowFirstLine": false}}],"vue/name-property-casing": ["error", "PascalCase"],'accessor-pairs': 2,'arrow-spacing': [2, {'before': true,'after': true}],'block-spacing': [2, 'always'],'brace-style': [2, '1tbs', {'allowSingleLine': true}],'camelcase': [0, {'properties': 'always'}],'comma-dangle': [2, 'never'],'comma-spacing': [2, {'before': false,'after': true}],"no-unused-vars":"off",'comma-style': [2, 'last'],'constructor-super': 2,'curly': [2, 'multi-line'],'dot-location': [2, 'property'],'eol-last': 2,'eqeqeq': [2, 'allow-null'],'generator-star-spacing': [2, {'before': true,'after': true}],'handle-callback-err': [2, '^(err|error)$'],'indent': [2, 2, {'SwitchCase': 1}],'jsx-quotes': [2, 'prefer-single'],'key-spacing': [2, {'beforeColon': false,'afterColon': true}],'keyword-spacing': [2, {'before': true,'after': true}],'new-cap': [2, {'newIsCap': true,'capIsNew': false}],'new-parens': 2,'no-array-constructor': 2,'no-caller': 2,'no-console': 'off','no-class-assign': 2,'no-cond-assign': 2,'no-const-assign': 2,'no-control-regex': 0,'no-debugger': 0,'no-delete-var': 2,'no-dupe-args': 2,'no-dupe-class-members': 2,'no-dupe-keys': 2,'no-duplicate-case': 2,'no-empty-character-class': 2,'no-empty-pattern': 2,'no-eval': 2,'no-ex-assign': 2,'no-extend-native': 0,'no-extra-bind': 2,'no-extra-boolean-cast': 2,'no-extra-parens': [2, 'functions'],'no-fallthrough': 2,'no-floating-decimal': 2,'no-func-assign': 2,'no-implied-eval': 2,'no-inner-declarations': [2, 'functions'],'no-invalid-regexp': 2,'no-irregular-whitespace': 2,'no-iterator': 2,'no-label-var': 2,'no-labels': [2, {'allowLoop': false,'allowSwitch': false}],'no-lone-blocks': 2,'no-mixed-spaces-and-tabs': 2,'no-multi-spaces': 2,'no-multi-str': 2,'no-multiple-empty-lines': [2, {'max': 1}],'no-native-reassign': 2,'no-negated-in-lhs': 2,'no-new-object': 2,'no-new-require': 2,'no-new-symbol': 2,'no-new-wrappers': 2,'no-obj-calls': 2,'no-octal': 2,'no-octal-escape': 2,'no-path-concat': 2,'no-proto': 2,'no-redeclare': 2,'no-regex-spaces': 2,'no-return-assign': [2, 'except-parens'],'no-self-assign': 2,'no-self-compare': 2,'no-sequences': 2,'no-shadow-restricted-names': 2,'no-spaced-func': 2,'no-sparse-arrays': 2,'no-this-before-super': 2,'no-throw-literal': 2,'no-trailing-spaces': 2,'no-undef': 2,'no-undef-init': 2,'no-unexpected-multiline': 2,'no-unmodified-loop-condition': 2,'no-unneeded-ternary': [2, {'defaultAssignment': false}],'no-unreachable': 2,'no-unsafe-finally': 2,// 'no-unused-vars': [2, {//   'vars': 'all',//   'args': 'none'// }],'no-useless-call': 2,'no-useless-computed-key': 2,'no-useless-constructor': 2,'no-useless-escape': 0,'no-whitespace-before-property': 2,'no-with': 2,'one-var': 0,'operator-linebreak': [2, 'after', {'overrides': {'?': 'before',':': 'before'}}],'padded-blocks': [2, 'never'],'quotes': [2, 'single', {'avoidEscape': true,'allowTemplateLiterals': true}],'semi': [2, 'never'],'semi-spacing': [2, {'before': false,'after': true}],'space-before-blocks': [2, 'always'],'space-before-function-paren': [2, 'never'],'space-in-parens': [2, 'never'],'space-infix-ops': 2,'vue/require-default-prop':0,'space-unary-ops': [2, {'words': true,'nonwords': false}],'spaced-comment': [2, 'always', {'markers': ['global', 'globals', 'eslint', 'eslint-disable', '*package', '!', ',']}],'template-curly-spacing': [2, 'never'],'use-isnan': 2,'valid-typeof': 2,'wrap-iife': [2, 'any'],'yield-star-spacing': [2, 'both'],'yoda': [2, 'never'],'prefer-const': 0,// 'no-': process.env.NODE_ENV === 'production' ? 2 : 0,'object-curly-spacing': [2, 'always', {objectsInObjects: false}],'array-bracket-spacing': [2, 'never'],'no-self-assign':0,'no-return-assign':0,'vue/order-in-components':0,'no-case-declarations':0}
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/772371.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

蓝桥杯刷题8

1. 世纪末的星期 import java.util.Calendar; public class Main {public static void main(String[] args) {Calendar calendar Calendar.getInstance();for(int year 1999;year<100000;year100){calendar.set(Calendar.YEAR,year);calendar.set(Calendar.MONTH,11);cale…

小苯的回文询问(

题目 离散化存储 #include<bits/stdc.h> using namespace std; #define int long long const int N2e59; int n,q,ans[N],a[N]; map<int,int> mp; vector<pair<int,int>>qr[N]; signed main(){ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);c…

前端面试拼图-数据结构与算法(二)

摘要&#xff1a;最近&#xff0c;看了下慕课2周刷完n道面试题&#xff0c;记录下... 1. 求一个二叉搜索树的第k小值 二叉树(Binary Tree) 是一棵树 每个节点最多两个子节点 树节点的数据结构{value, left?, right?} 二叉树的遍历 前序遍历&#xff1a;root→left→right 中…

C/C++ 语言中的 ​if...else if...else 语句

C/C 语言中的 ​if...else if...else 语句 1. if statement2. if...else statement3. if...else if...else statementReferences 1. if statement The syntax of the if statement is: if (condition) {// body of if statement }The code inside { } is the body of the if …

聚合支付评级较低的机构能否提升评级

聚合支付机构完成备案是合规展业的第一步&#xff0c;同时&#xff0c;一年一度评级结果对其业务开展和收单机构合作发展具有重要的作用&#xff0c;如若评级较低&#xff0c;将影响到其参与商业银行的外包业务投标&#xff0c;支付机构合作协议签署及合作事宜。 近期&#xf…

Chrome浏览器修改网页内容

方法一&#xff1a;使用开发者工具 在Chrome浏览器中打开要修改的网页。按下F12键打开开发者工具。在开发者工具窗口中&#xff0c;找到“Elements”标签页。在“Elements”标签页中&#xff0c;找到要修改的网页元素。双击要修改的网页元素&#xff0c;即可进行编辑。 方法二…

AIGC 训练场景下的存储特征研究

云布道师 引言&#xff1a;在传统块存储大行其道的时代&#xff0c;需要针对很多行业的工作负载&#xff08;Workload&#xff09;进行调研&#xff0c;包含块大小、随机读、读写比例等等。知道行业的 Workload 对于预估业务的 I/OPS、时延、吞吐等性能有很好的指导意义&#…

Cadence——生成Gerber制板文件

软件版本&#xff1a;Cadence SPB OrCAD Allegro 16.6 打开Allegro PCB Designer 选择如下选项&#x1f447; 点击 File–>Open&#xff0c;找到对应的.brd文件 电气错误的检查&#xff1a;点击 Display–>Status&#xff0c;全为绿色则没有错误 按照不同的项目来进…

自幂数之水仙花数(从0开始)

文章目录 概要整体架构流程代码实现小结 概要 水仙花数&#xff08;Narcissistic number&#xff09;也被称为超完全数字不变数&#xff08;pluperfect digital invariant, PPDI&#xff09;、自恋数、自幂数、阿姆斯壮数或阿姆斯特朗数&#xff08;Armstrong number&#xff…

基于stm32与TJC3224T124_011串口屏的PID调参器(附完整工程)

电赛在即&#xff0c;每次比赛调PID都是一件比较繁琐的事。每次都要在程序中改完再烧录到板子上&#xff0c;特别耗时。正好最近发现实验室的一块串口屏比较好玩。 于是就做了这个调PID的东西。它可以通过串口直接修改PID的值&#xff0c;从而达到快速调PID的目的。下面我将完整…

C++学习笔记(lambda函数)

C learning note 1、lambda函数的语法2、lambda函数的几种用法 1、lambda函数的语法 lambda函数的一般语法如下&#xff1a; [ capture_clause ] ( parameters ) -> return_type {function_body }capture_clause&#xff1a;需要捕获的变量&#xff0c;但要求该变量必须在…

【办公类-16-07-07】“2023下学期 中班户外游戏2(有场地和无场地版,每天不同场地)”(python 排班表系列)

作品展示 背景需求&#xff1a; 2024年2月教务组发放的是“每周五天内容相同&#xff0c;两周10天内容相同”的户外游戏安排 【办公类-16-07-05】合并版“2023下学期 大班户外游戏&#xff08;有场地和无场地版&#xff0c;两周一次&#xff09;”&#xff08;python 排班表系…

探索未来智能的奥秘

文章目录 前言 前言 随着科技的不断进步&#xff0c;人工智能(AI)已逐渐渗透到我们生活的方方面面。而在AI的众多分支中&#xff0c;大模型技术无疑是一个备受瞩目的领域。本文将带领大家走进AI大模型的世界&#xff0c;一同探索其奥秘。 AI大模型&#xff0c;顾名思义&#…

YOLOv7 | 注意力机制 | 添加ECA注意力机制

目录 原理简介 代码实现 yaml文件实现&#xff08;tips&#xff1a;可以添加不同的位置&#xff09; 检查是否添加执行成功 完整代码分享 论文创新必备&#xff08;可帮忙做实验&#xff09; 启动命令 ECA是通道注意力机制的一种实现形式&#xff0c;是基于SE的扩展。…

Data Interpreter: An LLM Agent For Data Science 论文解读

论文地址&#xff1a;https://arxiv.org/abs/2402.18679 Github&#xff1a;MetaGPT: The Multi-Agent Framework 数据解释器&#xff08;Data Interpreter&#xff09;是一个基于大型语言模型&#xff08;LLM&#xff09;的代理&#xff0c;专门为解决数据科学问题而设计。它…

互联网摸鱼日报(2024-03-21)

互联网摸鱼日报(2024-03-21) 36氪新闻 金山云Q4营收17.22亿元&#xff0c;技术创新驱动收入规模和盈利能力双增长 iOS 18是苹果AI的答卷&#xff1f;你或许并不懂手机AI 2024年&#xff0c;广告主市场预算真的继续下滑&#xff1f; 降价潮反倒劝退消费者&#xff0c;想买车…

数据丢失大救星:格式化后如何高效恢复文件

一、格式化危机&#xff1a;如何逆转数据流失 在数字时代&#xff0c;数据丢失无疑是一场灾难。当我们的电脑硬盘、手机或闪存盘不慎被格式化后&#xff0c;重要文件仿佛在一瞬间消失得无影无踪。面对这一突发状况&#xff0c;很多人会陷入迷茫和焦虑之中。那么&#xff0c;格…

Django(三)-搭建第一个应用(2)

一、编写更多视图 问题详情页——展示某个投票的问题和不带结果的选项列表。问题结果页——展示某个投票的结果。投票处理器——用于响应用户为某个问题的特定选项投票的操作。 # 1.问题详情页&#xff1a;展示某个投票的问题和不带结果的选项列表 def detail(request,questi…

放弃 Rust 选择 Zig,Xata 团队推出 pgzx —— 计划使用 Zig 开发基于 PG 的分布式数据库

Summary Xata 公司在基于 PostgresSQL 开发自己的分布式数据库&#xff0c;出于 Zig 和 C 语言以及 PostgreSQL 的 API 有更好的互操作性的考虑&#xff0c;他们选择了 Zig 而非当红炸子鸡语言 Rust。他们的博客文章中对 pgzx 进行了介绍。让我们来看下他们对 Zig 和 Rust 语言…

clickhouse学习笔记02(小滴课堂)

ClickHouse核心基础-常见数据类型讲解 插入数据&#xff1a; decimal类型的数据&#xff0c;整数部分超了会报错&#xff0c;小数部分超了会截取。 查看表结构&#xff1a; 查询&#xff1a; 插入&#xff1a; 更新操作&#xff1a; 这个和mysql的语句不太一样。 删除语句和my…