@herb-tools/formatter 0.8.1 → 0.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +38 -0
- package/dist/herb-format.js +393 -188
- package/dist/herb-format.js.map +1 -1
- package/dist/index.cjs +372 -176
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +372 -176
- package/dist/index.esm.js.map +1 -1
- package/dist/types/format-helpers.d.ts +0 -3
- package/dist/types/format-ignore.d.ts +9 -0
- package/dist/types/format-printer.d.ts +23 -0
- package/package.json +5 -5
- package/src/format-helpers.ts +0 -11
- package/src/format-ignore.ts +45 -0
- package/src/format-printer.ts +339 -170
- package/src/formatter.ts +2 -1
package/src/formatter.ts
CHANGED
|
@@ -2,13 +2,13 @@ import { FormatPrinter } from "./format-printer.js"
|
|
|
2
2
|
|
|
3
3
|
import { isScaffoldTemplate } from "./scaffold-template-detector.js"
|
|
4
4
|
import { resolveFormatOptions } from "./options.js"
|
|
5
|
+
import { hasFormatterIgnoreDirective } from "./format-ignore.js"
|
|
5
6
|
|
|
6
7
|
import type { Config } from "@herb-tools/config"
|
|
7
8
|
import type { RewriteContext } from "@herb-tools/rewriter"
|
|
8
9
|
import type { HerbBackend, ParseResult } from "@herb-tools/core"
|
|
9
10
|
import type { FormatOptions } from "./options.js"
|
|
10
11
|
|
|
11
|
-
|
|
12
12
|
/**
|
|
13
13
|
* Formatter uses a Herb Backend to parse the source and then
|
|
14
14
|
* formats the resulting AST into a well-indented, wrapped string.
|
|
@@ -61,6 +61,7 @@ export class Formatter {
|
|
|
61
61
|
|
|
62
62
|
if (result.failed) return source
|
|
63
63
|
if (isScaffoldTemplate(result)) return source
|
|
64
|
+
if (hasFormatterIgnoreDirective(result.value)) return source
|
|
64
65
|
|
|
65
66
|
const resolvedOptions = resolveFormatOptions({ ...this.options, ...options })
|
|
66
67
|
|