@bfra.me/prettier-config 0.2.2 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +8 -7
- package/prettier.config.js +3 -25
- package/prettier.config.ts +4 -28
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@bfra.me/prettier-config",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.3.1",
|
4
4
|
"description": "Shared Prettier configuration for bfra.me",
|
5
5
|
"license": "MIT",
|
6
6
|
"author": "Marcus R. Brown <contact@bfra.me>",
|
@@ -14,8 +14,8 @@
|
|
14
14
|
"type": "module",
|
15
15
|
"exports": {
|
16
16
|
".": {
|
17
|
-
"
|
18
|
-
"
|
17
|
+
"types": "./prettier.config.d.ts",
|
18
|
+
"import": "./prettier.config.js"
|
19
19
|
},
|
20
20
|
"./package.json": "./package.json"
|
21
21
|
},
|
@@ -26,15 +26,15 @@
|
|
26
26
|
],
|
27
27
|
"types": "prettier.config.d.ts",
|
28
28
|
"dependencies": {
|
29
|
-
"prettier-
|
29
|
+
"@bfra.me/prettier-plugins": "0.1.1"
|
30
30
|
},
|
31
31
|
"peerDependencies": {
|
32
32
|
"prettier": "^3.0.0"
|
33
33
|
},
|
34
34
|
"devDependencies": {
|
35
35
|
"prettier": "3.2.5",
|
36
|
-
"@bfra.me/prettier-config": "0.
|
37
|
-
"@bfra.me/tsconfig": "0.
|
36
|
+
"@bfra.me/prettier-config": "0.3.1",
|
37
|
+
"@bfra.me/tsconfig": "0.4.0"
|
38
38
|
},
|
39
39
|
"keywords": [
|
40
40
|
"bfra.me",
|
@@ -49,6 +49,7 @@
|
|
49
49
|
"provenance": true
|
50
50
|
},
|
51
51
|
"scripts": {
|
52
|
-
"build": "tsc
|
52
|
+
"build": "tsc --build && pnpm run format",
|
53
|
+
"format": "prettier --log-level error --ignore-unknown --write prettier.config.*"
|
53
54
|
}
|
54
55
|
}
|
package/prettier.config.js
CHANGED
@@ -1,6 +1,5 @@
|
|
1
|
-
import {
|
2
|
-
|
3
|
-
const jsonStringifyParser = parsers['json-stringify']
|
1
|
+
import {createRequire} from 'module'
|
2
|
+
const {resolve} = createRequire(import.meta.url)
|
4
3
|
/**
|
5
4
|
* Shared Prettier configuration for bfra.me projects.
|
6
5
|
*/
|
@@ -60,28 +59,7 @@ const config = {
|
|
60
59
|
},
|
61
60
|
},
|
62
61
|
],
|
63
|
-
plugins: [
|
64
|
-
{
|
65
|
-
parsers: {
|
66
|
-
'json-stringify': {
|
67
|
-
...jsonStringifyParser,
|
68
|
-
preprocess(text, options) {
|
69
|
-
if (jsonStringifyParser.preprocess) {
|
70
|
-
text = jsonStringifyParser.preprocess(text, options)
|
71
|
-
}
|
72
|
-
if (/package.*json$/u.test(options.filepath)) {
|
73
|
-
text = format(JSON.parse(text), {
|
74
|
-
tabWidth: options.tabWidth,
|
75
|
-
useTabs: options.useTabs === true,
|
76
|
-
...(options['prettier-package-json'] ?? {}),
|
77
|
-
})
|
78
|
-
}
|
79
|
-
return text
|
80
|
-
},
|
81
|
-
},
|
82
|
-
},
|
83
|
-
},
|
84
|
-
],
|
62
|
+
plugins: ['@bfra.me/prettier-plugins/package-json'].map(plugin => resolve(plugin)),
|
85
63
|
}
|
86
64
|
export default config
|
87
65
|
//# sourceMappingURL=prettier.config.js.map
|
package/prettier.config.ts
CHANGED
@@ -1,8 +1,7 @@
|
|
1
|
-
import
|
2
|
-
import {
|
3
|
-
import {format, type Options as PrettierPackageJsonOptions} from 'prettier-package-json'
|
1
|
+
import {createRequire} from 'module'
|
2
|
+
import type {Config} from 'prettier'
|
4
3
|
|
5
|
-
const
|
4
|
+
const {resolve} = createRequire(import.meta.url)
|
6
5
|
|
7
6
|
/**
|
8
7
|
* Shared Prettier configuration for bfra.me projects.
|
@@ -69,30 +68,7 @@ const config: Config = {
|
|
69
68
|
},
|
70
69
|
],
|
71
70
|
|
72
|
-
plugins: [
|
73
|
-
{
|
74
|
-
parsers: {
|
75
|
-
'json-stringify': {
|
76
|
-
...jsonStringifyParser,
|
77
|
-
|
78
|
-
preprocess(text: string, options: ParserOptions) {
|
79
|
-
if (jsonStringifyParser.preprocess) {
|
80
|
-
text = jsonStringifyParser.preprocess(text, options)
|
81
|
-
}
|
82
|
-
if (/package.*json$/u.test(options.filepath)) {
|
83
|
-
text = format(JSON.parse(text), {
|
84
|
-
tabWidth: options.tabWidth,
|
85
|
-
useTabs: options.useTabs === true,
|
86
|
-
...((options['prettier-package-json'] ??
|
87
|
-
{}) as Partial<PrettierPackageJsonOptions>),
|
88
|
-
})
|
89
|
-
}
|
90
|
-
return text
|
91
|
-
},
|
92
|
-
},
|
93
|
-
},
|
94
|
-
},
|
95
|
-
],
|
71
|
+
plugins: ['@bfra.me/prettier-plugins/package-json'].map(plugin => resolve(plugin)),
|
96
72
|
}
|
97
73
|
|
98
74
|
export default config
|