@bfra.me/prettier-config 0.7.2 → 0.7.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,12 @@
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 };
@@ -0,0 +1,15 @@
1
+ import prettierConfig from "./prettier.config.js";
2
+ const { searchParams: params } = new URL(import.meta.url);
3
+ const preset = {
4
+ semi: params.has("semi") || prettierConfig.semi || false,
5
+ printWidth: 120
6
+ };
7
+ const config = {
8
+ ...prettierConfig,
9
+ ...preset
10
+ };
11
+ var proof_default = config;
12
+ export {
13
+ proof_default as default
14
+ };
15
+ //# sourceMappingURL=120-proof.js.map
@@ -0,0 +1,5 @@
1
+ import { Plugin } from 'prettier';
2
+
3
+ declare const resolve: (resolver: (id: string) => string, plugin: string) => string | Plugin;
4
+
5
+ export { resolve };
package/lib/plugins.js ADDED
@@ -0,0 +1,20 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+ import * as PluginPackageJson from "@bfra.me/prettier-plugins/package-json";
4
+ const resolvedPlugins = {
5
+ "@bfra.me/prettier-plugins/package-json": PluginPackageJson
6
+ };
7
+ const resolve = /* @__PURE__ */ __name((resolver, plugin) => {
8
+ try {
9
+ if (resolvedPlugins[plugin]) {
10
+ return resolvedPlugins[plugin];
11
+ }
12
+ return resolver(plugin);
13
+ } finally {
14
+ return plugin;
15
+ }
16
+ }, "resolve");
17
+ export {
18
+ resolve
19
+ };
20
+ //# sourceMappingURL=plugins.js.map
@@ -0,0 +1,8 @@
1
+ import { Config } from 'prettier';
2
+
3
+ /**
4
+ * Shared Prettier configuration for bfra.me projects.
5
+ */
6
+ declare const config: Config;
7
+
8
+ export { config as default };
@@ -0,0 +1,84 @@
1
+ import { resolve } from "./plugins.js";
2
+ import { createRequire } from "module";
3
+ const require2 = createRequire(import.meta.url);
4
+ const resolvePlugin = resolve.bind(null, require2.resolve);
5
+ const { searchParams: params } = new URL(import.meta.url);
6
+ const config = {
7
+ arrowParens: "avoid",
8
+ bracketSpacing: false,
9
+ endOfLine: "auto",
10
+ printWidth: 100,
11
+ semi: params.has("semi", "true"),
12
+ singleQuote: true,
13
+ overrides: [
14
+ // Adapted from https://github.com/sxzz/prettier-config/blob/1e5cc3021e5816aceebe0b90af1d530239442ecf/index.js.
15
+ // Require a pragma for paths typically not under version control or written by build tools.
16
+ {
17
+ files: [
18
+ "**/node_modules/**",
19
+ "**/dist/**",
20
+ "**/lib/**",
21
+ "**/coverage/**",
22
+ "**/out/**",
23
+ "**/temp/**",
24
+ "**/.idea/**",
25
+ "**/.next/**",
26
+ "**/.nuxt/**",
27
+ "**/.output/**",
28
+ "**/.tsup/**",
29
+ "**/.vercel/**",
30
+ "**/.vitepress/cache/**",
31
+ "**/.vite-inspect/**",
32
+ "**/__snapshots__/**",
33
+ "**/test/fixtures/**",
34
+ "**/auto-import?(s).d.ts",
35
+ "**/.changeset/*.md",
36
+ "**/CHANGELOG*.md",
37
+ "**/changelog*.md",
38
+ "**/components.d.ts",
39
+ "**/devcontainer-lock.json",
40
+ "**/LICENSE*",
41
+ "**/license*",
42
+ "**/*.min.*",
43
+ "**/package-lock.json",
44
+ "**/pnpm-lock.yaml",
45
+ "**/typed-router.d.ts",
46
+ "**/yarn.lock"
47
+ ],
48
+ options: {
49
+ requirePragma: true
50
+ }
51
+ },
52
+ // VS Code configuration files:
53
+ // Use 4 spaces for indentation to match the default VS Code settings.
54
+ {
55
+ files: [
56
+ ".vscode/*.json",
57
+ ".devcontainer/**/devcontainer*.json"
58
+ ],
59
+ options: {
60
+ tabWidth: 4
61
+ }
62
+ },
63
+ // Markdown:
64
+ // - Disable single quotes for Markdown files.
65
+ // - Disable `proseWrap` to avoid wrapping prose.
66
+ {
67
+ files: [
68
+ "*.md"
69
+ ],
70
+ options: {
71
+ proseWrap: "never",
72
+ singleQuote: false
73
+ }
74
+ }
75
+ ],
76
+ plugins: [
77
+ "@bfra.me/prettier-plugins/package-json"
78
+ ].map(resolvePlugin)
79
+ };
80
+ var prettier_config_default = config;
81
+ export {
82
+ prettier_config_default as default
83
+ };
84
+ //# sourceMappingURL=prettier.config.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bfra.me/prettier-config",
3
- "version": "0.7.2",
3
+ "version": "0.7.3",
4
4
  "description": "Shared Prettier configuration for bfra.me",
