text VSCode设置+ Prettier + Eslint集成

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了text VSCode设置+ Prettier + Eslint集成相关的知识,希望对你有一定的参考价值。

{
    "git.ignoreMissingGitWarning": true,
    "workbench.iconTheme": "vscode-icons",
    "workbench.statusBar.feedback.visible": false,
    "window.menuBarVisibility": "toggle",
    "files.defaultLanguage": "javascriptreact",
    "emmet.syntaxProfiles": {
        "javascript": "jsx",
        "xml": {
            "attr_quotes": "single"
        }
    },
    "workbench.editor.tabSizing": "shrink",
    "editor.tokenColorCustomizations": {
        "textMateRules": [
            {
                "scope": "meta.tag",
                "settings": {
                    "foreground": "#ececec"
                }
            },
            {
                "scope": "meta.function.method.js",
                "settings": {
                    "foreground": "#ececec"
                }
            },
            {
                "scope": "meta.object-literal.key",
                "settings": {
                    "foreground": "#89CA78"
                }
            },
            {
                "scope": "variable.parameter",
                "settings": {
                    "fontStyle": ""
                }
            },
            {
                "scope": "variable.language.super",
                "settings": {
                    "fontStyle": ""
                }
            },
            {
                "scope": "entity.other.attribute-name.js.jsx",
                "settings": {
                    "fontStyle": ""
                }
            },
            {
                "scope": "entity.name.type.class.js.jsx",
                "settings": {
                    "foreground": "#52ADF2"
                }
            },
            {
                "scope": "meta",
                "settings": {
                    "foreground": "#ececec"
                }
            },
            {
                "scope": "punctuation.section.embedded",
                "settings": {
                    "foreground": "#D55FDE"
                }
            },
            {
                "scope": "punctuation.definition.block.js.jsx",
                "settings": {
                    "foreground": "#ffffff"
                }
            },
            {
                "scope": "punctuation.separator.comma.js.jsx",
                "settings": {
                    "foreground": "#ffffff"
                }
            },
            {
                "scope": "meta.tag.js.jsx",
                "settings": {
                    "foreground": "#ffffff"
                }
            },
            {
                "scope": "meta.brace.round.js.jsx",
                "settings": {
                    "foreground": "#ffffff"
                }
            },
        ]
    },
    "editor.formatOnSave": false,
    "editor.tabSize": 4,
    "editor.detectIndentation": true,
    "editor.insertSpaces": true,
    "editor.renderWhitespace": "all",
    "editor.fontSize": 12,
    "eslint.alwaysShowStatus": true,
    "eslint.autoFixOnSave": true,
    "editor.foldingStrategy": "indentation",
    "editor.wordWrap": "on",
    "files.associations": {
        "*.js": "javascriptreact"
    },
    "prettier.eslintIntegration": true,
    "eslint.enable": true,
    "eslint.options": {
        "env": {
            "browser": true,
            "es6": true,
            "node": true
        },
        "extends": "eslint:recommended",
        "parserOptions": {
            "ecmaFeatures": {
                "ecmaVersion": 6,
                "jsx": true,
                "modules": true
            },
            "sourceType": "module"
        },
        "plugins": ["react", "react-native"],
        "parser": "babel-eslint",
        "rules": {
            "indent": ["error", 4],
            "quotes": ["error", "single"],
            "object-curly-spacing": ["error", "always"],
            "react/jsx-uses-react": "error",
            "react/jsx-uses-vars": "error",
            "no-console": 0,
            "ignoreChainWithDepth": 0,
            "linebreak-style": 0,
            "react-native/no-unused-styles": 2,
            "react-native/split-platform-components": 2,
            "react-native/no-inline-styles": 2,
            "react-native/no-color-literals": 2,
            "react-native/no-raw-text": 2
        }
    },
    "prettier.tabWidth": 4,
    "javascript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces": true,
    "javascript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets": true,
    "typescript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets": true,
    "typescript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces": true,
    "beautify.tabSize": 4,
    "workbench.colorTheme": "One Dark Pro Vivid"
}

以上是关于text VSCode设置+ Prettier + Eslint集成的主要内容,如果未能解决你的问题,请参考以下文章

在 VSCode 上安装 Prettier

VSCode:Prettier 不适用于 Dart Flutter

VSCode prettier/vue 格式设置无法正常工作

当我使用 prettier 和 ESLint 在 VSCode 上保存代码时如何设置自动关闭?

VSCode Prettier 扩展 vs 命令行 Prettier

vscode+prettier配置保存自动格式化