@bfra.me/prettier-config 0.2.0 → 0.2.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/package.json +2 -2
- package/prettier.config.js +10 -3
- package/prettier.config.ts +12 -3
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@bfra.me/prettier-config",
|
3
|
-
"version": "0.2.
|
3
|
+
"version": "0.2.2",
|
4
4
|
"description": "Shared Prettier configuration for bfra.me",
|
5
5
|
"license": "MIT",
|
6
6
|
"author": "Marcus R. Brown <contact@bfra.me>",
|
@@ -33,7 +33,7 @@
|
|
33
33
|
},
|
34
34
|
"devDependencies": {
|
35
35
|
"prettier": "3.2.5",
|
36
|
-
"@bfra.me/prettier-config": "0.2.
|
36
|
+
"@bfra.me/prettier-config": "0.2.2",
|
37
37
|
"@bfra.me/tsconfig": "0.3.1"
|
38
38
|
},
|
39
39
|
"keywords": [
|
package/prettier.config.js
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
import {parsers} from 'prettier/plugins/babel'
|
2
2
|
import {format} from 'prettier-package-json'
|
3
|
+
const jsonStringifyParser = parsers['json-stringify']
|
3
4
|
/**
|
4
5
|
* Shared Prettier configuration for bfra.me projects.
|
5
6
|
*/
|
@@ -38,18 +39,21 @@ const config = {
|
|
38
39
|
'**/lib/**',
|
39
40
|
'**/coverage/**',
|
40
41
|
'**/out/**',
|
41
|
-
'**/.changeset/**',
|
42
42
|
'**/.idea/**',
|
43
43
|
'**/.nuxt/**',
|
44
44
|
'**/.vercel/**',
|
45
45
|
'**/.vitepress/cache/**',
|
46
46
|
'**/.vite-inspect/**',
|
47
47
|
'**/__snapshots__/**',
|
48
|
+
'**/.changeset/*.md',
|
48
49
|
'**/CHANGELOG*.md',
|
49
50
|
'**/changelog*.md',
|
50
51
|
'**/LICENSE*',
|
51
52
|
'**/license*',
|
52
53
|
'**/*.min.*',
|
54
|
+
'package-lock.json',
|
55
|
+
'pnpm-lock.yaml',
|
56
|
+
'yarn.lock',
|
53
57
|
],
|
54
58
|
options: {
|
55
59
|
requirePragma: true,
|
@@ -60,10 +64,13 @@ const config = {
|
|
60
64
|
{
|
61
65
|
parsers: {
|
62
66
|
'json-stringify': {
|
63
|
-
...
|
67
|
+
...jsonStringifyParser,
|
64
68
|
preprocess(text, options) {
|
69
|
+
if (jsonStringifyParser.preprocess) {
|
70
|
+
text = jsonStringifyParser.preprocess(text, options)
|
71
|
+
}
|
65
72
|
if (/package.*json$/u.test(options.filepath)) {
|
66
|
-
|
73
|
+
text = format(JSON.parse(text), {
|
67
74
|
tabWidth: options.tabWidth,
|
68
75
|
useTabs: options.useTabs === true,
|
69
76
|
...(options['prettier-package-json'] ?? {}),
|
package/prettier.config.ts
CHANGED
@@ -2,6 +2,8 @@ import type {Config, ParserOptions} from 'prettier'
|
|
2
2
|
import {parsers} from 'prettier/plugins/babel'
|
3
3
|
import {format, type Options as PrettierPackageJsonOptions} from 'prettier-package-json'
|
4
4
|
|
5
|
+
const jsonStringifyParser = parsers['json-stringify']
|
6
|
+
|
5
7
|
/**
|
6
8
|
* Shared Prettier configuration for bfra.me projects.
|
7
9
|
*/
|
@@ -43,7 +45,6 @@ const config: Config = {
|
|
43
45
|
'**/lib/**',
|
44
46
|
'**/coverage/**',
|
45
47
|
'**/out/**',
|
46
|
-
'**/.changeset/**',
|
47
48
|
'**/.idea/**',
|
48
49
|
'**/.nuxt/**',
|
49
50
|
'**/.vercel/**',
|
@@ -51,11 +52,16 @@ const config: Config = {
|
|
51
52
|
'**/.vite-inspect/**',
|
52
53
|
'**/__snapshots__/**',
|
53
54
|
|
55
|
+
'**/.changeset/*.md',
|
54
56
|
'**/CHANGELOG*.md',
|
55
57
|
'**/changelog*.md',
|
56
58
|
'**/LICENSE*',
|
57
59
|
'**/license*',
|
58
60
|
'**/*.min.*',
|
61
|
+
|
62
|
+
'package-lock.json',
|
63
|
+
'pnpm-lock.yaml',
|
64
|
+
'yarn.lock',
|
59
65
|
],
|
60
66
|
options: {
|
61
67
|
requirePragma: true,
|
@@ -67,11 +73,14 @@ const config: Config = {
|
|
67
73
|
{
|
68
74
|
parsers: {
|
69
75
|
'json-stringify': {
|
70
|
-
...
|
76
|
+
...jsonStringifyParser,
|
71
77
|
|
72
78
|
preprocess(text: string, options: ParserOptions) {
|
79
|
+
if (jsonStringifyParser.preprocess) {
|
80
|
+
text = jsonStringifyParser.preprocess(text, options)
|
81
|
+
}
|
73
82
|
if (/package.*json$/u.test(options.filepath)) {
|
74
|
-
|
83
|
+
text = format(JSON.parse(text), {
|
75
84
|
tabWidth: options.tabWidth,
|
76
85
|
useTabs: options.useTabs === true,
|
77
86
|
...((options['prettier-package-json'] ??
|