5
5
  "keywords": [
6
6
  "bfra.me",
@@ -22,26 +22,26 @@
22
22
  "type": "module",
23
23
  "exports": {
24
24
  ".": {
25
- "types": "./prettier.config.d.ts",
26
- "import": "./prettier.config.js"
25
+ "types": "./lib/prettier.config.d.ts",
26
+ "import": "./lib/prettier.config.js"
27
27
  },
28
- "./100-proof": "./prettier.config.js",
29
- "./120-proof": "./120-proof.js",
30
- "./semi/*": "./*.js?semi=true",
31
- "./semi": "./prettier.config.js?semi=true",
32
- "./*/semi": "./*.js?semi=true",
28
+ "./100-proof": "./lib/prettier.config.js",
29
+ "./120-proof": "./lib/120-proof.js",
30
+ "./semi/*": "./lib/*.js?semi=true",
31
+ "./semi": "./lib/prettier.config.js?semi=true",
32
+ "./*/semi": "./lib/*.js?semi=true",
33
33
  "./package.json": "./package.json"
34
34
  },
35
- "main": "prettier.config.js",
36
- "types": "prettier.config.d.ts",
35
+ "main": "./lib/prettier.config.js",
36
+ "types": "./lib/prettier.config.d.ts",
37
37
  "files": [
38
- "*.js",
39
- "*.ts",
38
+ "lib",
39
+ "src",
40
40
  "!**/*.map",
41
41
  "!tsup.config.ts"
42
42
  ],
43
43
  "dependencies": {
44
- "@bfra.me/prettier-plugins": "0.3.1"
44
+ "@bfra.me/prettier-plugins": "0.4.0"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@types/fs-extra": "11.0.4",
@@ -51,8 +51,8 @@
51
51
  "prettier": "3.3.3",
52
52
  "tsup": "8.3.0",
53
53
  "vitest": "2.1.0",
54
- "@bfra.me/prettier-config": "0.7.2",
55
- "@bfra.me/tsconfig": "0.8.0"
54
+ "@bfra.me/prettier-config": "0.7.3",
55
+ "@bfra.me/tsconfig": "0.8.1"
56
56
  },
57
57
  "peerDependencies": {
58
58
  "prettier": "^3.0.0"
@@ -62,8 +62,7 @@
62
62
  "provenance": true
63
63
  },
64
64
  "scripts": {
65
- "build": "tsup && pnpm run format",
66
- "format": "prettier --ignore-path .prettierignore --log-level log --write .",
65
+ "build": "tsup",
67
66
  "test": "vitest"
68
67
  }
69
68
  }
@@ -1,4 +1,4 @@
1
- import prettierConfig from '@bfra.me/prettier-config'
1
+ import prettierConfig from './prettier.config.js'
2
2
  import type {Config} from 'prettier'
3
3
 
4
4
  const {searchParams: params} = new URL(import.meta.url)
