@timbic/prettier-config 1.0.11 → 1.1.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.
Files changed (3) hide show
  1. package/README.md +53 -53
  2. package/dist/index.d.ts +199 -16
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -1,53 +1,53 @@
1
- # @timbic/prettier-config
2
-
3
- Extensible prettier configuration for the smart developers.
4
-
5
- ## Usage
6
-
7
- ```bash
8
- pnpm add -D prettier @timbic/prettier-config
9
- ```
10
-
11
- ```mjs
12
- import withTimbic from "@timbic/prettier-config";
13
-
14
- export default withTimbic();
15
-
16
- // or
17
-
18
- export default withTimbic({
19
- // your options
20
- });
21
- ```
22
-
23
- Your options will override the defaults and extend the config.
24
-
25
- ## Default options:
26
-
27
- ```mjs
28
- {
29
- arrowParens: "always",
30
- bracketSameLine: false,
31
- bracketSpacing: true,
32
- checkIgnorePragma: false,
33
- embeddedLanguageFormatting: "auto",
34
- endOfLine: "lf",
35
- htmlWhitespaceSensitivity: "css",
36
- insertPragma: false,
37
- jsxSingleQuote: false,
38
- objectWrap: "preserve",
39
- printWidth: 140,
40
- proseWrap: "always",
41
- quoteProps: "consistent",
42
- rangeEnd: Infinity,
43
- rangeStart: 0,
44
- requirePragma: false,
45
- semi: true,
46
- singleAttributePerLine: true,
47
- singleQuote: false,
48
- tabWidth: 4,
49
- trailingComma: "all",
50
- useTabs: true,
51
- vueIndentScriptAndStyle: false,
52
- }
53
- ```
1
+ # @timbic/prettier-config
2
+
3
+ Extensible prettier configuration for the smart developers.
4
+
5
+ ## Usage
6
+
7
+ ```bash
8
+ pnpm add -D prettier @timbic/prettier-config
9
+ ```
10
+
11
+ ```mjs
12
+ import withTimbic from "@timbic/prettier-config";
13
+
14
+ export default withTimbic();
15
+
16
+ // or
17
+
18
+ export default withTimbic({
19
+ // your options
20
+ });
21
+ ```
22
+
23
+ Your options will override the defaults and extend the config.
24
+
25
+ ## Default options:
26
+
27
+ ```mjs
28
+ {
29
+ arrowParens: "always",
30
+ bracketSameLine: false,
31
+ bracketSpacing: true,
32
+ checkIgnorePragma: false,
33
+ embeddedLanguageFormatting: "auto",
34
+ endOfLine: "lf",
35
+ htmlWhitespaceSensitivity: "css",
36
+ insertPragma: false,
37
+ jsxSingleQuote: false,
38
+ objectWrap: "preserve",
39
+ printWidth: 140,
40
+ proseWrap: "always",
41
+ quoteProps: "consistent",
42
+ rangeEnd: Infinity,
43
+ rangeStart: 0,
44
+ requirePragma: false,
45
+ semi: true,
46
+ singleAttributePerLine: true,
47
+ singleQuote: false,
48
+ tabWidth: 4,
49
+ trailingComma: "all",
50
+ useTabs: true,
51
+ vueIndentScriptAndStyle: false,
52
+ }
53
+ ```
package/dist/index.d.ts CHANGED
@@ -1,42 +1,225 @@
1
- import { Config } from "prettier";
2
- //#region src/index.d.ts
3
- declare function withTimbic(options?: Config): {
1
+ import { BuiltInParserName, LiteralUnion, Plugin } from "prettier";
2
+ //#region src/types.d.ts
3
+ /**
4
+ * For use in `.prettierrc.js`, `.prettierrc.ts`, `.prettierrc.cjs`, `.prettierrc.cts`, `prettierrc.mjs`, `prettierrc.mts`, `prettier.config.js`, `prettier.config.ts`, `prettier.config.cjs`, `prettier.config.cts`, `prettier.config.mjs`, `prettier.config.mts`
5
+ */
6
+ interface Config extends Partial<Options> {
4
7
  overrides?: Array<{
5
8
  files: string | string[];
6
9
  excludeFiles?: string | string[];
7
- options?: import("prettier").Options;
10
+ options?: Options;
8
11
  }>;
12
+ }
13
+ interface Options {
14
+ /**
15
+ * Specify the line length that the printer will wrap on.
16
+ * @default 140
17
+ *
18
+ * @see https://prettier.io/docs/options#print-width
19
+ */
20
+ printWidth: number;
21
+ /**
22
+ * Specify the number of spaces per indentation-level.
23
+ * @default 4
24
+ *
25
+ * @see https://prettier.io/docs/options#tab-width
26
+ */
27
+ tabWidth: number;
28
+ /**
29
+ * Indent lines with tabs instead of spaces.
30
+ * @default true
31
+ *
32
+ * @see https://prettier.io/docs/options#tabs
33
+ */
34
+ useTabs?: boolean;
35
+ parentParser?: string | undefined;
36
+ __embeddedInHtml?: boolean | undefined;
37
+ /**
38
+ * Print semicolons at the ends of statements.
39
+ * @default true
40
+ *
41
+ * @see https://prettier.io/docs/options#semicolons
42
+ */
9
43
  semi: boolean;
44
+ /**
45
+ * Use single quotes instead of double quotes.
46
+ * @default false
47
+ *
48
+ * @see https://prettier.io/docs/options#quotes
49
+ */
10
50
  singleQuote: boolean;
51
+ /**
52
+ * Use single quotes in JSX.
53
+ * @default false
54
+ *
55
+ * @see https://prettier.io/docs/options#quotes
56
+ */
11
57
  jsxSingleQuote: boolean;
58
+ /**
59
+ * Print trailing commas wherever possible.
60
+ * @default "all"
61
+ *
62
+ * @see https://prettier.io/docs/options#trailing-commas
63
+ */
12
64
  trailingComma: "none" | "es5" | "all";
65
+ /**
66
+ * Print spaces between brackets in object literals.
67
+ * @default true
68
+ *
69
+ * @see https://prettier.io/docs/options#bracket-spacing
70
+ */
13
71
  bracketSpacing: boolean;
72
+ /**
73
+ * How to wrap object literals.
74
+ * @default "preserve"
75
+ *
76
+ * @see https://prettier.io/docs/options#object-wrap
77
+ */
14
78
  objectWrap: "preserve" | "collapse";
79
+ /**
80
+ * Put the `>` of a multi-line HTML (HTML, JSX, Vue, Angular) element at the end of the last line instead of being
81
+ * alone on the next line (does not apply to self closing elements).
82
+ * @default false
83
+ *
84
+ * @see https://prettier.io/docs/options#bracket-same-line
85
+ */
15
86
  bracketSameLine: boolean;
87
+ /**
88
+ * Format only a segment of a file.
89
+ * @default 0
90
+ *
91
+ * @see https://prettier.io/docs/options#range-start
92
+ */
16
93
  rangeStart: number;
94
+ /**
95
+ * Format only a segment of a file.
96
+ * @default Infinity
97
+ *
98
+ * @see https://prettier.io/docs/options#range-end
99
+ */
17
100
  rangeEnd: number;
18
- parser?: import("prettier").LiteralUnion<import("prettier").BuiltInParserName, string> | undefined;
19
- filepath?: string | undefined;
101
+ /**
102
+ * Specify which parser to use.
103
+ */
104
+ parser: LiteralUnion<BuiltInParserName>;
105
+ /**
106
+ * Specify the input filepath. This will be used to do parser inference.
107
+ */
108
+ filepath: string;
109
+ /**
110
+ * Prettier can restrict itself to only format files that contain a special comment, called a pragma, at the top of the
111
+ * file. This is very useful when gradually transitioning large, unformatted codebases to prettier.
112
+ * @default false
113
+ *
114
+ * @see https://prettier.io/docs/options#require-pragma
115
+ */
20
116
  requirePragma: boolean;
117
+ /**
118
+ * Prettier can insert a special @format marker at the top of files specifying that the file has been formatted with
119
+ * prettier. This works well when used in tandem with the --require-pragma option. If there is already a docblock at
120
+ * the top of the file then this option will add a newline to it with the @format marker.
121
+ * @default false
122
+ *
123
+ * @see https://prettier.io/docs/options#insert-pragma
124
+ */
21
125
  insertPragma: boolean;
126
+ /**
127
+ * Prettier can allow individual files to opt out of formatting if they contain a special comment, called a pragma, at
128
+ * the top of the file.
129
+ * @default false
130
+ *
131
+ * @see https://prettier.io/docs/options#check-ignore-pragma
132
+ */
22
133
  checkIgnorePragma: boolean;
134
+ /**
135
+ * By default, Prettier will wrap markdown text as-is since some services use a linebreak-sensitive renderer. In some
136
+ * cases you may want to rely on editor/viewer soft wrapping instead, so this option allows you to opt out.
137
+ * @default "always"
138
+ *
139
+ * @see https://prettier.io/docs/options#prose-wrap
140
+ */
23
141
  proseWrap: "always" | "never" | "preserve";
142
+ /**
143
+ * Include parentheses around a sole arrow function parameter.
144
+ * @default "always"
145
+ *
146
+ * @see https://prettier.io/docs/options#arrow-parens
147
+ */
24
148
  arrowParens: "avoid" | "always";
25
- plugins?: any[] | undefined;
149
+ /**
150
+ * Provide ability to support new languages to prettier.
151
+ */
152
+ plugins: Array<string | URL | Plugin>;
153
+ /**
154
+ * How to handle whitespaces in HTML.
155
+ * @default "css"
156
+ *
157
+ * @see https://prettier.io/docs/options#html-whitespace-sensitivity
158
+ */
26
159
  htmlWhitespaceSensitivity: "css" | "strict" | "ignore";
160
+ /**
161
+ * Which end of line characters to apply.
162
+ * @default "lf"
163
+ *
164
+ * @see https://prettier.io/docs/options#end-of-line
165
+ */
27
166
  endOfLine: "auto" | "lf" | "crlf" | "cr";
167
+ /**
168
+ * Change when properties in objects are quoted.
169
+ *
170
+ * @see https://prettier.io/docs/options#quote-props
171
+ * @default "consistent"
172
+ */
28
173
  quoteProps: "as-needed" | "consistent" | "preserve";
174
+ /**
175
+ * Whether or not to indent the code inside <script> and <style> tags in Vue files.
176
+ * @default false
177
+ *
178
+ * @see https://prettier.io/docs/options#vue-indent-script-and-style
179
+ */
29
180
  vueIndentScriptAndStyle: boolean;
181
+ /**
182
+ * Control whether Prettier formats quoted code embedded in the file.
183
+ * @default "auto"
184
+ *
185
+ * @see https://prettier.io/docs/options#embedded-language-formatting
186
+ */
30
187
  embeddedLanguageFormatting: "auto" | "off";
188
+ /**
189
+ * Enforce single attribute per line in HTML, Vue and JSX.
190
+ * @default true
191
+ *
192
+ * @see https://prettier.io/docs/options#single-attribute-per-line
193
+ */
31
194
  singleAttributePerLine: boolean;
32
- experimentalOperatorPosition?: "start" | "end" | undefined;
33
- experimentalTernaries?: boolean | undefined;
34
- jsxBracketSameLine?: boolean;
35
- printWidth: number;
36
- tabWidth: number;
37
- useTabs: boolean;
38
- parentParser?: string | undefined;
39
- __embeddedInHtml?: boolean | undefined;
40
- };
195
+ /**
196
+ * Where to print operators when binary expressions wrap lines.
197
+ * @default "end"
198
+ *
199
+ * @see https://prettier.io/docs/options#experimental-operator-position
200
+ */
201
+ experimentalOperatorPosition: "start" | "end";
202
+ /**
203
+ * Use curious ternaries, with the question mark after the condition, instead of on the same line as the consequent.
204
+ * @default false
205
+ *
206
+ * @see https://prettier.io/docs/options#experimental-ternaries
207
+ */
208
+ experimentalTernaries: boolean;
209
+ /**
210
+ * Put the `>` of a multi-line JSX element at the end of the last line instead of being alone on the next line.
211
+ * @default false
212
+ *
213
+ * @deprecated use bracketSameLine instead
214
+ */
215
+ jsxBracketSameLine: boolean;
216
+ /**
217
+ * Arbitrary additional values on an options object are always allowed.
218
+ */
219
+ [_: string]: unknown;
220
+ }
221
+ //#endregion
222
+ //#region src/index.d.ts
223
+ declare function withTimbic(options?: Config): Config;
41
224
  //#endregion
42
225
  export { withTimbic as default };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@timbic/prettier-config",
3
3
  "type": "module",
4
- "version": "1.0.11",
4
+ "version": "1.1.0",
5
5
  "private": false,
6
6
  "description": "Timbic's prettier configuration",
7
7
  "author": "Timur Bikmuhametov <tim.bic22@gmail.com>",