@timbic/prettier-config 1.0.10 → 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.
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,4 +1,224 @@
1
- import { Config } from "prettier";
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> {
7
+ overrides?: Array<{
8
+ files: string | string[];
9
+ excludeFiles?: string | string[];
10
+ options?: Options;
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
+ */
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
+ */
50
+ singleQuote: boolean;
51
+ /**
52
+ * Use single quotes in JSX.
53
+ * @default false
54
+ *
55
+ * @see https://prettier.io/docs/options#quotes
56
+ */
57
+ jsxSingleQuote: boolean;
58
+ /**
59
+ * Print trailing commas wherever possible.
60
+ * @default "all"
61
+ *
62
+ * @see https://prettier.io/docs/options#trailing-commas
63
+ */
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
+ */
71
+ bracketSpacing: boolean;
72
+ /**
73
+ * How to wrap object literals.
74
+ * @default "preserve"
75
+ *
76
+ * @see https://prettier.io/docs/options#object-wrap
77
+ */
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
+ */
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
+ */
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
+ */
100
+ rangeEnd: number;
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
+ */
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
+ */
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
+ */
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
+ */
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
+ */
148
+ arrowParens: "avoid" | "always";
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
+ */
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
+ */
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
+ */
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
+ */
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
+ */
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
+ */
194
+ singleAttributePerLine: boolean;
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
2
222
  //#region src/index.d.ts
3
223
  declare function withTimbic(options?: Config): Config;
4
224
  //#endregion
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  //#region src/index.ts
2
- const DEFAULT_CONFIG = {
2
+ const defaultConfig = {
3
3
  arrowParens: "always",
4
4
  bracketSameLine: false,
5
5
  bracketSpacing: true,
@@ -26,7 +26,7 @@ const DEFAULT_CONFIG = {
26
26
  };
27
27
  function withTimbic(options) {
28
28
  return {
29
- ...DEFAULT_CONFIG,
29
+ ...defaultConfig,
30
30
  ...options
31
31
  };
32
32
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@timbic/prettier-config",
3
3
  "type": "module",
4
- "version": "1.0.10",
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>",
@@ -20,27 +20,38 @@
20
20
  "main": "./dist/index.js",
21
21
  "types": "./dist/index.d.ts",
22
22
  "files": [
23
- ".prettierignore",
24
23
  "dist"
25
24
  ],
26
25
  "publishConfig": {
27
26
  "access": "public"
28
27
  },
29
28
  "peerDependencies": {
30
- "prettier": "^3.9.5"
29
+ "prettier": "^3.0.0"
31
30
  },
32
31
  "dependencies": {
33
- "prettier": "3.9.5"
32
+ "prettier": "^3.9.5"
34
33
  },
35
34
  "devDependencies": {
35
+ "@timbic/eslint-config": "1.0.0",
36
36
  "bumpp": "^11.1.0",
37
+ "eslint": "10.7.0",
38
+ "husky": "^9.1.7",
39
+ "lint-staged": "^17.0.8",
37
40
  "tsdown": "^0.22.5",
38
41
  "typescript": "^6.0.3"
39
42
  },
43
+ "lint-staged": {
44
+ "*/**/*.{js,ts,md,json}": [
45
+ "pnpm fmt",
46
+ "pnpm lint:fix"
47
+ ]
48
+ },
40
49
  "scripts": {
41
50
  "build": "tsdown",
42
- "format": "prettier --write .",
43
- "format:check": "prettier --check .",
51
+ "fmt": "prettier --cache --write .",
52
+ "fmt:chk": "prettier --check .",
53
+ "lint": "eslint --cache",
54
+ "lint:fix": "eslint --cache --fix",
44
55
  "typecheck": "tsc --noEmit",
45
56
  "release": "bumpp"
46
57
  }
package/.prettierignore DELETED
@@ -1,39 +0,0 @@
1
- node_modules
2
-
3
- dist
4
- build
5
-
6
- lib-cov
7
- coverage
8
- .nyc_output
9
-
10
- .gitattributes
11
- .gitignore
12
-
13
- LICENSE
14
-
15
- .env
16
-
17
- .npm
18
- .npmrc
19
- .yarn
20
- .yarn-integrity
21
- .yarnclean
22
- *.tgz
23
- npm-debug.log*
24
- yarn-debug.log*
25
- yarn-error.log*
26
- yarn.lock
27
- .pnpm
28
- pnpm-lock.yaml
29
-
30
- logs
31
- *.log
32
-
33
- .browserslistrc
34
- .editorconfig
35
- .eslintignore
36
- .markdownlintignore
37
- .prettierignore
38
-
39
- CHANGELOG.md