File tree Expand file tree Collapse file tree 6 files changed +99
-64
lines changed
Expand file tree Collapse file tree 6 files changed +99
-64
lines changed Original file line number Diff line number Diff line change 55 "repository" : " https://github.com/atom-community/prettier-config-atomic" ,
66 "license" : " MIT" ,
77 "author" : " Amin Yahyaabadi" ,
8- "main" : " ./prettier.config.js" ,
8+ "type" : " module" ,
9+ "main" : " dist/prettier.config.js" ,
910 "files" : [
10- " prettier.config.js"
11+ " dist" ,
12+ " src"
1113 ],
1214 "scripts" : {
15+ "build" : " tsc -p tsconfig.json --pretty" ,
1316 "bump" : " ncu -u" ,
1417 "format" : " prettier --write ./" ,
1518 "lint" : " eslint . --fix" ,
19+ "prepare" : " pnpm run build" ,
1620 "test.format" : " prettier ./ --check" ,
1721 "test.lint" : " eslint ."
1822 },
Original file line number Diff line number Diff line change 1- // Modified from https://github.com/matzkoh/prettier-plugin-packagejson to use the custom sort-package.json package
2- function prettier_plugin_packagejson ( ) {
3- function requireSafe ( path ) {
4- try {
5- return require ( path )
6- } catch ( error ) {
7- // no operations
8- }
9- }
10-
11- const { parsers } = requireSafe ( "prettier/parser-babel" ) || requireSafe ( "prettier/parser-babylon" )
12- const sortPackageJson = require ( "sort-package-json" )
13- const parser = parsers [ "json-stringify" ]
14-
15- return {
16- parsers : {
17- "json-stringify" : {
18- ...parser ,
19- preprocess ( text_given , options ) {
20- let text = text_given
21- if ( parser . preprocess ) {
22- text = parser . preprocess ( text , options )
23- }
24-
25- return options . filepath && / ( ^ | \\ | \/ ) p a c k a g e \. j s o n $ / . test ( options . filepath ) ? sortPackageJson ( text ) : text
26- } ,
27- } ,
28- } ,
29- }
30- }
31-
32- module . exports = {
33- plugins : [ require ( "prettier-plugin-jsdoc" ) , prettier_plugin_packagejson ( ) ] ,
34- tabWidth : 2 ,
35- printWidth : 120 ,
36- semi : false ,
37- singleQuote : false ,
38- tsdoc : true ,
39- overrides : [
40- {
41- files : "{*.json}" ,
42- options : {
43- parser : "json" ,
44- trailingComma : "es5" ,
45- } ,
46- } ,
47- {
48- files : "{*.md}" ,
49- options : {
50- parser : "markdown" ,
51- proseWrap : "preserve" ,
52- } ,
53- } ,
54- {
55- files : "{*.mdx}" ,
56- options : {
57- parser : "mdx" ,
58- proseWrap : "preserve" ,
59- } ,
60- } ,
61- ] ,
62- }
1+ import prettierConfig from "./dist/prettier.config.js"
2+ export default prettierConfig
Original file line number Diff line number Diff line change 1+ import { pluginPackageJson } from "./sort_package_json.js"
2+ import * as pluginJsDoc from "prettier-plugin-jsdoc"
3+
4+ export default {
5+ plugins : [ pluginJsDoc , pluginPackageJson ( ) ] ,
6+ tabWidth : 2 ,
7+ printWidth : 120 ,
8+ semi : false ,
9+ singleQuote : false ,
10+ tsdoc : true ,
11+ overrides : [
12+ {
13+ files : "{*.json}" ,
14+ options : {
15+ parser : "json" ,
16+ trailingComma : "es5" ,
17+ } ,
18+ } ,
19+ {
20+ files : "{*.md}" ,
21+ options : {
22+ parser : "markdown" ,
23+ proseWrap : "preserve" ,
24+ } ,
25+ } ,
26+ {
27+ files : "{*.mdx}" ,
28+ options : {
29+ parser : "mdx" ,
30+ proseWrap : "preserve" ,
31+ } ,
32+ } ,
33+ ] ,
34+ }
Original file line number Diff line number Diff line change 1+ import { parsers } from "prettier/plugins/babel.mjs"
2+ import { sortPackageJson } from "sort-package-json"
3+
4+ /** Modified from https://github.com/matzkoh/prettier-plugin-packagejson to use the custom sort-package.json package */
5+ export function pluginPackageJson ( ) {
6+ const parser = parsers [ "json-stringify" ]
7+
8+ return {
9+ parsers : {
10+ "json-stringify" : {
11+ ...parser ,
12+ preprocess ( text_given : string , options : any ) {
13+ let text = text_given
14+ if ( parser . preprocess ) {
15+ text = parser . preprocess ( text , options )
16+ }
17+
18+ return options . filepath && / ( ^ | \\ | \/ ) p a c k a g e \. j s o n $ / . test ( options . filepath ) ? sortPackageJson ( text ) : text
19+ } ,
20+ } ,
21+ } ,
22+ }
23+ }
Original file line number Diff line number Diff line change 1+ declare module "prettier/plugins/babel.mjs" {
2+ export * from "prettier/plugins/babel"
3+ }
Original file line number Diff line number Diff line change 1+ {
2+ "compilerOptions" : {
3+ "strict" : true ,
4+ "strictNullChecks" : true ,
5+ "noUnusedLocals" : true ,
6+ "noUnusedParameters" : true ,
7+ "noImplicitReturns" : true ,
8+ "noImplicitAny" : true ,
9+ "noImplicitThis" : true ,
10+ "noFallthroughCasesInSwitch" : true ,
11+ "declaration" : true ,
12+ "emitDecoratorMetadata" : true ,
13+ "experimentalDecorators" : true ,
14+ "incremental" : true ,
15+ "inlineSourceMap" : false ,
16+ "inlineSources" : false ,
17+ "preserveSymlinks" : true ,
18+ "removeComments" : false ,
19+ "lib" : [" ES2022" ],
20+ "skipLibCheck" : true ,
21+ "target" : " ES2022" ,
22+ "allowJs" : true ,
23+ "esModuleInterop" : true ,
24+ "module" : " ES2022" ,
25+ "moduleResolution" : " node" ,
26+ "importHelpers" : false ,
27+ "outDir" : " ./dist"
28+ },
29+ "include" : [" ./src/**/*" ],
30+ "compileOnSave" : false
31+ }
You can’t perform that action at this time.
0 commit comments