@javalce/prettier-config 2.1.0 → 2.2.1
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/README.md +34 -15
- package/dist/index.cjs +1 -47
- package/dist/index.d.cts +15 -5
- package/dist/index.d.mts +16 -0
- package/dist/index.mjs +1 -0
- package/package.json +14 -13
- package/dist/index.d.ts +0 -5
- package/dist/index.js +0 -22
package/README.md
CHANGED
|
@@ -7,6 +7,7 @@ This is my personal Prettier configuration.
|
|
|
7
7
|
- [Installation](#installation)
|
|
8
8
|
- [Usage](#usage)
|
|
9
9
|
- [Extending the shared configuration](#extending-the-shared-configuration)
|
|
10
|
+
- [TypeScript users:](#typescript-users)
|
|
10
11
|
|
|
11
12
|
## Features
|
|
12
13
|
|
|
@@ -27,7 +28,7 @@ The `prettier-plugin-packagejson` plugin is used to sort the keys of a `package.
|
|
|
27
28
|
## Installation
|
|
28
29
|
|
|
29
30
|
> [!IMPORTANT]
|
|
30
|
-
> Prettier is a peer-dependency of this package
|
|
31
|
+
> Prettier is a peer-dependency of this package and should be installed at the root of your project.
|
|
31
32
|
>
|
|
32
33
|
> See: https://prettier.io/docs/en/install.html
|
|
33
34
|
|
|
@@ -40,36 +41,54 @@ pnpm add --save-dev prettier @javalce/prettier-config
|
|
|
40
41
|
|
|
41
42
|
# If you use yarn
|
|
42
43
|
yarn add --dev prettier @javalce/prettier-config
|
|
44
|
+
|
|
45
|
+
# If you use bun
|
|
46
|
+
bun add --dev prettier @javalce/prettier-config
|
|
43
47
|
```
|
|
44
48
|
|
|
45
49
|
## Usage
|
|
46
50
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
The following example to configure Prettier with this shared configuration is using the `prettier.config.js` file using ES Modules, because recently, packages, like eslint, are moving its configuration files from `rc` files to `*.config.js` files.
|
|
51
|
+
Since version 2.0.0, the configuration is implemented in TypeScript and the package exports both ESM and CommonJS formats.
|
|
50
52
|
|
|
51
|
-
|
|
53
|
+
It is recommended to use a `prettier.config.js` file with ESM syntax, as many tools (like ESLint) are moving from legacy `rc` files to `*.config.js` files for configuration. Example:
|
|
52
54
|
|
|
53
55
|
```js
|
|
54
|
-
import
|
|
56
|
+
import prettierConfig from '@javalce/prettier-config';
|
|
55
57
|
|
|
56
|
-
export default
|
|
58
|
+
export default prettierConfig;
|
|
57
59
|
```
|
|
58
60
|
|
|
59
|
-
|
|
61
|
+
You can also use `.prettierrc.js` or CommonJS if you prefer:
|
|
60
62
|
|
|
61
|
-
|
|
63
|
+
```js
|
|
64
|
+
const prettierConfig = require('@javalce/prettier-config');
|
|
65
|
+
module.exports = prettierConfig;
|
|
66
|
+
```
|
|
62
67
|
|
|
63
|
-
|
|
64
|
-
|
|
68
|
+
### Extending the shared configuration
|
|
69
|
+
|
|
70
|
+
If you want to extend the shared config or override some of its properties, you can import and modify the exported object:
|
|
65
71
|
|
|
66
72
|
```js
|
|
67
|
-
import
|
|
73
|
+
import prettierConfig from '@javalce/prettier-config';
|
|
68
74
|
|
|
69
|
-
export default
|
|
75
|
+
export default {
|
|
76
|
+
...prettierConfig,
|
|
70
77
|
semi: false,
|
|
71
78
|
plugins: [
|
|
72
|
-
|
|
79
|
+
...prettierConfig.plugins,
|
|
80
|
+
// ...your plugins
|
|
73
81
|
],
|
|
74
|
-
}
|
|
82
|
+
};
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## TypeScript users:
|
|
86
|
+
|
|
87
|
+
This package provides type definitions for the configuration. You can import the `Config` type from Prettier for full type safety in your custom config:
|
|
88
|
+
|
|
89
|
+
```js
|
|
90
|
+
/** @type {import('prettier').Config} */
|
|
91
|
+
export default {
|
|
92
|
+
// ...your config
|
|
93
|
+
};
|
|
75
94
|
```
|
package/dist/index.cjs
CHANGED
|
@@ -1,47 +1 @@
|
|
|
1
|
-
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/index.ts
|
|
21
|
-
var index_exports = {};
|
|
22
|
-
__export(index_exports, {
|
|
23
|
-
defineConfig: () => defineConfig
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(index_exports);
|
|
26
|
-
function defineConfig(config) {
|
|
27
|
-
const { plugins = [], overrides = [], ...customConfig } = config ?? {};
|
|
28
|
-
return {
|
|
29
|
-
printWidth: 100,
|
|
30
|
-
tabWidth: 2,
|
|
31
|
-
useTabs: false,
|
|
32
|
-
endOfLine: "lf",
|
|
33
|
-
trailingComma: "all",
|
|
34
|
-
semi: true,
|
|
35
|
-
singleQuote: true,
|
|
36
|
-
jsxSingleQuote: true,
|
|
37
|
-
bracketSpacing: true,
|
|
38
|
-
arrowParens: "always",
|
|
39
|
-
...customConfig,
|
|
40
|
-
plugins: ["prettier-plugin-packagejson", ...plugins],
|
|
41
|
-
overrides
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
45
|
-
0 && (module.exports = {
|
|
46
|
-
defineConfig
|
|
47
|
-
});
|
|
1
|
+
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let c=require(`prettier-plugin-packagejson`);c=s(c);var l={printWidth:100,tabWidth:2,useTabs:!1,endOfLine:`lf`,trailingComma:`all`,semi:!0,singleQuote:!0,jsxSingleQuote:!0,bracketSpacing:!0,arrowParens:`always`,plugins:[c.default]};module.exports=l;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
//#region src/index.d.ts
|
|
2
|
+
declare const _default: {
|
|
3
|
+
printWidth: number;
|
|
4
|
+
tabWidth: number;
|
|
5
|
+
useTabs: false;
|
|
6
|
+
endOfLine: "lf";
|
|
7
|
+
trailingComma: "all";
|
|
8
|
+
semi: true;
|
|
9
|
+
singleQuote: true;
|
|
10
|
+
jsxSingleQuote: true;
|
|
11
|
+
bracketSpacing: true;
|
|
12
|
+
arrowParens: "always";
|
|
13
|
+
plugins: any[];
|
|
14
|
+
};
|
|
15
|
+
export = _default;
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//#region src/index.d.ts
|
|
2
|
+
declare const _default: {
|
|
3
|
+
printWidth: number;
|
|
4
|
+
tabWidth: number;
|
|
5
|
+
useTabs: false;
|
|
6
|
+
endOfLine: "lf";
|
|
7
|
+
trailingComma: "all";
|
|
8
|
+
semi: true;
|
|
9
|
+
singleQuote: true;
|
|
10
|
+
jsxSingleQuote: true;
|
|
11
|
+
bracketSpacing: true;
|
|
12
|
+
arrowParens: "always";
|
|
13
|
+
plugins: any[];
|
|
14
|
+
};
|
|
15
|
+
//#endregion
|
|
16
|
+
export { _default as default };
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import e from"prettier-plugin-packagejson";var t={printWidth:100,tabWidth:2,useTabs:!1,endOfLine:`lf`,trailingComma:`all`,semi:!0,singleQuote:!0,jsxSingleQuote:!0,bracketSpacing:!0,arrowParens:`always`,plugins:[e]};export{t as default};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@javalce/prettier-config",
|
|
3
|
-
"version": "2.1
|
|
3
|
+
"version": "2.2.1",
|
|
4
4
|
"description": "Javier's Prettier configuration",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"prettier"
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"./package.json": "./package.json",
|
|
21
21
|
".": {
|
|
22
22
|
"import": {
|
|
23
|
-
"types": "./dist/index.d.
|
|
24
|
-
"default": "./dist/index.
|
|
23
|
+
"types": "./dist/index.d.mts",
|
|
24
|
+
"default": "./dist/index.mjs"
|
|
25
25
|
},
|
|
26
26
|
"require": {
|
|
27
27
|
"types": "./dist/index.d.cts",
|
|
@@ -36,19 +36,20 @@
|
|
|
36
36
|
"*": "prettier -w --ignore-unknown"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"prettier-plugin-packagejson": "^2.5.
|
|
39
|
+
"prettier-plugin-packagejson": "^2.5.20"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@arethetypeswrong/cli": "^0.
|
|
43
|
-
"@commitlint/cli": "^
|
|
44
|
-
"@commitlint/config-conventional": "^
|
|
45
|
-
"
|
|
42
|
+
"@arethetypeswrong/cli": "^0.18.2",
|
|
43
|
+
"@commitlint/cli": "^20.3.1",
|
|
44
|
+
"@commitlint/config-conventional": "^20.3.1",
|
|
45
|
+
"@types/node": "^22.19.5",
|
|
46
|
+
"bumpp": "^10.3.2",
|
|
46
47
|
"conventional-changelog-cli": "^5.0.0",
|
|
47
48
|
"husky": "^9.1.7",
|
|
48
|
-
"lint-staged": "^
|
|
49
|
-
"prettier": "^3.4
|
|
50
|
-
"
|
|
51
|
-
"typescript": "^5.
|
|
49
|
+
"lint-staged": "^16.2.7",
|
|
50
|
+
"prettier": "^3.7.4",
|
|
51
|
+
"tsdown": "^0.19.0",
|
|
52
|
+
"typescript": "^5.9.3"
|
|
52
53
|
},
|
|
53
54
|
"peerDependencies": {
|
|
54
55
|
"prettier": ">=3.0.0 <4"
|
|
@@ -62,7 +63,7 @@
|
|
|
62
63
|
"access": "public"
|
|
63
64
|
},
|
|
64
65
|
"scripts": {
|
|
65
|
-
"build": "
|
|
66
|
+
"build": "tsdown",
|
|
66
67
|
"changelog": "conventional-changelog -i CHANGELOG.md -s -t v -p angular && git add CHANGELOG.md",
|
|
67
68
|
"check-exports": "attw --pack .",
|
|
68
69
|
"format": "prettier --write .",
|
package/dist/index.d.ts
DELETED
package/dist/index.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
// src/index.ts
|
|
2
|
-
function defineConfig(config) {
|
|
3
|
-
const { plugins = [], overrides = [], ...customConfig } = config ?? {};
|
|
4
|
-
return {
|
|
5
|
-
printWidth: 100,
|
|
6
|
-
tabWidth: 2,
|
|
7
|
-
useTabs: false,
|
|
8
|
-
endOfLine: "lf",
|
|
9
|
-
trailingComma: "all",
|
|
10
|
-
semi: true,
|
|
11
|
-
singleQuote: true,
|
|
12
|
-
jsxSingleQuote: true,
|
|
13
|
-
bracketSpacing: true,
|
|
14
|
-
arrowParens: "always",
|
|
15
|
-
...customConfig,
|
|
16
|
-
plugins: ["prettier-plugin-packagejson", ...plugins],
|
|
17
|
-
overrides
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
export {
|
|
21
|
-
defineConfig
|
|
22
|
-
};
|