@timbic/prettier-config 2.0.0 → 2.0.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 +5 -0
- package/dist/index.d.ts +13 -1
- package/dist/index.js +14 -5
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
<p>
|
|
4
4
|
<a href="https://www.npmjs.com/package/@timbic/prettier-config"><img src="https://img.shields.io/npm/v/@timbic/prettier-config.svg?logo=nodedotjs" alt="npm package"></a>
|
|
5
5
|
<a href="https://github.com/Timbic/prettier-config"><img src="https://img.shields.io/badge/Github-gray.svg?logo=github" alt="github repo"></a>
|
|
6
|
+
<a href="https://npmx.dev/package/@timbic/prettier-config"><img src="https://img.shields.io/badge/npmx.dev-black?logo=npm" alt="view on npmx"></a>
|
|
6
7
|
</p>
|
|
7
8
|
|
|
8
9
|
Extensible Prettier configuration for smart developers.
|
|
@@ -95,3 +96,7 @@ export default withTimbic({
|
|
|
95
96
|
vueIndentScriptAndStyle: false,
|
|
96
97
|
}
|
|
97
98
|
```
|
|
99
|
+
|
|
100
|
+
## License
|
|
101
|
+
|
|
102
|
+
Released under the [MIT License](./LICENSE).
|
package/dist/index.d.ts
CHANGED
|
@@ -422,7 +422,19 @@ export interface TimbicOptions extends OxcTimbicOptions, TailwindTimbicOptions,
|
|
|
422
422
|
* });
|
|
423
423
|
* ```
|
|
424
424
|
*
|
|
425
|
-
* Returns the default config with `singleQuote` overridden to `true`
|
|
425
|
+
* Returns the default config with `singleQuote` overridden to `true` .
|
|
426
|
+
*
|
|
427
|
+
* The second parameter can be used to specify which bundled plugins to activate:
|
|
428
|
+
*
|
|
429
|
+
* @example
|
|
430
|
+
* ```ts
|
|
431
|
+
* export default withTimbic({}, { tailwind: true });
|
|
432
|
+
* ```
|
|
433
|
+
*
|
|
434
|
+
* This will activate `prettier-plugin-tailwindcss` .
|
|
435
|
+
*
|
|
436
|
+
* You can see currently bundled plugins here:
|
|
437
|
+
* @see https://github.com/Timbic/prettier-config#plugins
|
|
426
438
|
*/
|
|
427
439
|
export default function withTimbic(options?: Config, timbicOptions?: TimbicOptions): Config;
|
|
428
440
|
export {};
|
package/dist/index.js
CHANGED
|
@@ -16,6 +16,15 @@ const tailwindDefaultConfig = {
|
|
|
16
16
|
tailwindPreserveWhitespace: false
|
|
17
17
|
};
|
|
18
18
|
// src/index.ts
|
|
19
|
+
const bundledPlugins = /* @__PURE__ */ new Set([
|
|
20
|
+
"@prettier/plugin-oxc",
|
|
21
|
+
"prettier-plugin-astro",
|
|
22
|
+
"prettier-plugin-yaml",
|
|
23
|
+
"prettier-plugin-tailwindcss"
|
|
24
|
+
]);
|
|
25
|
+
function resolveBundledPlugin(plugin) {
|
|
26
|
+
return typeof plugin === "string" && bundledPlugins.has(plugin) ? import.meta.resolve(plugin) : plugin;
|
|
27
|
+
}
|
|
19
28
|
const defaultConfig = {
|
|
20
29
|
arrowParens: "always",
|
|
21
30
|
bracketSameLine: false,
|
|
@@ -46,9 +55,9 @@ function withTimbic(options = {}, timbicOptions = {}) {
|
|
|
46
55
|
const plugins = [];
|
|
47
56
|
const overrides = [];
|
|
48
57
|
let config = { ...defaultConfig };
|
|
49
|
-
if (timbicOptions.oxc) plugins.push("@prettier/plugin-oxc");
|
|
58
|
+
if (timbicOptions.oxc) plugins.push(resolveBundledPlugin("@prettier/plugin-oxc"));
|
|
50
59
|
if (timbicOptions.astro) {
|
|
51
|
-
plugins.push("prettier-plugin-astro");
|
|
60
|
+
plugins.push(resolveBundledPlugin("prettier-plugin-astro"));
|
|
52
61
|
overrides.push({
|
|
53
62
|
files: "*.astro",
|
|
54
63
|
options: { parser: "astro" }
|
|
@@ -59,14 +68,14 @@ function withTimbic(options = {}, timbicOptions = {}) {
|
|
|
59
68
|
};
|
|
60
69
|
}
|
|
61
70
|
if (timbicOptions.yaml) {
|
|
62
|
-
plugins.push("prettier-plugin-yaml");
|
|
71
|
+
plugins.push(resolveBundledPlugin("prettier-plugin-yaml"));
|
|
63
72
|
config = {
|
|
64
73
|
...config,
|
|
65
74
|
...yamlDefaultConfig
|
|
66
75
|
};
|
|
67
76
|
}
|
|
68
77
|
if (timbicOptions.tailwind) {
|
|
69
|
-
plugins.push("prettier-plugin-tailwindcss");
|
|
78
|
+
plugins.push(resolveBundledPlugin("prettier-plugin-tailwindcss"));
|
|
70
79
|
config = {
|
|
71
80
|
...config,
|
|
72
81
|
...tailwindDefaultConfig
|
|
@@ -75,7 +84,7 @@ function withTimbic(options = {}, timbicOptions = {}) {
|
|
|
75
84
|
return {
|
|
76
85
|
...config,
|
|
77
86
|
...rest,
|
|
78
|
-
plugins: [.../* @__PURE__ */ new Set([...plugins, ...userPlugins])],
|
|
87
|
+
plugins: [.../* @__PURE__ */ new Set([...plugins, ...userPlugins.map(resolveBundledPlugin)])],
|
|
79
88
|
overrides: [...overrides, ...userOverrides]
|
|
80
89
|
};
|
|
81
90
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@timbic/prettier-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.2",
|
|
5
5
|
"private": false,
|
|
6
6
|
"description": "Timbic's prettier configuration",
|
|
7
7
|
"author": "Timur Bikmuhametov <tim.bic22@gmail.com>",
|
|
@@ -30,14 +30,14 @@
|
|
|
30
30
|
"prettier": "^3.10.1",
|
|
31
31
|
"prettier-plugin-astro": "^1.1.2",
|
|
32
32
|
"prettier-plugin-tailwindcss": "^0.8.1",
|
|
33
|
-
"prettier-plugin-yaml": "^1.3.
|
|
33
|
+
"prettier-plugin-yaml": "^1.3.2"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@timbic/eslint-config": "1.2.3",
|
|
37
37
|
"bumpp": "12.3.0",
|
|
38
38
|
"eslint": "10.15.0",
|
|
39
39
|
"husky": "9.1.7",
|
|
40
|
-
"lint-staged": "17.6.
|
|
40
|
+
"lint-staged": "17.6.1",
|
|
41
41
|
"tsdown": "0.23.7",
|
|
42
42
|
"typescript": "6.0.3"
|
|
43
43
|
},
|