@bfra.me/prettier-config 0.6.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
package/120-proof.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import {Config} from 'prettier'
2
2
 
3
3
  declare const preset: {
4
+ readonly semi: boolean
4
5
  readonly printWidth: 120
5
6
  }
6
7
  /**
package/120-proof.js CHANGED
@@ -1,5 +1,7 @@
1
1
  import prettierConfig from '@bfra.me/prettier-config'
2
+ const {searchParams: params} = new URL(import.meta.url)
2
3
  const preset = {
4
+ semi: params.has('semi') || prettierConfig.semi || false,
3
5
  printWidth: 120,
4
6
  }
5
7
  const config = {
package/120-proof.ts CHANGED
@@ -1,7 +1,11 @@
1
1
  import prettierConfig from '@bfra.me/prettier-config'
2
2
  import type {Config} from 'prettier'
3
3
 
4
- const preset = {printWidth: 120} as const
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'>
5
9
 
6
10
  /**
7
11
  * Shared Prettier configuration for bfra.me projects with `printWidth` set to 120 characters.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bfra.me/prettier-config",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "Shared Prettier configuration for bfra.me",
5
5
  "keywords": [
6
6
  "bfra.me",
@@ -27,6 +27,9 @@
27
27
  },
28
28
  "./100-proof": "./prettier.config.js",
29
29
  "./120-proof": "./120-proof.js",
30
+ "./semi/*": "./*.js?semi=true",
31
+ "./semi": "./prettier.config.js?semi=true",
32
+ "./*/semi": "./*.js?semi=true",
30
33
  "./package.json": "./package.json"
31
34
  },
32
35
  "main": "prettier.config.js",
@@ -48,7 +51,7 @@
48
51
  "tsup": "8.2.0",
49
52
  "vitest": "2.0.2",
50
53
  "@bfra.me/tsconfig": "0.6.0",
51
- "@bfra.me/prettier-config": "0.6.0"
54
+ "@bfra.me/prettier-config": "0.7.0"
52
55
  },
53
56
  "peerDependencies": {
54
57
  "prettier": "^3.0.0"
@@ -2,12 +2,13 @@ import {resolve} from './plugins.js'
2
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: params} = new URL(import.meta.url)
5
6
  const config = {
6
7
  arrowParens: 'avoid',
7
8
  bracketSpacing: false,
8
9
  endOfLine: 'auto',
9
10
  printWidth: 100,
10
- semi: false,
11
+ semi: params.has('semi', 'true'),
11
12
  singleQuote: true,
12
13
  overrides: [
13
14
  // Adapted from https://github.com/sxzz/prettier-config/blob/1e5cc3021e5816aceebe0b90af1d530239442ecf/index.js.
@@ -6,6 +6,8 @@ import {createRequire} from 'module'
6
6
  const require = createRequire(import.meta.url)
7
7
  const resolvePlugin = resolve.bind(null, require.resolve)
8
8
 
9
+ const {searchParams: params} = new URL(import.meta.url)
10
+
9
11
  /**
10
12
  * Shared Prettier configuration for bfra.me projects.
11
13
  */
@@ -14,7 +16,7 @@ const config: Config = {
14
16
  bracketSpacing: false,
15
17
  endOfLine: 'auto',
16
18
  printWidth: 100,
17
- semi: false,
19
+ semi: params.has('semi', 'true'),
18
20
  singleQuote: true,
19
21
 
20
22
  overrides: [