github dprint/dprint-plugin-typescript 0.97.0

one hour ago

Changes

  • feat(BREAKING): drop the deno_ast dependency (#810)
  • feat: accept semicolons and forStatement.spaceAfterSemicolons config keys (#887)
  • feat: add Tailwind class name sorting (#795)
  • feat: add decorators.position option (#387)
  • feat: add unionAndIntersectionType.operatorPosition option (#785)
  • feat: add useNestedIndentation options for conditional expressions and types and conditionalType.linePerExpression (#450)
  • feat: add catchClause.spaceAfterCatchKeyword (#874)
  • feat: add conditionalExpression.indentBranchContent (#878)
  • feat: add jsxExpressionContainer.preferSingleLine to keep the braces on their own lines when written that way (#892)
  • feat: add options for blank lines (#830)
  • feat: add spaceAfterControlFlowKeyword (#875)
  • feat: add switchStatement.spaceAfterSwitchKeyword (#873)
  • feat: detect more tagged template patterns for external formatter (#792)
  • feat: format embedded languages in tagged templates in the Wasm plugin (#838)
  • feat: import grouping (#784)
  • feat: rename sortTypeOnlyImports/sortTypeOnlyExports value none to inline (#885)
  • feat: support range formatting (#864)
  • feat: update to dprint-core 0.75 and say whether range formatting is supported (#845)
  • feat: upgrade swc to swc_ecma_parser 47 (#842)
  • fix(BREAKING): drop anyhow (#804)
  • fix(jsx): mark <pre> body comments as handled to avoid duplication (#796)
  • fix: add braces to every branch of an if-else chain with useBraces preferNone when one needs them (#871)
  • fix: add missing additive field to FileMatchingInfo in wasm plugin (#814)
  • fix: add trailing comma after wrapped arrow expression body in call (#696) (#789)
  • fix: allow a new expression argument to be inline multi-line like a call (#862)
  • fix: always put a space or newline after an added open brace (#841)
  • fix: blank line options giving output that changes when formatted again (#831)
  • fix: break container instead of expanding one of many object siblings (#641) (#793)
  • fix: don't add a blank line after a semicolon on its own line (#847)
  • fix: don't add a space between a jsx expression container's braces and an object or array literal (#882)
  • fix: don't break a member expression that fits from a stale line number with memberExpression.linePerExpression (#844)
  • fix: don't double backslash escapes in non-CSS embedded templates (#801)
  • fix: don't double indent a multi-line operand before the operand line breaks of a nested binary expression (#876)
  • fix: don't force a trailing comma in the type parameters of a function expression in jsx (#751)
  • fix: don't hang indent the second operand of a multi-line comparison (#884)
  • fix: don't keep line breaks in the type arguments of a template literal type substitution (#848)
  • fix: don't move a parenthesized expression that keeps its line breaks after an assignment's operator to the next line when it doesn't fit there (#859)
  • fix: don't put spaces at the end or start of a line inside a statement header's parens (#727)
  • fix: don't put spaces at the start or end of a line around a jsx expression container's braces (#726)
  • fix: error for syntax errors swc drops in export declarations and don't break an arrow body from a stale line number (#828)
  • fix: ignore comments outside union and intersection types when preferring single line (#496)
  • fix: indent multi-line template literal substitutions relative to their line (#837)
  • fix: keep a blank line before a trailing comment in comma separated lists (#870)
  • fix: keep a call's arguments on its line when the last is an arrow function whose body breaks inside its parens (#877)
  • fix: keep an arrow function's call or template literal body on the same line as the arrow when it hugs its last argument or is on multiple lines (#861)
  • fix: keep comments before the moved operator of a conditional expression (#867)
  • fix: keep comments in jsx closing tags and fragments from breaking the code (#868)
  • fix: keep comments on their own lines between binary expression operands (#879)
  • fix: keep computed enum member keys (#855)
  • fix: keep curried arrow chains indented when a header spans multiple lines (#869)
  • fix: keep hugging object siblings when they're all multi-line (#893)
  • fix: keep parens around a constrained infer type in a return type and remove nested type parens in one pass (#857)
  • fix: keep parens around an object, function, or class at the start of an expression statement (#825)
  • fix: keep parens around jsx that starts a member, call or new expression (#889)
  • fix: keep space between for and await regardless of spaceAfterForKeyword (#692) (#790)
  • fix: keep the braces beside a multi-line block comment in jsx (#866)
  • fix: keep the closing tag beside the opening tag when a jsx element has no children (#865)
  • fix: keep the comments around a jsx spread attribute outside its braces (#826)
  • fix: keep the comments before a semicolon at the start of a line after the statement (#827)
  • fix: keep the comments before an array pattern's close bracket when it has a type annotation (#850)
  • fix: keep the parens around a let identifier that starts an expression (#856)
  • fix: keep the parens around decorator expressions that need them (#854)
  • fix: keep the spaces at the end of ignored jsx text when multi-line (#822)
  • fix: keep the trailing comma a type parameter needs in a jsx, mts, or cts file with trailingCommas never (#849)
  • fix: parse a file with an unknown extension using the known extension before it (#881)
  • fix: preserve comments between node and comma in separated lists (#684) (#791)
  • fix: preserve jsdoc markdown hard breaks (#800)
  • fix: preserve meaningful surrounding spaces in JSX text (#805)
  • fix: put a self-closing element's bracket on the next line when its attributes are hanging (#669)
  • fix: put hugged object siblings on one line when breaking their container (#894)
  • fix: put template literal expressions with trailing comments on their own line (#823)
  • fix: remove locked from config schema (#815)
  • fix: remove parens around multi-line jsx with jsx.multiLineParens never (#888)
  • fix: remove the unsupported system newLineKind from the schema (#820)
  • fix: sort import declarations of the same module in a canonical order (#886)
  • fix: stabilize with statement formatting with comments (#788)
  • fix: stable formatting for conditional expression as if/else body (#797)
  • fix: stable hanging union and intersection types and type assertions with a parenthesized union after an assignment (#863)
  • fix: support spaceSurroundingProperties for mapped types via mappedType.spaceSurroundingProperties (#883)
  • fix: surround template literal type unions with newlines when too long (#794)
  • fix: update to dprint-core 0.74.1 (#843)
  • fix: upgrade to dprint-core 0.69.1 (#809)
  • fix: upgrade to dprint-core 0.74 and keep line numbers correct with InfoRegion (#836)
  • fix: use gh release create so releases work with immutable releases (#816)
  • perf: allocate in the arena from dprint-core 0.73 and borrow text from the file (#832)
  • perf: merge the quasis and expressions of a template literal without allocating (#839)
  • perf: preallocate vectors with a known length (#833)
  • perf: update to dprint-core 0.75.1 (#852)
  • perf: update to dprint-core 0.75.2 (#853)
  • perf: update to dprint-swc-ext 0.27.1 (#851)

Install

Install and setup dprint.

Then in your project's dprint configuration file:

  1. Specify the plugin url in the "plugins" array (can be done via dprint add typescript).
  2. Add a "typescript" configuration property if desired.
    {
      // ...etc...
      "typescript": {
        // TypeScript & JavaScript config goes here
      },
      "excludes": [
        "**/node_modules"
      ],
      "plugins": [
        "npm:@dprint/typescript@0.97.0"
      ]
    }

JS Formatting API

Don't miss a new dprint-plugin-typescript release

NewReleases is sending notifications on new releases.