VSCode setting.json格式化 + eslintrc配置记录

2023-05-16

做个记录,方便下次使用直接copy使用

  • vscode setting.json
  • .eslintrc.js

setting.json

{
    // vscode默认启用了根据文件类型自动设置tabsize的选项
    "editor.detectIndentation": false,
    // 重新设定tabsize
    "editor.tabSize": 4,
    // #每次保存的时候自动格式化
    "editor.formatOnSave": true,
    "eslint.validate": [
        "javascript",
        "html",
        "vue"
    ],
    // #每次保存的时候将代码按eslint格式进行修复
    "editor.codeActionsOnSave": {
        "source.fixAll.eslint": true
    },
    //  #让函数(名)和后面的括号之间加个空格
    "javascript.format.insertSpaceBeforeFunctionParenthesis": true,
    // #让vue中的js按编辑器自带的ts格式进行格式化
    "vetur.format.defaultFormatter.js": "vscode-typescript",
    "vetur.format.defaultFormatterOptions": {
        "js-beautify-html": {
            "wrap_attributes": "force-aligned"
            // #vue组件中html代码格式化样式
        },
        "prettier": {
        	// 去除结尾分号
            "semi": false,
            // 使用单引号替代双引号
            "singleQuote": true
        }
    },
    "window.zoomLevel": 0,
    "explorer.confirmDelete": false,
    "explorer.confirmDragAndDrop": false,
    "editor.renderControlCharacters": true,
    "editor.renderWhitespace": "all",
    "editor.fontSize": 13,
}
"babel-eslint": "10.1.0",
"eslint": "6.7.2",
"eslint-plugin-vue": "6.2.2",

.eslintrc.js

module.exports = {
    root: true,
    parserOptions: {
        parser: 'babel-eslint',
        sourceType: 'module',
        ecmaFeatures: {
            legacyDecorators: true
        }
    },
    env: {
        browser: true,
        node: true,
        es6: true,
    },
    extends: ['plugin:vue/recommended', 'eslint:recommended'],

    // add your custom rules here
    //it is base on https://github.com/vuejs/eslint-config-vue
    rules: {
        "vue/max-attributes-per-line": [2, {
            "singleline": 10,
            "multiline": {
                "max": 1,
                "allowFirstLine": false
            }
        }],
        "vue/singleline-html-element-content-newline": "off",
        "vue/multiline-html-element-content-newline": "off",
        "vue/name-property-casing": ["error", "PascalCase"],
        "vue/no-v-html": "off",
        "vue/html-self-closing": ["error", {
            "html": {
                "void": "always",
                "normal": "any",
                "component": "any"
            },
            "svg": "always",
            "math": "always"
        }],
        '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
        }],
        'comma-style': [2, 'last'],
        'constructor-super': 2,
        'curly': [2, 'multi-line'],
        'dot-location': [2, 'property'],
        'eol-last': 2,
        'eqeqeq': ["error", "always", { "null": "ignore" }],
        '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-var': 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-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': 2,
        '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': [2, {
            'initialized': 'never'
        }],
        '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': ["error", "always"],
        'space-in-parens': [2, 'never'],
        'space-infix-ops': 2,
        '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': 2,
        'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
        'object-curly-spacing': [2, 'always', {
            objectsInObjects: false
        }],
        'array-bracket-spacing': [2, 'never']
    }
}

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

VSCode setting.json格式化 + eslintrc配置记录 的相关文章

