@bfra.me/prettier-config 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +3 -3
- package/prettier.config.js +3 -21
- package/prettier.config.ts +5 -24
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@bfra.me/prettier-config",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.3.0",
|
4
4
|
"description": "Shared Prettier configuration for bfra.me",
|
5
5
|
"license": "MIT",
|
6
6
|
"author": "Marcus R. Brown <contact@bfra.me>",
|
@@ -26,14 +26,14 @@
|
|
26
26
|
],
|
27
27
|
"types": "prettier.config.d.ts",
|
28
28
|
"dependencies": {
|
29
|
-
"prettier-
|
29
|
+
"@bfra.me/prettier-plugins": "0.1.0"
|
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.
|
36
|
+
"@bfra.me/prettier-config": "0.3.0",
|
37
37
|
"@bfra.me/tsconfig": "0.3.1"
|
38
38
|
},
|
39
39
|
"keywords": [
|
package/prettier.config.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
import {
|
2
|
-
|
1
|
+
import {createRequire} from 'module'
|
2
|
+
const {resolve} = createRequire(import.meta.url)
|
3
3
|
/**
|
4
4
|
* Shared Prettier configuration for bfra.me projects.
|
5
5
|
*/
|
@@ -59,25 +59,7 @@ const config = {
|
|
59
59
|
},
|
60
60
|
},
|
61
61
|
],
|
62
|
-
plugins: [
|
63
|
-
{
|
64
|
-
parsers: {
|
65
|
-
'json-stringify': {
|
66
|
-
...parsers['json-stringify'],
|
67
|
-
preprocess(text, options) {
|
68
|
-
if (/package.*json$/u.test(options.filepath)) {
|
69
|
-
return format(JSON.parse(text), {
|
70
|
-
tabWidth: options.tabWidth,
|
71
|
-
useTabs: options.useTabs === true,
|
72
|
-
...(options['prettier-package-json'] ?? {}),
|
73
|
-
})
|
74
|
-
}
|
75
|
-
return text
|
76
|
-
},
|
77
|
-
},
|
78
|
-
},
|
79
|
-
},
|
80
|
-
],
|
62
|
+
plugins: ['@bfra.me/prettier-plugins/package-json'].map(plugin => resolve(plugin)),
|
81
63
|
}
|
82
64
|
export default config
|
83
65
|
//# sourceMappingURL=prettier.config.js.map
|
package/prettier.config.ts
CHANGED
@@ -1,6 +1,7 @@
|
|
1
|
-
import
|
2
|
-
import {
|
3
|
-
|
1
|
+
import {createRequire} from 'module'
|
2
|
+
import type {Config} from 'prettier'
|
3
|
+
|
4
|
+
const {resolve} = createRequire(import.meta.url)
|
4
5
|
|
5
6
|
/**
|
6
7
|
* Shared Prettier configuration for bfra.me projects.
|
@@ -67,27 +68,7 @@ const config: Config = {
|
|
67
68
|
},
|
68
69
|
],
|
69
70
|
|
70
|
-
plugins: [
|
71
|
-
{
|
72
|
-
parsers: {
|
73
|
-
'json-stringify': {
|
74
|
-
...parsers['json-stringify'],
|
75
|
-
|
76
|
-
preprocess(text: string, options: ParserOptions) {
|
77
|
-
if (/package.*json$/u.test(options.filepath)) {
|
78
|
-
return format(JSON.parse(text), {
|
79
|
-
tabWidth: options.tabWidth,
|
80
|
-
useTabs: options.useTabs === true,
|
81
|
-
...((options['prettier-package-json'] ??
|
82
|
-
{}) as Partial<PrettierPackageJsonOptions>),
|
83
|
-
})
|
84
|
-
}
|
85
|
-
return text
|
86
|
-
},
|
87
|
-
},
|
88
|
-
},
|
89
|
-
},
|
90
|
-
],
|
71
|
+
plugins: ['@bfra.me/prettier-plugins/package-json'].map(plugin => resolve(plugin)),
|
91
72
|
}
|
92
73
|
|
93
74
|
export default config
|