Skip to content

03 RN Vscode配置

liuweijw edited this page Sep 16, 2018 · 4 revisions

1、vscode guide

2、vsocde 相关插件

  • 基础 guide
  • RN 增加如下
Prettier
React Native Snippet
React Native Tools
Bracket Pair Colorizer

3、Vscode 配置(选用)

  • vscode 开发环境配置更好的匹配eslint规则定义,方便快速开发、修复问题。 用户设置如下
{
    // 自动保存
    "files.autoSave": "onFocusChange",
    // tab 自动缩进2个空格
    "editor.tabSize": 2,
    // 每次保存的时候自动格式化
    "editor.formatOnSave": false,
    // 打开同类多个文件
    "workbench.editor.enablePreview": false,
    // Turns auto fix on save on or off.
    "eslint.autoFixOnSave": true,
    // 启用后,保存文件时在文件末尾插入一个最终新行。
    "files.insertFinalNewline": true,
    // 启用后,将在保存文件时剪裁尾随空格。
    "files.trimTrailingWhitespace": true,
    // 采用 atom key 风格
    // "atomKeymap.promptV3Features": true,
    // "editor.multiCursorModifier": "ctrlCmd",
    // "editor.formatOnPaste": true,
    // theme
    "workbench.colorTheme": "One Dark Pro",
    "workbench.iconTheme": "vscode-icons",
    // git 相关
    "git.ignoreMissingGitWarning": true,
    "git.enableSmartCommit": true,
    "git.autofetch": true,
    "vsicons.dontShowNewVersionMessage": true,
    "workbench.startupEditor": "welcomePage",
    "vetur.format.defaultFormatter.html": "js-beautify-html",
    "vetur.format.defaultFormatter.js": "vscode-typescript",
    "vetur.format.defaultFormatterOptions": {
        "js-beautify-html": {
            "wrap_attributes": "force-aligned"
        }
    },
    // 让prettier使用eslint的代码格式进行校验
    "prettier.eslintIntegration": true,
    // 使用带引号替代双引号
    "prettier.singleQuote": true,
    // 去掉代码结尾的分号
    "prettier.semi": false,
    // 函数(名)和后面的括号之间加个空格
    "javascript.format.insertSpaceBeforeFunctionParenthesis": true,
    // 添加 vue 支持
    "eslint.validate": [
        "javascript",
        "javascriptreact",
        {
            "language": "vue",
            "autoFix": true
        }
    ],
    "javascript.format.enable": false,
    "atomKeymap.promptV3Features": true,
    "editor.multiCursorModifier": "ctrlCmd",
    "editor.formatOnPaste": false,
    "java.errors.incompleteClasspath.severity": "ignore"
}
Clone this wiki locally