1. 程式人生 > 實用技巧 >我的vscode中eslint,prettier

我的vscode中eslint,prettier

// TypeScript

  // Enable/disable automatic closing of JSX tags. Requires using TypeScript 3.0 or newer in the workspace.
  "javascript.autoClosingTags": true,

  // Enable/disable default JavaScript formatter.
  "javascript.format.enable": true,

  // Defines space handling after a comma delimiter.
  "javascript.format.insertSpaceAfterCommaDelimiter": true
, // Defines space handling after the constructor keyword. Requires using TypeScript 2.3.0 or newer in the workspace. "javascript.format.insertSpaceAfterConstructor": false, // Defines space handling after function keyword for anonymous functions. "javascript.format.insertSpaceAfterFunctionKeywordForAnonymousFunctions": true
, // Defines space handling after keywords in a control flow statement. "javascript.format.insertSpaceAfterKeywordsInControlFlowStatements": true, // Defines space handling after opening and before closing JSX expression braces. "javascript.format.insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces": false
, // Defines space handling after opening and before closing non-empty braces. Requires using TypeScript 2.3.0 or newer in the workspace. "javascript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces": true, // Defines space handling after opening and before closing non-empty brackets. "javascript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets": false, // Defines space handling after opening and before closing non-empty parenthesis. "javascript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis": false, // Defines space handling after opening and before closing template string braces. "javascript.format.insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces": false, // Defines space handling after a semicolon in a for statement. "javascript.format.insertSpaceAfterSemicolonInForStatements": true, // Defines space handling after a binary operator. "javascript.format.insertSpaceBeforeAndAfterBinaryOperators": true, // Defines space handling before function argument parentheses. "javascript.format.insertSpaceBeforeFunctionParenthesis": false, // Defines whether an open brace is put onto a new line for control blocks or not. "javascript.format.placeOpenBraceOnNewLineForControlBlocks": false, // Defines whether an open brace is put onto a new line for functions or not. "javascript.format.placeOpenBraceOnNewLineForFunctions": false, // Defines handling of optional semicolons. Requires using TypeScript 3.7 or newer in the workspace. // - ignore: Don't insert or remove any semicolons. // - insert: Insert semicolons at statement ends. // - remove: Remove unnecessary semicolons. "javascript.format.semicolons": "ignore", // Enable/disable semantic checking of JavaScript files. Existing jsconfig.json or tsconfig.json files override this setting. Requires using TypeScript 2.3.1 or newer in the workspace. "javascript.implicitProjectConfig.checkJs": false, // Preferred path style for auto imports. // - auto: Automatically select import path style. Prefers using a relative import if `baseUrl` is configured and the relative path has fewer segments than the non-relative import. // - relative: Relative to the file location. // - non-relative: Based on the `baseUrl` configured in your `jsconfig.json` / `tsconfig.json`. "javascript.preferences.importModuleSpecifier": "auto", // Preferred path ending for auto imports. // - auto: Use project settings to select a default. // - minimal: Shorten `./component/index.js` to `./component`. // - index: Shorten `./component/index.js` to `./component/index`. // - js: Do not shorten path endings; include the `.js` extension. "javascript.preferences.importModuleSpecifierEnding": "auto", // Preferred quote style to use for quick fixes: `single` quotes, `double` quotes, or `auto` infer quote type from existing imports. Requires using TypeScript 2.9 or newer in the workspace. "javascript.preferences.quoteStyle": "auto", // Enable/disable introducing aliases for object shorthand properties during renames. Requires using TypeScript 3.4 or newer in the workspace. "javascript.preferences.useAliasesForRenames": true, // Enable/disable references CodeLens in JavaScript files. "javascript.referencesCodeLens.enabled": false, // Enable/disable references CodeLens on all functions in JavaScript files. "javascript.referencesCodeLens.showOnAllFunctions": false, // Enable/disable auto import suggestions. Requires using TypeScript 2.6.1 or newer in the workspace. "javascript.suggest.autoImports": true, // Complete functions with their parameter signature. "javascript.suggest.completeFunctionCalls": false, // Enable/disable suggestion to complete JSDoc comments. "javascript.suggest.completeJSDocs": true, // Enabled/disable autocomplete suggestions. "javascript.suggest.enabled": true, // Enable/disable showing completions on potentially undefined values that insert an optional chain call. Requires TS 3.7+ and strict null checks to be enabled. "javascript.suggest.includeAutomaticOptionalChainCompletions": true, // Enable/disable including unique names from the file in JavaScript suggestions. Note that name suggestions are always disabled in JavaScript code that is semantically checked using `@ts-check` or `checkJs`. "javascript.suggest.names": true, // Enable/disable suggestions for paths in import statements and require calls. "javascript.suggest.paths": true, // Enable/disable suggestion diagnostics for JavaScript files in the editor. Requires using TypeScript 2.8 or newer in the workspace. "javascript.suggestionActions.enabled": true, // Enable/disable automatic updating of import paths when you rename or move a file in VS Code. Requires using TypeScript 2.9 or newer in the workspace. // - prompt: Prompt on each rename. // - always: Always update paths automatically. // - never: Never rename paths and don't prompt. "javascript.updateImportsOnFileMove.enabled": "prompt", // Enable/disable JavaScript validation. "javascript.validate.enable": true,

 /*  prettier的配置 */
    "prettier.printWidth": 120, // 超過最大值換行
    "prettier.tabWidth": 4, // 縮排位元組數
    "prettier.useTabs": false, // 縮排不使用tab,使用空格
    // "prettier.semi": false, // 句尾新增分號
    "prettier.singleQuote": true, // 使用單引號代替雙引號
    // "prettier.proseWrap": "preserve", // 預設值。因為使用了一些折行敏感型的渲染器(如GitHub comment)而按照markdown文字樣式進行折行
    "prettier.arrowParens": "avoid", //  (x) => {} 箭頭函式引數只有一個時是否要有小括號。avoid:省略括號
    "prettier.bracketSpacing": true, // 在物件,陣列括號與文字之間加空格 "{ foo: bar }"
    // "prettier.disableLanguages": ["vue"], // 不格式化vue檔案,vue檔案的格式化單獨設定
    "prettier.endOfLine": "auto", // 結尾是 \n \r \n\r auto
    "prettier.eslintIntegration": false, //不讓prettier使用eslint的程式碼格式進行校驗
    // "prettier.htmlWhitespaceSensitivity": "ignore",
    // "prettier.ignorePath": ".prettierignore", // 不使用prettier格式化的檔案填寫在專案的.prettierignore檔案中
    "prettier.jsxBracketSameLine": false, // 在jsx中把'>' 是否單獨放一行
    // "prettier.jsxSingleQuote": false, // 在jsx中使用單引號代替雙引號
    // "prettier.parser": "babylon", // 格式化的解析器,預設是babylon
    // "prettier.requireConfig": false, // Require a 'prettierconfig' to format prettier
    // "prettier.stylelintIntegration": false, //不讓prettier使用stylelint的程式碼格式進行校驗
    // "prettier.trailingComma": "es5", // 在物件或陣列最後一個元素後面是否加逗號(在ES5中加尾逗號)
    // "prettier.tslintIntegration": false, // 不讓prettier使用tslint的程式碼格式進行校驗