tidyrs 0.0.0 → 0.2.0

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/index.d.ts ADDED
@@ -0,0 +1,104 @@
1
+ /* auto-generated by NAPI-RS */
2
+ /* eslint-disable */
3
+
4
+ /**
5
+ * Which binding artifact the generated loader actually loaded: `'native'` for
6
+ * a native addon, otherwise the `platformArchABI` of the WASI flavor. Every
7
+ * flavor napi-rs can build is listed, because `NAPI_RS_NATIVE_LIBRARY_PATH`
8
+ * can point the loader at a WASI artifact this package does not build itself.
9
+ */
10
+ export declare const __napiBindingTarget: 'native' | 'wasm32-wasi' | 'wasm32-wasip1'
11
+
12
+ /** Whether a file is formatted already. `embed` receives each piece of code in another language, as for `format`. */
13
+ export declare function check(source: string, options?: FormatOptions, embed?: (request: EmbedRequest) => string | undefined): boolean
14
+
15
+ /** A piece of embedded code for the host to format. */
16
+ export interface EmbedRequest {
17
+ code: string
18
+ /** Prettier's name for the parser: `babel`, `typescript`, `css`, `json`, ... */
19
+ language: string
20
+ kind: 'block' | 'expression' | 'attribute' | 'frontmatter'
21
+ /** How many indents the code starts at. Indent the lines after the first by this much. */
22
+ indent: number
23
+ /**
24
+ * The width of the text before the code on its first line, after the indents, as `name="` before an attribute
25
+ * value. Print the code after this much.
26
+ */
27
+ prefix: number
28
+ /** The width of the text after the code on its last line, as the `"` that closes such a value. */
29
+ suffix: number
30
+ width: number
31
+ /** JavaScript that is a module, not a classic script. */
32
+ module: boolean
33
+ }
34
+
35
+ /** Format a file. `embed` receives each piece of code in another language. */
36
+ export declare function format(source: string, options?: FormatOptions, embed?: (request: EmbedRequest) => string | undefined): string
37
+
38
+ /** Options for `format`: the options of a `tidy.json` file, and what to format. */
39
+ export interface FormatOptions {
40
+ /** The language. Default: by `filepath`, and HTML without one. */
41
+ parser?: 'html' | 'vue' | 'mjml' | 'handlebars' | 'tempura' | 'css' | 'scss' | 'less' | 'json' | 'jsonc' | 'json5' | 'json-stringify' | 'yaml' | 'toml' | 'dockerfile' | 'ini' | 'gitconfig' | 'graphql' | 'babel' | 'typescript' | 'babel-ts' | 'xml' | 'markdown'
42
+ /** The file's path, which decides the language and some details. */
43
+ filepath?: string
44
+ /** Hand embedded code to `embed`, and format the style sheets, JSON, YAML and TOML it declines. Default: true. */
45
+ embedded?: boolean
46
+ /** The line width. Default: 80. */
47
+ width?: number
48
+ /** The width of an indent. Default: 2. */
49
+ indent?: number
50
+ /** Indent with tabs. Default: false. */
51
+ tabs?: boolean
52
+ eol?: 'lf' | 'crlf' | 'cr'
53
+ /** Default: `auto`, and `strict` for XML. */
54
+ whitespace?: 'strict' | 'auto' | 'ignore'
55
+ /** Quotes in Handlebars, style sheets, JSON5, YAML and JS. Default: `double`. */
56
+ quote?: 'double' | 'single'
57
+ /** Trailing commas in SCSS, JSONC, JSON5, YAML flow collections, TOML arrays and JS. Default: true. */
58
+ trailingComma?: boolean
59
+ /** Spaces inside the braces of JSON and JS objects and YAML flow mappings. Default: true. */
60
+ bracketSpacing?: boolean
61
+ bracketSameLine?: boolean
62
+ singleAttributePerLine?: boolean
63
+ /** The ignore directive. Default: `prettier-ignore`. */
64
+ ignore?: string
65
+ /** Options for HTML only: the shared ones above. */
66
+ html?: Record<string, unknown>
67
+ /** Options for Vue only: the shared ones, and `indentBlocks`. */
68
+ vue?: Record<string, unknown>
69
+ /** Options for Handlebars only: the shared ones, and `dialect`. */
70
+ handlebars?: Record<string, unknown>
71
+ /** Options for style sheets only: the shared ones above. */
72
+ css?: Record<string, unknown>
73
+ /** Options for JSON only: the shared ones, and `quoteProps` and `objectWrap`. */
74
+ json?: Record<string, unknown>
75
+ /** Options for YAML only: the shared ones, and `wrap` (`preserve`, `always` or `never`). */
76
+ yaml?: Record<string, unknown>
77
+ /** Options for TOML only: the shared ones, and taplo's, in camel case: `alignEntries`, `reorderKeys`, ... */
78
+ toml?: Record<string, unknown>
79
+ /**
80
+ * Options for Dockerfiles only: the shared ones, and dprint-plugin-dockerfile's `indentStages` and
81
+ * `healthcheckCmdNewLine`.
82
+ */
83
+ dockerfile?: Record<string, unknown>
84
+ /** Options for INI only: the shared ones, and `spaceAroundEquals`. */
85
+ ini?: Record<string, unknown>
86
+ /** Options for GraphQL only: the shared ones. */
87
+ graphql?: Record<string, unknown>
88
+ /**
89
+ * Options for JavaScript and TypeScript, also where tidy formats them in other languages: the shared ones,
90
+ * `trailingComma` as `all`, `es5` or `none`, and `semi`, `jsxSingleQuote`, `quoteProps`, `arrowParens`,
91
+ * `objectWrap`, `experimentalTernaries`, `experimentalOperatorPosition` and `jsdoc`. Imports are sorted with oxfmt's
92
+ * `sortImports`, or with `plugins` that lists `@trivago/prettier-plugin-sort-imports`,
93
+ * `@ianvs/prettier-plugin-sort-imports` or `prettier-plugin-organize-imports` and that plugin's options
94
+ * (`importOrder`, `importOrderSeparation`, `organizeImportsTypeOrder`, ...). Off by default.
95
+ */
96
+ js?: Record<string, unknown>
97
+ /** Options for XML only: the shared ones, and `selfClosingSpace`, `sortAttributes` and `attributeQuotes`. */
98
+ xml?: Record<string, unknown>
99
+ /**
100
+ * Options for Markdown only: `width` and `ignore`, a `preset` (`prettier` or `preserve`), and `wrap`, `bullet`,
101
+ * `emphasis`, `strong`, `numbering`, `rule`, `fence` and `heading`, which override the preset.
102
+ */
103
+ markdown?: Record<string, unknown>
104
+ }