package/src/plugins.ts ADDED
@@ -0,0 +1,17 @@
1
+ import type {Plugin} from 'prettier'
2
+ import * as PluginPackageJson from '@bfra.me/prettier-plugins/package-json'
3
+
4
+ const resolvedPlugins: Record<string, Plugin> = {
5
+ '@bfra.me/prettier-plugins/package-json': PluginPackageJson,
6
+ }
7
+
8
+ export const resolve = (resolver: (id: string) => string, plugin: string): string | Plugin => {
9
+ try {
10
+ if (resolvedPlugins[plugin]) {
11
+ return resolvedPlugins[plugin]
12
+ }
13
+ return resolver(plugin)
14
+ } finally {
15
+ return plugin
16
+ }
17
+ }
@@ -34,6 +34,7 @@ const config: Config = {
34
34
  '**/.next/**',
35
35
  '**/.nuxt/**',
36
36
  '**/.output/**',
37
+ '**/.tsup/**',
37
38
  '**/.vercel/**',
38
39
  '**/.vitepress/cache/**',
39
40
  '**/.vite-inspect/**',
package/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/120-proof.js DELETED
@@ -1,13 +0,0 @@
1
- import prettierConfig from '@bfra.me/prettier-config'
2
- const {searchParams: params} = new URL(import.meta.url)
3
- const preset = {
4
- semi: params.has('semi') || prettierConfig.semi || false,
5
- printWidth: 120,
6
- }
7
- const config = {
8
- ...prettierConfig,
9
- ...preset,
10
- }
11
- var proof_default = config
12
- export {proof_default as default}
13
- //# sourceMappingURL=120-proof.js.map
package/plugins.d.ts DELETED
@@ -1,13 +0,0 @@
1
- import {Plugin} from 'prettier'
2
-
3
- type InteropDefault<T> = T extends {
4
- default: infer U
5
- }
6
- ? U
7
- : T
8
- declare const resolve: <T extends Plugin>(
9
- resolver: (id: string) => string,
10
- plugin: string,
11
- ) => string | T
12
-
13
- export {type InteropDefault, resolve}
package/plugins.js DELETED
@@ -1,22 +0,0 @@
1
- var __defProp = Object.defineProperty
2
- var __name = (target, value) => __defProp(target, 'name', {value, configurable: true})
3
- function interopDefault(m) {
4
- return m.default || m
5
- }
6
- __name(interopDefault, 'interopDefault')
7
- import {default as pluginPackageJson} from '@bfra.me/prettier-plugins/package-json'
8
- const resolvedPlugins = {
9
- '@bfra.me/prettier-plugins/package-json': interopDefault(pluginPackageJson),
10
- }
11
- const resolve = /* @__PURE__ */ __name((resolver, plugin) => {
12
- try {
13
- if (resolvedPlugins[plugin]) {
14
- return resolvedPlugins[plugin]
15
- }
16
- return resolver(plugin)
17
- } finally {
18
- return plugin
19
- }
20
- }, 'resolve')
21
- export {resolve}
22
- //# sourceMappingURL=plugins.js.map
package/plugins.ts DELETED
@@ -1,26 +0,0 @@
1
- import type {Plugin} from 'prettier'
2
-
3
- export type InteropDefault<T> = T extends {default: infer U} ? U : T
4
-
5
- function interopDefault<T>(m: T): InteropDefault<T> {
6
- return (m as any).default || m
7
- }
8
-
9
- import {default as pluginPackageJson} from '@bfra.me/prettier-plugins/package-json'
10
- const resolvedPlugins: Record<string, Plugin> = {
11
- '@bfra.me/prettier-plugins/package-json': interopDefault(pluginPackageJson),
12
- }
13
-
14
- export const resolve = <T extends Plugin>(
15
- resolver: (id: string) => string,
16
- plugin: string,
17
- ): string | T => {
18
- try {
19
- if (resolvedPlugins[plugin]) {
20
- return resolvedPlugins[plugin] as unknown as T
21
- }
22
- return resolver(plugin)
23
- } finally {
24
- return plugin
25
- }
26
- }
@@ -1,8 +0,0 @@
1
- import {Config} from 'prettier'
2
-
3
- /**
4
- * Shared Prettier configuration for bfra.me projects.
5
- */
6
- declare const config: Config
7
-
8
- export {config as default}
@@ -1,74 +0,0 @@
1
- import {resolve} from './plugins.js'
2
- import {createRequire} from 'module'
3
- const require2 = createRequire(import.meta.url)
4
- const resolvePlugin = resolve.bind(null, require2.resolve)
5
- const {searchParams: params} = new URL(import.meta.url)
6
- const config = {
7
- arrowParens: 'avoid',
8
- bracketSpacing: false,
9
- endOfLine: 'auto',
10
- printWidth: 100,
11
- semi: params.has('semi', 'true'),
12
- singleQuote: true,
13
- overrides: [
14
- // Adapted from https://github.com/sxzz/prettier-config/blob/1e5cc3021e5816aceebe0b90af1d530239442ecf/index.js.
15
- // Require a pragma for paths typically not under version control or written by build tools.
16
- {
17
- files: [
18
- '**/node_modules/**',
19
- '**/dist/**',
20
- '**/lib/**',
21
- '**/coverage/**',
22
- '**/out/**',
23
- '**/temp/**',
24
- '**/.idea/**',
25
- '**/.next/**',
26
- '**/.nuxt/**',
27
- '**/.output/**',
28
- '**/.vercel/**',
29
- '**/.vitepress/cache/**',
30
- '**/.vite-inspect/**',
31
- '**/__snapshots__/**',
32
- '**/test/fixtures/**',
33
- '**/auto-import?(s).d.ts',
34
- '**/.changeset/*.md',
35
- '**/CHANGELOG*.md',
36
- '**/changelog*.md',
37
- '**/components.d.ts',
38
- '**/devcontainer-lock.json',
39
- '**/LICENSE*',
40
- '**/license*',
41
- '**/*.min.*',
42
- '**/package-lock.json',
43
- '**/pnpm-lock.yaml',
44
- '**/typed-router.d.ts',
45
- '**/yarn.lock',
46
- ],
47
- options: {
48
- requirePragma: true,
49
- },
50
- },
51
- // VS Code configuration files:
52
- // Use 4 spaces for indentation to match the default VS Code settings.
53
- {
54
- files: ['.vscode/*.json', '.devcontainer/**/devcontainer*.json'],
55
- options: {
56
- tabWidth: 4,
57
- },
58
- },
59
- // Markdown:
60
- // - Disable single quotes for Markdown files.
61
- // - Disable `proseWrap` to avoid wrapping prose.
62
- {
63
- files: ['*.md'],
64
- options: {
65
- proseWrap: 'never',
66
- singleQuote: false,
67
- },
68
- },
69
- ],
70
- plugins: ['@bfra.me/prettier-plugins/package-json'].map(resolvePlugin),
71
- }
72
- var prettier_config_default = config
73
- export {prettier_config_default as default}
74
- //# sourceMappingURL=prettier.config.js.map