@jpp-toolkit/prettier-config 0.0.11
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/LICENSE.md +21 -0
- package/dist/index.d.mts +7 -0
- package/dist/index.mjs +27 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +57 -0
- package/src/index.ts +111 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Julien Papini
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/index.d.mts
ADDED
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
|
|
3
|
+
//#region src/index.ts
|
|
4
|
+
const config = {
|
|
5
|
+
experimentalTernaries: true,
|
|
6
|
+
experimentalOperatorPosition: "start",
|
|
7
|
+
printWidth: 100,
|
|
8
|
+
tabWidth: 4,
|
|
9
|
+
useTabs: false,
|
|
10
|
+
semi: true,
|
|
11
|
+
singleQuote: true,
|
|
12
|
+
quoteProps: "consistent",
|
|
13
|
+
jsxSingleQuote: false,
|
|
14
|
+
trailingComma: "all",
|
|
15
|
+
bracketSpacing: true,
|
|
16
|
+
objectWrap: "preserve",
|
|
17
|
+
bracketSameLine: false,
|
|
18
|
+
arrowParens: "always",
|
|
19
|
+
endOfLine: "lf",
|
|
20
|
+
singleAttributePerLine: false,
|
|
21
|
+
plugins: [createRequire(import.meta.url).resolve("@jpp-toolkit/prettier-plugin-packagejson")]
|
|
22
|
+
};
|
|
23
|
+
var src_default = config;
|
|
24
|
+
|
|
25
|
+
//#endregion
|
|
26
|
+
export { src_default as default };
|
|
27
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["config: Config"],"sources":["../src/index.ts"],"sourcesContent":["import { createRequire } from 'node:module';\n\nimport type { Config } from 'prettier';\n\nconst require = createRequire(import.meta.url);\n\nconst config: Config = {\n /**\n * Use curious ternaries, with the question mark after the condition.\n * @see {@link https://prettier.io/docs/options#experimental-ternaries}\n */\n experimentalTernaries: true,\n\n /**\n * When binary expressions wrap lines, print operators at the start of new lines.\n * @see {@link https://prettier.io/docs/options#experimental-operator-position}\n */\n experimentalOperatorPosition: 'start',\n\n /**\n * Specify the line length that the printer will wrap on.\n * @see {@link https://prettier.io/docs/options#print-width}\n */\n printWidth: 100,\n\n /**\n * Specify the number of spaces per indentation-level.\n * @see {@link https://prettier.io/docs/options#tab-width}\n */\n tabWidth: 4,\n\n /**\n * Indent lines with spaces instead of tabs.\n * @see {@link https://prettier.io/docs/options#tabs}\n */\n useTabs: false,\n\n /**\n * Add a semicolon at the end of every statement.\n * @see {@link https://prettier.io/docs/options#semicolons}\n */\n semi: true,\n\n /**\n * Use single quotes instead of double quotes.\n * @see {@link https://prettier.io/docs/options#quotes}\n */\n singleQuote: true,\n\n /**\n * If at least one property in an object requires quotes, quote all properties.\n * @see {@link https://prettier.io/docs/options#quote-props}\n */\n quoteProps: 'consistent',\n\n /**\n * Use double quotes instead of single quotes in JSX.\n * @see {@link https://prettier.io/docs/options#jsx-quotes}\n */\n jsxSingleQuote: false,\n\n /**\n * Trailing commas wherever possible.\n * @see {@link https://prettier.io/docs/options#trailing-commas}\n */\n trailingComma: 'all',\n\n /**\n * Print spaces between brackets in object literals.\n * @see {@link https://prettier.io/docs/options#bracket-spacing}\n */\n bracketSpacing: true,\n\n /**\n * Keep as multi-line, if there is a newline between the opening brace and first property.\n * @see {@link https://prettier.io/docs/options#object-wrap}\n */\n objectWrap: 'preserve',\n\n /**\n * Put the `>` of a multi-line JSX element alone on the next line.\n * @see {@link https://prettier.io/docs/options#bracket-line}\n */\n bracketSameLine: false,\n\n /**\n * Always include parens.\n * @see {@link https://prettier.io/docs/options#arrow-function-parentheses}\n */\n arrowParens: 'always',\n\n /**\n * Line Feed only (\\n), common on Linux and macOS as well as inside git repos.\n * @see {@link https://prettier.io/docs/options#end-of-line}\n */\n endOfLine: 'lf',\n\n /**\n * Do not enforce single attribute per line.\n * @see {@link https://prettier.io/docs/options#single-attribute-per-line}\n */\n singleAttributePerLine: false,\n\n /**\n * Plugins to use with Prettier.\n * @see {@link https://prettier.io/docs/en/plugins.html}\n */\n plugins: [require.resolve('@jpp-toolkit/prettier-plugin-packagejson')],\n};\n\nexport default config;\n"],"mappings":";;;AAMA,MAAMA,SAAiB;CAKnB,uBAAuB;CAMvB,8BAA8B;CAM9B,YAAY;CAMZ,UAAU;CAMV,SAAS;CAMT,MAAM;CAMN,aAAa;CAMb,YAAY;CAMZ,gBAAgB;CAMhB,eAAe;CAMf,gBAAgB;CAMhB,YAAY;CAMZ,iBAAiB;CAMjB,aAAa;CAMb,WAAW;CAMX,wBAAwB;CAMxB,SAAS,CAvGG,cAAc,OAAO,KAAK,IAAI,CAuGxB,QAAQ,2CAA2C,CAAC;CACzE;AAED,kBAAe"}
|
package/package.json
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@jpp-toolkit/prettier-config",
|
|
3
|
+
"version": "0.0.11",
|
|
4
|
+
"description": "Prettier configurations for JS/TS projects.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"jpp",
|
|
7
|
+
"prettier",
|
|
8
|
+
"config"
|
|
9
|
+
],
|
|
10
|
+
"homepage": "https://github.com/jpapini/jpp-toolkit/tree/main/packages/prettier-config#readme",
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/jpapini/jpp-toolkit/issues"
|
|
13
|
+
},
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "git+https://github.com/jpapini/jpp-toolkit.git",
|
|
17
|
+
"directory": "packages/prettier-config"
|
|
18
|
+
},
|
|
19
|
+
"license": "MIT",
|
|
20
|
+
"author": "Julien Papini <julien.papini@gmail.com> (https://github.com/jpapini)",
|
|
21
|
+
"type": "module",
|
|
22
|
+
"exports": {
|
|
23
|
+
".": {
|
|
24
|
+
"types": "./dist/index.d.mts",
|
|
25
|
+
"default": "./dist/index.mjs"
|
|
26
|
+
},
|
|
27
|
+
"./package.json": "./package.json"
|
|
28
|
+
},
|
|
29
|
+
"files": [
|
|
30
|
+
"dist",
|
|
31
|
+
"src"
|
|
32
|
+
],
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"@jpp-toolkit/prettier-plugin-packagejson": "0.0.11"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"prettier": "3.7.4"
|
|
38
|
+
},
|
|
39
|
+
"peerDependencies": {
|
|
40
|
+
"prettier": "3"
|
|
41
|
+
},
|
|
42
|
+
"engines": {
|
|
43
|
+
"node": "24",
|
|
44
|
+
"pnpm": "10"
|
|
45
|
+
},
|
|
46
|
+
"volta": {
|
|
47
|
+
"extends": "../../package.json"
|
|
48
|
+
},
|
|
49
|
+
"publishConfig": {
|
|
50
|
+
"access": "public"
|
|
51
|
+
},
|
|
52
|
+
"scripts": {
|
|
53
|
+
"typecheck": "tsc --noEmit --pretty",
|
|
54
|
+
"dev": "build-lib --watch",
|
|
55
|
+
"build": "build-lib"
|
|
56
|
+
}
|
|
57
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';
|
|
2
|
+
|
|
3
|
+
import type { Config } from 'prettier';
|
|
4
|
+
|
|
5
|
+
const require = createRequire(import.meta.url);
|
|
6
|
+
|
|
7
|
+
const config: Config = {
|
|
8
|
+
/**
|
|
9
|
+
* Use curious ternaries, with the question mark after the condition.
|
|
10
|
+
* @see {@link https://prettier.io/docs/options#experimental-ternaries}
|
|
11
|
+
*/
|
|
12
|
+
experimentalTernaries: true,
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* When binary expressions wrap lines, print operators at the start of new lines.
|
|
16
|
+
* @see {@link https://prettier.io/docs/options#experimental-operator-position}
|
|
17
|
+
*/
|
|
18
|
+
experimentalOperatorPosition: 'start',
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Specify the line length that the printer will wrap on.
|
|
22
|
+
* @see {@link https://prettier.io/docs/options#print-width}
|
|
23
|
+
*/
|
|
24
|
+
printWidth: 100,
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Specify the number of spaces per indentation-level.
|
|
28
|
+
* @see {@link https://prettier.io/docs/options#tab-width}
|
|
29
|
+
*/
|
|
30
|
+
tabWidth: 4,
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Indent lines with spaces instead of tabs.
|
|
34
|
+
* @see {@link https://prettier.io/docs/options#tabs}
|
|
35
|
+
*/
|
|
36
|
+
useTabs: false,
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Add a semicolon at the end of every statement.
|
|
40
|
+
* @see {@link https://prettier.io/docs/options#semicolons}
|
|
41
|
+
*/
|
|
42
|
+
semi: true,
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Use single quotes instead of double quotes.
|
|
46
|
+
* @see {@link https://prettier.io/docs/options#quotes}
|
|
47
|
+
*/
|
|
48
|
+
singleQuote: true,
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* If at least one property in an object requires quotes, quote all properties.
|
|
52
|
+
* @see {@link https://prettier.io/docs/options#quote-props}
|
|
53
|
+
*/
|
|
54
|
+
quoteProps: 'consistent',
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Use double quotes instead of single quotes in JSX.
|
|
58
|
+
* @see {@link https://prettier.io/docs/options#jsx-quotes}
|
|
59
|
+
*/
|
|
60
|
+
jsxSingleQuote: false,
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Trailing commas wherever possible.
|
|
64
|
+
* @see {@link https://prettier.io/docs/options#trailing-commas}
|
|
65
|
+
*/
|
|
66
|
+
trailingComma: 'all',
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Print spaces between brackets in object literals.
|
|
70
|
+
* @see {@link https://prettier.io/docs/options#bracket-spacing}
|
|
71
|
+
*/
|
|
72
|
+
bracketSpacing: true,
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Keep as multi-line, if there is a newline between the opening brace and first property.
|
|
76
|
+
* @see {@link https://prettier.io/docs/options#object-wrap}
|
|
77
|
+
*/
|
|
78
|
+
objectWrap: 'preserve',
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Put the `>` of a multi-line JSX element alone on the next line.
|
|
82
|
+
* @see {@link https://prettier.io/docs/options#bracket-line}
|
|
83
|
+
*/
|
|
84
|
+
bracketSameLine: false,
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Always include parens.
|
|
88
|
+
* @see {@link https://prettier.io/docs/options#arrow-function-parentheses}
|
|
89
|
+
*/
|
|
90
|
+
arrowParens: 'always',
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Line Feed only (\n), common on Linux and macOS as well as inside git repos.
|
|
94
|
+
* @see {@link https://prettier.io/docs/options#end-of-line}
|
|
95
|
+
*/
|
|
96
|
+
endOfLine: 'lf',
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Do not enforce single attribute per line.
|
|
100
|
+
* @see {@link https://prettier.io/docs/options#single-attribute-per-line}
|
|
101
|
+
*/
|
|
102
|
+
singleAttributePerLine: false,
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Plugins to use with Prettier.
|
|
106
|
+
* @see {@link https://prettier.io/docs/en/plugins.html}
|
|
107
|
+
*/
|
|
108
|
+
plugins: [require.resolve('@jpp-toolkit/prettier-plugin-packagejson')],
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
export default config;
|