@abinnovision/prettier-config 2.1.5 → 2.2.0-beta.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 +18 -14
- package/dist/_virtual/_rolldown/runtime.cjs +23 -0
- package/dist/bin/sync-editorconfig.cjs +14 -38
- package/dist/bin/sync-editorconfig.d.cts +1 -0
- package/dist/bin/sync-editorconfig.d.mts +1 -0
- package/dist/bin/sync-editorconfig.mjs +12 -0
- package/dist/index.cjs +20 -0
- package/dist/index.d.cts +5 -0
- package/dist/index.d.mts +6 -0
- package/dist/index.mjs +20 -0
- package/package.json +26 -13
- package/dist/index.d.ts +0 -5
- package/dist/index.js +0 -35
package/README.md
CHANGED
|
@@ -1,37 +1,41 @@
|
|
|
1
1
|
# @abinnovision/prettier-config
|
|
2
2
|
|
|
3
|
-
Prettier config
|
|
4
|
-
default Prettier config. This additionally comes with a `.editorconfig`, which
|
|
5
|
-
is compatible with most editors.
|
|
3
|
+
Shared Prettier config with an opinionated `.editorconfig`.
|
|
6
4
|
|
|
7
5
|
## Installation
|
|
8
6
|
|
|
9
7
|
```shell
|
|
10
|
-
yarn add --dev @abinnovision/prettier-config
|
|
8
|
+
yarn add --dev @abinnovision/prettier-config prettier
|
|
11
9
|
```
|
|
12
10
|
|
|
13
|
-
##
|
|
11
|
+
## Usage
|
|
14
12
|
|
|
15
|
-
|
|
16
|
-
`.editorconfig`. It defines various code style options for the project. This
|
|
17
|
-
packages comes with an opinionated version of this file.
|
|
13
|
+
Reference the config in your `package.json`:
|
|
18
14
|
|
|
19
|
-
|
|
15
|
+
```json
|
|
16
|
+
{
|
|
17
|
+
"prettier": "@abinnovision/prettier-config"
|
|
18
|
+
}
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## EditorConfig
|
|
22
|
+
|
|
23
|
+
Sync the bundled `.editorconfig` into your project:
|
|
20
24
|
|
|
21
25
|
```shell
|
|
22
26
|
yarn sync-editorconfig
|
|
23
27
|
```
|
|
24
28
|
|
|
25
|
-
Optionally
|
|
26
|
-
with the one defined in this project.
|
|
29
|
+
Optionally add it to your `postinstall` hook to keep it in sync automatically:
|
|
27
30
|
|
|
28
31
|
```json5
|
|
29
32
|
{
|
|
30
|
-
// ...
|
|
31
33
|
scripts: {
|
|
32
|
-
// ...
|
|
33
34
|
postinstall: "sync-editorconfig",
|
|
34
35
|
},
|
|
35
|
-
// ...
|
|
36
36
|
}
|
|
37
37
|
```
|
|
38
|
+
|
|
39
|
+
## License
|
|
40
|
+
|
|
41
|
+
Apache-2.0
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
10
|
+
key = keys[i];
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
12
|
+
get: ((k) => from[k]).bind(null, key),
|
|
13
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
19
|
+
value: mod,
|
|
20
|
+
enumerable: true
|
|
21
|
+
}) : target, mod));
|
|
22
|
+
//#endregion
|
|
23
|
+
exports.__toESM = __toESM;
|
|
@@ -1,39 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
};
|
|
17
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
18
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
19
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
20
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
21
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
22
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
23
|
-
mod
|
|
24
|
-
));
|
|
25
|
-
|
|
26
|
-
// src/bin/sync-editorconfig.ts
|
|
27
|
-
var fs = __toESM(require("fs/promises"), 1);
|
|
28
|
-
var path = __toESM(require("path"), 1);
|
|
29
|
-
var process = __toESM(require("process"), 1);
|
|
30
|
-
var DISABLE_ENV_VAR = "DISABLE_SYNC_EDITORCONFIG";
|
|
31
|
-
void async function() {
|
|
32
|
-
if ([true, "true"].includes(process.env[DISABLE_ENV_VAR] ?? false)) {
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
await fs.copyFile(
|
|
36
|
-
path.resolve(__dirname, "../../assets/.editorconfig"),
|
|
37
|
-
path.resolve(process.cwd(), ".editorconfig")
|
|
38
|
-
);
|
|
39
|
-
}();
|
|
2
|
+
const require_runtime = require("../_virtual/_rolldown/runtime.cjs");
|
|
3
|
+
let fs_promises = require("fs/promises");
|
|
4
|
+
fs_promises = require_runtime.__toESM(fs_promises);
|
|
5
|
+
let path = require("path");
|
|
6
|
+
path = require_runtime.__toESM(path);
|
|
7
|
+
let process = require("process");
|
|
8
|
+
process = require_runtime.__toESM(process);
|
|
9
|
+
//#region src/bin/sync-editorconfig.ts
|
|
10
|
+
const DISABLE_ENV_VAR = "DISABLE_SYNC_EDITORCONFIG";
|
|
11
|
+
(async function() {
|
|
12
|
+
if ([true, "true"].includes(process.env[DISABLE_ENV_VAR] ?? false)) return;
|
|
13
|
+
await fs_promises.copyFile(path.resolve(__dirname, "../../assets/.editorconfig"), path.resolve(process.cwd(), ".editorconfig"));
|
|
14
|
+
})();
|
|
15
|
+
//#endregion
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import * as fs from "fs/promises";
|
|
3
|
+
import * as path from "path";
|
|
4
|
+
import * as process from "process";
|
|
5
|
+
//#region src/bin/sync-editorconfig.ts
|
|
6
|
+
const DISABLE_ENV_VAR = "DISABLE_SYNC_EDITORCONFIG";
|
|
7
|
+
(async function() {
|
|
8
|
+
if ([true, "true"].includes(process.env[DISABLE_ENV_VAR] ?? false)) return;
|
|
9
|
+
await fs.copyFile(path.resolve(__dirname, "../../assets/.editorconfig"), path.resolve(process.cwd(), ".editorconfig"));
|
|
10
|
+
})();
|
|
11
|
+
//#endregion
|
|
12
|
+
export {};
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
//#region src/index.ts
|
|
2
|
+
const config = {
|
|
3
|
+
printWidth: 80,
|
|
4
|
+
useTabs: true,
|
|
5
|
+
tabWidth: 2,
|
|
6
|
+
semi: true,
|
|
7
|
+
trailingComma: "all",
|
|
8
|
+
bracketSpacing: true,
|
|
9
|
+
arrowParens: "always",
|
|
10
|
+
endOfLine: "lf",
|
|
11
|
+
overrides: [{
|
|
12
|
+
files: ["pnpm-lock.yaml"],
|
|
13
|
+
options: { requirePragma: true }
|
|
14
|
+
}, {
|
|
15
|
+
files: ["*.md"],
|
|
16
|
+
options: { useTabs: false }
|
|
17
|
+
}]
|
|
18
|
+
};
|
|
19
|
+
//#endregion
|
|
20
|
+
module.exports = config;
|
package/dist/index.d.cts
ADDED
package/dist/index.d.mts
ADDED
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
//#region src/index.ts
|
|
2
|
+
const config = {
|
|
3
|
+
printWidth: 80,
|
|
4
|
+
useTabs: true,
|
|
5
|
+
tabWidth: 2,
|
|
6
|
+
semi: true,
|
|
7
|
+
trailingComma: "all",
|
|
8
|
+
bracketSpacing: true,
|
|
9
|
+
arrowParens: "always",
|
|
10
|
+
endOfLine: "lf",
|
|
11
|
+
overrides: [{
|
|
12
|
+
files: ["pnpm-lock.yaml"],
|
|
13
|
+
options: { requirePragma: true }
|
|
14
|
+
}, {
|
|
15
|
+
files: ["*.md"],
|
|
16
|
+
options: { useTabs: false }
|
|
17
|
+
}]
|
|
18
|
+
};
|
|
19
|
+
//#endregion
|
|
20
|
+
export { config as default };
|
package/package.json
CHANGED
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abinnovision/prettier-config",
|
|
3
|
-
"version": "2.1
|
|
4
|
-
"publishConfig": {
|
|
5
|
-
"npm": true,
|
|
6
|
-
"ghpr": true,
|
|
7
|
-
"npmAccess": "public"
|
|
8
|
-
},
|
|
9
|
-
"type": "module",
|
|
3
|
+
"version": "2.2.0-beta.1",
|
|
10
4
|
"repository": {
|
|
11
5
|
"url": "https://github.com/abinnovision/js-commons"
|
|
12
6
|
},
|
|
@@ -16,8 +10,21 @@
|
|
|
16
10
|
"email": "info@abigroup.io",
|
|
17
11
|
"url": "https://abigroup.io/"
|
|
18
12
|
},
|
|
19
|
-
"
|
|
20
|
-
"
|
|
13
|
+
"type": "module",
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"import": {
|
|
17
|
+
"types": "./dist/index.d.mts",
|
|
18
|
+
"default": "./dist/index.mjs"
|
|
19
|
+
},
|
|
20
|
+
"require": {
|
|
21
|
+
"types": "./dist/index.d.cts",
|
|
22
|
+
"default": "./dist/index.cjs"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"main": "./dist/index.cjs",
|
|
27
|
+
"types": "./dist/index.d.cts",
|
|
21
28
|
"bin": {
|
|
22
29
|
"sync-editorconfig": "./dist/bin/sync-editorconfig.cjs"
|
|
23
30
|
},
|
|
@@ -26,7 +33,7 @@
|
|
|
26
33
|
"assets/"
|
|
27
34
|
],
|
|
28
35
|
"scripts": {
|
|
29
|
-
"build": "
|
|
36
|
+
"build": "tsdown",
|
|
30
37
|
"format:check": "prettier --check 'src/**/*.{ts,js}' '**/*.{md,json,json5,yaml,yml}'",
|
|
31
38
|
"format:fix": "prettier --write 'src/**/*.{ts,js}' '**/*.{md,json,json5,yaml,yml}'",
|
|
32
39
|
"lint:check": "eslint 'src/**/*.{ts,js}'",
|
|
@@ -41,16 +48,22 @@
|
|
|
41
48
|
"prettier --write"
|
|
42
49
|
]
|
|
43
50
|
},
|
|
44
|
-
"prettier": "./dist/index.
|
|
51
|
+
"prettier": "./dist/index.mjs",
|
|
45
52
|
"devDependencies": {
|
|
53
|
+
"@internal/tsconfig": "^1.0.0",
|
|
46
54
|
"@types/node": "^22.12.0",
|
|
47
55
|
"@types/prettier": "^3.0.0",
|
|
48
|
-
"eslint": "^
|
|
56
|
+
"eslint": "^10.0.0",
|
|
49
57
|
"prettier": "^3.4.2",
|
|
50
|
-
"
|
|
58
|
+
"tsdown": "^0.21.3",
|
|
51
59
|
"typescript": "^5.9.3"
|
|
52
60
|
},
|
|
53
61
|
"peerDependencies": {
|
|
54
62
|
"prettier": "^2.4.0 || ^3.0.0"
|
|
63
|
+
},
|
|
64
|
+
"publishConfig": {
|
|
65
|
+
"ghpr": true,
|
|
66
|
+
"npm": true,
|
|
67
|
+
"npmAccess": "public"
|
|
55
68
|
}
|
|
56
69
|
}
|
package/dist/index.d.ts
DELETED
package/dist/index.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
// src/index.ts
|
|
2
|
-
var config = {
|
|
3
|
-
printWidth: 80,
|
|
4
|
-
useTabs: true,
|
|
5
|
-
tabWidth: 2,
|
|
6
|
-
semi: true,
|
|
7
|
-
trailingComma: "all",
|
|
8
|
-
bracketSpacing: true,
|
|
9
|
-
arrowParens: "always",
|
|
10
|
-
endOfLine: "lf",
|
|
11
|
-
overrides: [
|
|
12
|
-
{
|
|
13
|
-
files: ["pnpm-lock.yaml"],
|
|
14
|
-
options: {
|
|
15
|
-
requirePragma: true
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
/**
|
|
20
|
-
* Use spaces for Markdown files instead of tabs.
|
|
21
|
-
*
|
|
22
|
-
* This is because Markdown files rendered with tabs in GitHub use pretty
|
|
23
|
-
* large indentation, which is not ideal.
|
|
24
|
-
*/
|
|
25
|
-
files: ["*.md"],
|
|
26
|
-
options: {
|
|
27
|
-
useTabs: false
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
]
|
|
31
|
-
};
|
|
32
|
-
var src_default = config;
|
|
33
|
-
export {
|
|
34
|
-
src_default as default
|
|
35
|
-
};
|