Skip to content

witcher112/eslint-plugin-typescript-formatter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

eslint-plugin-typescript-formatter

npm version GitHub issues GitHub license Known Vulnerabilities

TypeScript built-in formatter for ESLint

Table of contents

Installation

npm:

npm install --save-dev eslint-plugin-typescript-formatter

yarn:

yarn add -D eslint-plugin-typescript-formatter

Configuration

Modify your .eslintrc.json file to include:

{
  "plugins": [
    "typescript-formatter"
  ],
  "rules": {
    "typescript-formatter/format": [
      "warn",
      {
        "baseIndentSize": 0,
        "indentSize": 2,
        "tabSize": 2,
        "newLineCharacter": "\n",
        "convertTabsToSpaces": true,
        "indentStyle": 2,
        "trimTrailingWhitespace": true,
        "insertSpaceAfterCommaDelimiter": true,
        "insertSpaceAfterSemicolonInForStatements": true,
        "insertSpaceBeforeAndAfterBinaryOperators": true,
        "insertSpaceAfterConstructor": false,
        "insertSpaceAfterKeywordsInControlFlowStatements": true,
        "insertSpaceAfterFunctionKeywordForAnonymousFunctions": false,
        "insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis": false,
        "insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets": false,
        "insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces": true,
        "insertSpaceAfterOpeningAndBeforeClosingEmptyBraces": false,
        "insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces": false,
        "insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces": false,
        "insertSpaceAfterTypeAssertion": false,
        "insertSpaceBeforeFunctionParenthesis": false,
        "placeOpenBraceOnNewLineForFunctions": false,
        "placeOpenBraceOnNewLineForControlBlocks": false,
        "insertSpaceBeforeTypeAnnotation": false,
        "indentMultiLineObjectLiteralBeginningOnBlankLine": false,
        "semicolons": "insert"
      }
    ]
  }
}

Rule options schema is available in TypeScript source code.

Credits