随机推荐

  • 字符串通配符(递归)

    题目描述 问题描述 xff1a 在计算机中 xff0c 通配符一种特殊语法 xff0c 广泛应用于文件搜索 数据库 正则表达式等领域 现要求各位实现字符串通配符的算法 要求 xff1a 实现如下2个通配符 xff1a xff1a 匹配0个或
  • 数据结构 实验报告01

    一 实验目的和要求 完成尽可能多的数据排序 xff0c 并显示运行时间 二 实验环境 编译器 xff1a Vscode DevC 43 43 系统 xff1a Windows10 CPU xff1a i5 8265U 64 1 60GHz
  • eclipse中java代码自动补全设置

    下面介绍一个eclipse自动补全的设置1 在eclipse页面 xff0c 点击顶部的Window选项选择进入Preferences选项 xff1a 2 点击java gt Editor gt Content Assist选项 xff1a
  • Java两种方法去除字符串末尾的数字

    问题 xff1a 如何去除这个字符串中末尾的数字 xff1a sdf12 432fdsf gfdf32 xff1f 这个问题的解决关键是要先把字符串进行反转操作 方法一 xff1a public static String removeNu
  • The word 'jsp' is not correctly spelled. Eclipse 拼写检查出错处理办法

    The word 39 jsp 39 is not correctly spelled Eclipse 拼写检查出错处理办法 用Eclipse开发程序 xff0c 发现输入JSP时 xff0c 系统提示The word 39 jsp 39
  • prepareStatement与Statement的区别

    prepareStatement与Statement的区别 1 区别 xff1a stmt 61 conn CreateStatement resultSet rs 61 stmt executeQuery sql 上面是statement
  • Java集合类详解

    Collection List LinkedList ArrayList Vector Stack Set Map Hashtable HashMap WeakHashMap Collection接口 Collection是最基本的集合接口
  • MySQL字符集 GBK、GB2312、UTF8区别 解决 MYSQL中文乱码问题以及error 1406:data too long for column 'name' at row 1

    MySQL中涉及的几个字符集 character set server default character set xff1a 服务器字符集 xff0c 默认情况下所采用的 character set database xff1a 数据库字
  • 网页的基底网址

    基底网址的实质是统一设置超级链接的属性 xff0c 基底网址标签是 lt base gt 它有两个属性 xff0c href和 target href用于设置基底网址的路径 xff0c target用于设置超级外国链接的打开文式 通过基底网
  • Python实现word转pdf

    Python实现word转pdf 在做word转未pdf的功能过程中找了很多java的实现 xff08 POI xff09 xff0c 对于普通的文档还是支持的还可以 xff0c 但是对于文档里面涉及图片 表格 水印等就会出现很多样式上的问
  • Java遍历集合四种方法

    import java util ArrayList import java util Iterator import java util List public class Test public static void main Str
  • Spring事务管理中@Transactional的参数配置

    Spring作为低侵入的Java EE框架之一 xff0c 能够很好地与其他框架进行整合 xff0c 其中Spring与Hibernate的整合实现的事务管理是常用的一种功能 所谓事务 xff0c 就必须具备ACID特性 xff0c 即原子
  • tomcat7在myeclipse中启动不了 出现严重: Error waiting for multi-thread deployment of directories to completehos

    问题解决 在 eclipse 中 xff0c window gt preferences gt Java gt Installed JREs 选中 JRE 点击 Edit 写入这句话 Xms800m Xmx800m XX MaxNewSiz
  • sql 模式,外模式,内模式 二级映像

    早上备课的时候 xff0c 发现教材第二章的2 2节数据库设计概述中有些概念性的错误 xff0c 从而使我想到 xff0c 对于外模式 模式 内模式的概念学生也不一定能理解透彻 xff0c 于是想通过博客再谈仔细 首先 xff0c 谈谈模式
  • Java关键字final、static使用总结

    一 final 根据程序上下文环境 xff0c Java关键字final有 这是无法改变的 或者 终态的 含义 xff0c 它可以修饰非抽象类 非抽象类成员方法和变量 你可能出于两种理解而需要阻止改变 xff1a 设计或效率 final类不
  • 抽象类是否可继承实体类

    一道java 常见面试题 xff0c 网上找到的几乎每个 java 面试笔试题大全或集锦里都能找到这道题 题目如下 xff1a 问 xff1a 抽象类是否可继承实体类 concrete class 答 xff1a 抽象类是可以继承实体类 x
  • 运行时异常与一般异常有何异同?

    ava提供了两类主要的异常 runtime exception和checked exception checked 异常也就是我们经常遇到的IO异常 xff0c 以及SQL异常都是这种异常 对于这种异常 xff0c JAVA编译器强制要求我
  • Mybatis----resultMap结果类型

    resultMap 结果类型 解决实体类和数据库字段不对应 项目结构 概述 resultMap 标签可以建立查询的列名和实体类的属性名称不一致时建立对应关系 从而实现封装 在 select 标签中使用 resultMap 属性指定引用即可
  • Android应用开发(1)Android Studio开发环境搭建

    Android应用开发学习笔记 目录索引 本章介绍搭建Android Studio应用开发环境 xff0c 创建并编译App工程 xff0c 运行和调试App 一 搭建AndroidStudio开发环境 1 下载AndroidStudio
  • VSCode setting.json格式化 + eslintrc配置记录

    做个记录 xff0c 方便下次使用直接copy使用 vscode setting json eslintrc js setting json span class token punctuation span span class toke