@bfra.me/prettier-config 0.7.4 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/120-proof.js +6 -10
- package/lib/index.d.ts +32 -0
- package/lib/index.js +8 -0
- package/lib/prettier.config.js +3 -3
- package/package.json +13 -14
- package/src/120-proof.ts +11 -12
- package/src/index.ts +5 -0
- package/src/prettier.config.ts +22 -7
- package/lib/120-proof.d.ts +0 -12
- package/lib/plugins.d.ts +0 -5
- package/lib/prettier.config.d.ts +0 -8
package/lib/120-proof.js
CHANGED
@@ -1,14 +1,10 @@
|
|
1
|
-
import
|
2
|
-
const
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
import defaultConfig from "./prettier.config.js";
|
2
|
+
const $120ProofConfig = {
|
3
|
+
...defaultConfig,
|
4
|
+
printWidth: 120,
|
5
|
+
semi: new URL(import.meta.url).searchParams.has("semi", "true") || defaultConfig.semi
|
6
6
|
};
|
7
|
-
|
8
|
-
...prettierConfig,
|
9
|
-
...preset
|
10
|
-
};
|
11
|
-
var proof_default = config;
|
7
|
+
var proof_default = $120ProofConfig;
|
12
8
|
export {
|
13
9
|
proof_default as default
|
14
10
|
};
|
package/lib/index.d.ts
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
import { Config } from 'prettier';
|
2
|
+
|
3
|
+
type RequiredConfig = Required<Config>;
|
4
|
+
/**
|
5
|
+
* Shared Prettier configuration for bfra.me projects.
|
6
|
+
*/
|
7
|
+
interface DefaultConfig extends Config {
|
8
|
+
/** @default avoid */
|
9
|
+
arrowParens: 'avoid' | RequiredConfig['arrowParens'];
|
10
|
+
/** @default false */
|
11
|
+
bracketSpacing: false | boolean;
|
12
|
+
/** @default auto */
|
13
|
+
endOfLine: 'auto' | RequiredConfig['endOfLine'];
|
14
|
+
/** @default 100 */
|
15
|
+
printWidth: 100 | number;
|
16
|
+
/** @default false */
|
17
|
+
semi: false | boolean;
|
18
|
+
/** @default true */
|
19
|
+
singleQuote: true | boolean;
|
20
|
+
}
|
21
|
+
declare const config: DefaultConfig;
|
22
|
+
|
23
|
+
/**
|
24
|
+
* Shared Prettier configuration for bfra.me projects with `printWidth` set to 120 characters.
|
25
|
+
*/
|
26
|
+
interface $120ProofConfig extends DefaultConfig {
|
27
|
+
/** @default 120 */
|
28
|
+
printWidth: 120 | DefaultConfig['printWidth'];
|
29
|
+
}
|
30
|
+
declare const $120ProofConfig: $120ProofConfig;
|
31
|
+
|
32
|
+
export { $120ProofConfig, type DefaultConfig, config as default };
|
package/lib/index.js
ADDED
package/lib/prettier.config.js
CHANGED
@@ -1,14 +1,14 @@
|
|
1
|
+
import { createRequire } from "node:module";
|
1
2
|
import { resolve } from "./plugins.js";
|
2
|
-
import { createRequire } from "module";
|
3
3
|
const require2 = createRequire(import.meta.url);
|
4
4
|
const resolvePlugin = resolve.bind(null, require2.resolve);
|
5
|
-
const { searchParams
|
5
|
+
const { searchParams } = new URL(import.meta.url);
|
6
6
|
const config = {
|
7
7
|
arrowParens: "avoid",
|
8
8
|
bracketSpacing: false,
|
9
9
|
endOfLine: "auto",
|
10
10
|
printWidth: 100,
|
11
|
-
semi:
|
11
|
+
semi: searchParams.has("semi", "true"),
|
12
12
|
singleQuote: true,
|
13
13
|
overrides: [
|
14
14
|
// Adapted from https://github.com/sxzz/prettier-config/blob/1e5cc3021e5816aceebe0b90af1d530239442ecf/index.js.
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@bfra.me/prettier-config",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.8.0",
|
4
4
|
"description": "Shared Prettier configuration for bfra.me",
|
5
5
|
"keywords": [
|
6
6
|
"bfra.me",
|
@@ -14,7 +14,7 @@
|
|
14
14
|
"bugs": "https://github.com/bfra-me/works/issues",
|
15
15
|
"repository": {
|
16
16
|
"type": "git",
|
17
|
-
"url": "https://github.com/bfra-me/works.git",
|
17
|
+
"url": "git+https://github.com/bfra-me/works.git",
|
18
18
|
"directory": "packages/prettier-config"
|
19
19
|
},
|
20
20
|
"license": "MIT",
|
@@ -22,8 +22,8 @@
|
|
22
22
|
"type": "module",
|
23
23
|
"exports": {
|
24
24
|
".": {
|
25
|
-
"types": "./lib/
|
26
|
-
"import": "./lib/
|
25
|
+
"types": "./lib/index.d.ts",
|
26
|
+
"import": "./lib/index.js"
|
27
27
|
},
|
28
28
|
"./100-proof": "./lib/prettier.config.js",
|
29
29
|
"./120-proof": "./lib/120-proof.js",
|
@@ -32,27 +32,26 @@
|
|
32
32
|
"./*/semi": "./lib/*.js?semi=true",
|
33
33
|
"./package.json": "./package.json"
|
34
34
|
},
|
35
|
-
"main": "./lib/
|
36
|
-
"types": "./lib/
|
35
|
+
"main": "./lib/index.js",
|
36
|
+
"types": "./lib/index.d.ts",
|
37
37
|
"files": [
|
38
38
|
"lib",
|
39
39
|
"src",
|
40
|
-
"!**/*.map"
|
41
|
-
"!tsup.config.ts"
|
40
|
+
"!**/*.map"
|
42
41
|
],
|
43
42
|
"dependencies": {
|
44
|
-
"@bfra.me/prettier-plugins": "0.
|
43
|
+
"@bfra.me/prettier-plugins": "0.5.0"
|
45
44
|
},
|
46
45
|
"devDependencies": {
|
47
46
|
"@types/fs-extra": "11.0.4",
|
48
|
-
"execa": "9.
|
47
|
+
"execa": "9.5.0",
|
49
48
|
"fast-glob": "3.3.2",
|
50
49
|
"fs-extra": "11.2.0",
|
51
50
|
"prettier": "3.3.3",
|
52
|
-
"tsup": "8.3.
|
53
|
-
"vitest": "2.1.
|
54
|
-
"@bfra.me/
|
55
|
-
"@bfra.me/
|
51
|
+
"tsup": "8.3.5",
|
52
|
+
"vitest": "2.1.3",
|
53
|
+
"@bfra.me/prettier-config": "0.8.0",
|
54
|
+
"@bfra.me/tsconfig": "0.9.0"
|
56
55
|
},
|
57
56
|
"peerDependencies": {
|
58
57
|
"prettier": "^3.0.0"
|
package/src/120-proof.ts
CHANGED
@@ -1,18 +1,17 @@
|
|
1
|
-
import
|
2
|
-
import type {Config} from 'prettier'
|
3
|
-
|
4
|
-
const {searchParams: params} = new URL(import.meta.url)
|
5
|
-
const preset = {
|
6
|
-
semi: params.has('semi') || prettierConfig.semi || false,
|
7
|
-
printWidth: 120,
|
8
|
-
} as const satisfies Pick<Config, 'printWidth' | 'semi'>
|
1
|
+
import defaultConfig, {type DefaultConfig} from './prettier.config.js'
|
9
2
|
|
10
3
|
/**
|
11
4
|
* Shared Prettier configuration for bfra.me projects with `printWidth` set to 120 characters.
|
12
5
|
*/
|
13
|
-
|
14
|
-
|
15
|
-
|
6
|
+
export interface $120ProofConfig extends DefaultConfig {
|
7
|
+
/** @default 120 */
|
8
|
+
printWidth: 120 | DefaultConfig['printWidth']
|
16
9
|
}
|
17
10
|
|
18
|
-
|
11
|
+
const $120ProofConfig = {
|
12
|
+
...defaultConfig,
|
13
|
+
printWidth: 120,
|
14
|
+
semi: new URL(import.meta.url).searchParams.has('semi', 'true') || defaultConfig.semi,
|
15
|
+
} as $120ProofConfig
|
16
|
+
|
17
|
+
export default $120ProofConfig
|
package/src/index.ts
ADDED
package/src/prettier.config.ts
CHANGED
@@ -1,22 +1,37 @@
|
|
1
|
-
import {
|
1
|
+
import {createRequire} from 'node:module'
|
2
2
|
import type {Config} from 'prettier'
|
3
|
-
|
4
|
-
import {createRequire} from 'module'
|
3
|
+
import {resolve} from './plugins.js'
|
5
4
|
|
6
5
|
const require = createRequire(import.meta.url)
|
7
6
|
const resolvePlugin = resolve.bind(null, require.resolve)
|
7
|
+
const {searchParams} = new URL(import.meta.url)
|
8
8
|
|
9
|
-
|
9
|
+
type RequiredConfig = Required<Config>
|
10
10
|
|
11
11
|
/**
|
12
12
|
* Shared Prettier configuration for bfra.me projects.
|
13
13
|
*/
|
14
|
-
|
14
|
+
export interface DefaultConfig extends Config {
|
15
|
+
/** @default avoid */
|
16
|
+
arrowParens: 'avoid' | RequiredConfig['arrowParens']
|
17
|
+
/** @default false */
|
18
|
+
bracketSpacing: false | boolean
|
19
|
+
/** @default auto */
|
20
|
+
endOfLine: 'auto' | RequiredConfig['endOfLine']
|
21
|
+
/** @default 100 */
|
22
|
+
printWidth: 100 | number
|
23
|
+
/** @default false */
|
24
|
+
semi: false | boolean
|
25
|
+
/** @default true */
|
26
|
+
singleQuote: true | boolean
|
27
|
+
}
|
28
|
+
|
29
|
+
const config = {
|
15
30
|
arrowParens: 'avoid',
|
16
31
|
bracketSpacing: false,
|
17
32
|
endOfLine: 'auto',
|
18
33
|
printWidth: 100,
|
19
|
-
semi:
|
34
|
+
semi: searchParams.has('semi', 'true'),
|
20
35
|
singleQuote: true,
|
21
36
|
|
22
37
|
overrides: [
|
@@ -81,6 +96,6 @@ const config: Config = {
|
|
81
96
|
],
|
82
97
|
|
83
98
|
plugins: ['@bfra.me/prettier-plugins/package-json'].map(resolvePlugin),
|
84
|
-
}
|
99
|
+
} as DefaultConfig
|
85
100
|
|
86
101
|
export default config
|
package/lib/120-proof.d.ts
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
import { Config } from 'prettier';
|
2
|
-
|
3
|
-
declare const preset: {
|
4
|
-
readonly semi: boolean;
|
5
|
-
readonly printWidth: 120;
|
6
|
-
};
|
7
|
-
/**
|
8
|
-
* Shared Prettier configuration for bfra.me projects with `printWidth` set to 120 characters.
|
9
|
-
*/
|
10
|
-
declare const config: Config & typeof preset;
|
11
|
-
|
12
|
-
export { config as default };
|
package/lib/plugins.d.ts
DELETED