@standard-config/prettier 1.2.1 → 1.4.0

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 CHANGED
@@ -4,11 +4,11 @@
4
4
 
5
5
  # @standard-config/prettier
6
6
 
7
- Curated Prettier config for modern TypeScript projects.
7
+ TypeScript-first Prettier config with carefully considered details.
8
8
 
9
- - Enables the [`oxc` parser](https://oxc.rs/docs/guide/usage/parser.html) for lightning-fast TypeScript formatting.
10
- - Formats shell scripts out of the box, including `git` hooks.
11
- - Sorts all JSON files, with curated order patterns for common config files: `package.json`, `tsconfig.json`, `.oxlintrc.json`, and more.
9
+ - Uses the [`oxc` parser](https://oxc.rs/docs/guide/usage/parser.html) for lightning-fast TypeScript and JavaScript formatting.
10
+ - Formats shell scripts out of the box, including `git` hook files.
11
+ - Sorts all JSON files, with sensible order patterns for common configs like `package.json`, `tsconfig.json`, `.oxlintrc.json`, and more.
12
12
 
13
13
  ## Install
14
14
 
@@ -36,6 +36,6 @@ You can override the defaults by passing your own [config options](https://prett
36
36
  import { defineConfig } from '@standard-config/prettier';
37
37
 
38
38
  export default defineConfig({
39
- semi: false,
39
+ useTabs: false,
40
40
  });
41
41
  ```
package/dist/index.d.mts CHANGED
@@ -1,13 +1,5 @@
1
1
  import { Config } from "prettier";
2
2
 
3
- //#region src/types/index.d.ts
4
- declare module 'prettier' {
5
- interface Options {
6
- jsonRecursiveSort?: boolean | undefined;
7
- jsonSortOrder?: string | undefined;
8
- }
9
- }
10
- //#endregion
11
3
  //#region src/define-config/index.d.ts
12
4
  declare function defineConfig(config?: Config): Config;
13
5
  //#endregion
package/dist/index.mjs CHANGED
@@ -1,7 +1,8 @@
1
1
  import * as pluginOxidation from "@prettier/plugin-oxc";
2
+ import * as pluginExpandJSON from "prettier-plugin-expand-json";
2
3
  import * as pluginPackageJSON from "prettier-plugin-packagejson";
3
- import * as pluginSortJSON from "prettier-plugin-sort-json";
4
4
  import * as pluginShell from "prettier-plugin-sh";
5
+ import * as pluginSortJSON from "prettier-plugin-sort-json";
5
6
  import { klona } from "klona/lite";
6
7
 
7
8
  //#region src/prioritize-keys/index.ts
@@ -15,7 +16,7 @@ function prioritizeKeys(...keys) {
15
16
  }
16
17
 
17
18
  //#endregion
18
- //#region src/config.ts
19
+ //#region src/config/index.ts
19
20
  /**
20
21
  * Shell files can’t be reliably identified by name alone—they’re recognized by
21
22
  * the shebang, not the extension. As a result, shell formatting options
@@ -29,7 +30,11 @@ const DEFAULT_OPTIONS = {
29
30
  useTabs: true
30
31
  };
31
32
  const DEFAULT_CONFIG = {
32
- plugins: [pluginOxidation, pluginShell],
33
+ plugins: [
34
+ pluginOxidation,
35
+ pluginShell,
36
+ pluginExpandJSON
37
+ ],
33
38
  bracketSpacing: true,
34
39
  printWidth: 80,
35
40
  quoteProps: "consistent",
@@ -88,9 +93,17 @@ const DEFAULT_CONFIG = {
88
93
  "*.jsonc",
89
94
  "*.json5"
90
95
  ],
96
+ options: { ...DEFAULT_OPTIONS }
97
+ },
98
+ {
99
+ files: [
100
+ "*.json",
101
+ "*.jsonc",
102
+ "*.json5"
103
+ ],
104
+ excludeFiles: ["package.json"],
91
105
  options: {
92
- ...DEFAULT_OPTIONS,
93
- plugins: [pluginSortJSON],
106
+ plugins: [pluginSortJSON, pluginExpandJSON],
94
107
  jsonRecursiveSort: true,
95
108
  jsonSortOrder: prioritizeKeys("$schema")
96
109
  }
@@ -140,6 +153,11 @@ const DEFAULT_CONFIG = {
140
153
  singleAttributePerLine: true
141
154
  }
142
155
  },
156
+ (
157
+ /**
158
+ * All `.oxlintrc.json` fields defined by the Oxlint documentation
159
+ * are sorted, including nested fields.
160
+ */
143
161
  {
144
162
  files: [
145
163
  "oxlintrc.json",
@@ -151,40 +169,71 @@ const DEFAULT_CONFIG = {
151
169
  ".oxlintrc.*.json",
152
170
  ".oxlintrc.*.jsonc"
153
171
  ],
154
- options: { jsonSortOrder: prioritizeKeys("$schema", "files", "extends", "plugins", "categories", "env", "settings", "rules", "overrides") }
155
- },
172
+ options: { jsonSortOrder: prioritizeKeys("$schema", "files", "extends", "ignorePatterns", "plugins", "jsPlugins", "categories", "env", "globals", "settings", "rules", "overrides") }
173
+ }),
174
+ (
175
+ /**
176
+ * All `package.json` fields defined in the `npm@11` specification
177
+ * are sorted, along with additional commonly used fields.
178
+ */
156
179
  {
157
180
  files: ["package.json"],
158
181
  options: {
159
- plugins: [pluginPackageJSON, pluginSortJSON],
182
+ plugins: [pluginPackageJSON, pluginExpandJSON],
160
183
  packageSortOrder: [
184
+ "$schema",
161
185
  "name",
162
- "private",
163
186
  "version",
187
+ "private",
164
188
  "description",
165
189
  "license",
166
190
  "author",
191
+ "contributors",
192
+ "funding",
193
+ "homepage",
167
194
  "repository",
195
+ "bugs",
168
196
  "keywords",
197
+ "workspaces",
169
198
  "directories",
170
199
  "files",
171
200
  "type",
201
+ "browser",
172
202
  "sideEffects",
173
203
  "main",
204
+ "module",
174
205
  "exports",
175
206
  "types",
207
+ "typesVersions",
176
208
  "bin",
209
+ "man",
177
210
  "imports",
178
211
  "engines",
212
+ "os",
213
+ "cpu",
214
+ "libc",
215
+ "gypfile",
179
216
  "packageManager",
217
+ "devEngines",
180
218
  "dependencies",
219
+ "bundleDependencies",
181
220
  "peerDependencies",
182
221
  "peerDependenciesMeta",
222
+ "optionalDependencies",
183
223
  "devDependencies",
224
+ "overrides",
225
+ "pnpm",
226
+ "config",
227
+ "publishConfig",
184
228
  "scripts"
185
229
  ]
186
230
  }
187
- },
231
+ }),
232
+ (
233
+ /**
234
+ * All `tsconfig.json` fields defined by the TypeScript documentation
235
+ * are sorted, including nested fields.
236
+ */
188
237
  {
189
238
  files: [
190
239
  "tsconfig.json",
@@ -192,8 +241,8 @@ const DEFAULT_CONFIG = {
192
241
  "jsconfig.json",
193
242
  "jsconfig.*.json"
194
243
  ],
195
- options: { jsonSortOrder: prioritizeKeys("extends", "compilerOptions", "files", "include", "exclude") }
196
- }
244
+ options: { jsonSortOrder: prioritizeKeys("$schema", "extends", "enable", "references", "compilerOptions", "typeAcquisition", "files", "include", "exclude", "watchOptions", "watchDirectory", "watchFile", "fallbackPolling", "synchronousWatchDirectory", "compileOnSave") }
245
+ })
197
246
  ]
198
247
  };
199
248
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["clone"],"sources":["../src/prioritize-keys/index.ts","../src/config.ts","../src/merge-config/index.ts","../src/define-config/index.ts"],"sourcesContent":["export default function prioritizeKeys(...keys: ReadonlyArray<string>): string {\n\t/* oxlint-disable-next-line typescript/no-restricted-types */\n\tconst order: Record<string, null> = {};\n\n\tfor (const key of keys) {\n\t\torder[String(key)] = null;\n\t}\n\n\treturn JSON.stringify({\n\t\t...order,\n\t\t/* oxlint-disable-next-line typescript/no-explicit-any */\n\t\t[/.*/ as any]: 'lexical',\n\t});\n}\n","import type { Config, Options } from 'prettier';\nimport * as pluginOxidation from '@prettier/plugin-oxc';\nimport * as pluginPackageJSON from 'prettier-plugin-packagejson';\nimport * as pluginSortJSON from 'prettier-plugin-sort-json';\nimport * as pluginShell from 'prettier-plugin-sh';\nimport prioritizeKeys from './prioritize-keys/index.ts';\n\n/**\n * Shell files can’t be reliably identified by name alone—they’re recognized by\n * the shebang, not the extension. As a result, shell formatting options\n * (two-space indentation) must be defined as the global defaults.\n *\n * This requires overriding those options for other file types individually\n * with what we consider the actual defaults. This object defines them.\n */\nexport const DEFAULT_OPTIONS = {\n\ttabWidth: 4,\n\tuseTabs: true,\n} as const satisfies Options;\n\nexport const DEFAULT_CONFIG = {\n\tplugins: [pluginOxidation, pluginShell],\n\tbracketSpacing: true,\n\tprintWidth: 80,\n\tquoteProps: 'consistent',\n\tsingleQuote: true,\n\ttabWidth: 2,\n\ttrailingComma: 'es5',\n\tuseTabs: false,\n\toverrides: [\n\t\t{\n\t\t\tfiles: ['*.css', '*.scss'],\n\t\t\toptions: {\n\t\t\t\t...DEFAULT_OPTIONS,\n\t\t\t\tprintWidth: 100,\n\t\t\t\tsingleQuote: false,\n\t\t\t},\n\t\t},\n\t\t/**\n\t\t * Fish file formatting follows the output of `fish_indent`, which\n\t\t * defaults to four-space indentation.\n\t\t */\n\t\t{\n\t\t\tfiles: ['*.fish'],\n\t\t\toptions: {\n\t\t\t\ttabWidth: 4,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tfiles: ['*.graphql', '*.graphqls', '*.gql'],\n\t\t\toptions: {\n\t\t\t\t...DEFAULT_OPTIONS,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tfiles: ['*.html', '*.htm'],\n\t\t\toptions: {\n\t\t\t\t...DEFAULT_OPTIONS,\n\t\t\t\tprintWidth: 100,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tfiles: ['*.js', '*.jsx', '*.cjs', '*.mjs'],\n\t\t\toptions: {\n\t\t\t\t...DEFAULT_OPTIONS,\n\t\t\t\tparser: 'oxc',\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tfiles: ['*.json', '*.jsonc', '*.json5'],\n\t\t\toptions: {\n\t\t\t\t...DEFAULT_OPTIONS,\n\t\t\t\tplugins: [pluginSortJSON],\n\t\t\t\tjsonRecursiveSort: true,\n\t\t\t\tjsonSortOrder: prioritizeKeys('$schema'),\n\t\t\t},\n\t\t},\n\t\t/**\n\t\t * Tab-based indentation becomes inconvenient when rendered outside the\n\t\t * context of a code editor. In documentation, tabs in code blocks\n\t\t * require special handling that very few renderers support.\n\t\t *\n\t\t * At the time of writing, GitHub renders tabs correctly on the web, but\n\t\t * not in its mobile app. `npm`, often the point of discovery for\n\t\t * packages, does not provide any special handling for tabs either.\n\t\t *\n\t\t * To maximize the readability of code blocks in documentation, spaces\n\t\t * are the right compromise.\n\t\t */\n\t\t{\n\t\t\tfiles: ['*.md', '*.mdx'],\n\t\t\toptions: {\n\t\t\t\t...DEFAULT_OPTIONS,\n\t\t\t\tuseTabs: false,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tfiles: ['*.ts', '*.tsx', '*.cts', '*.mts'],\n\t\t\toptions: {\n\t\t\t\t...DEFAULT_OPTIONS,\n\t\t\t\tparser: 'oxc-ts',\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tfiles: ['*.xml', '*.plist', '*.svg'],\n\t\t\toptions: {\n\t\t\t\t...DEFAULT_OPTIONS,\n\t\t\t\tparser: 'html',\n\t\t\t\tprintWidth: 80,\n\t\t\t\tsingleAttributePerLine: true,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tfiles: [\n\t\t\t\t'oxlintrc.json',\n\t\t\t\t'oxlintrc.jsonc',\n\t\t\t\t'oxlintrc.*.json',\n\t\t\t\t'oxlintrc.*.jsonc',\n\t\t\t\t'.oxlintrc.json',\n\t\t\t\t'.oxlintrc.jsonc',\n\t\t\t\t'.oxlintrc.*.json',\n\t\t\t\t'.oxlintrc.*.jsonc',\n\t\t\t],\n\t\t\toptions: {\n\t\t\t\tjsonSortOrder: prioritizeKeys(\n\t\t\t\t\t'$schema',\n\t\t\t\t\t'files',\n\t\t\t\t\t'extends',\n\t\t\t\t\t'plugins',\n\t\t\t\t\t'categories',\n\t\t\t\t\t'env',\n\t\t\t\t\t'settings',\n\t\t\t\t\t'rules',\n\t\t\t\t\t'overrides'\n\t\t\t\t),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tfiles: ['package.json'],\n\t\t\toptions: {\n\t\t\t\tplugins: [pluginPackageJSON, pluginSortJSON],\n\t\t\t\tpackageSortOrder: [\n\t\t\t\t\t'name',\n\t\t\t\t\t'private',\n\t\t\t\t\t'version',\n\t\t\t\t\t'description',\n\t\t\t\t\t'license',\n\t\t\t\t\t'author',\n\t\t\t\t\t'repository',\n\t\t\t\t\t'keywords',\n\t\t\t\t\t'directories',\n\t\t\t\t\t'files',\n\t\t\t\t\t'type',\n\t\t\t\t\t'sideEffects',\n\t\t\t\t\t'main',\n\t\t\t\t\t'exports',\n\t\t\t\t\t'types',\n\t\t\t\t\t'bin',\n\t\t\t\t\t'imports',\n\t\t\t\t\t'engines',\n\t\t\t\t\t'packageManager',\n\t\t\t\t\t'dependencies',\n\t\t\t\t\t'peerDependencies',\n\t\t\t\t\t'peerDependenciesMeta',\n\t\t\t\t\t'devDependencies',\n\t\t\t\t\t'scripts',\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tfiles: [\n\t\t\t\t'tsconfig.json',\n\t\t\t\t'tsconfig.*.json',\n\t\t\t\t'jsconfig.json',\n\t\t\t\t'jsconfig.*.json',\n\t\t\t],\n\t\t\toptions: {\n\t\t\t\tjsonSortOrder: prioritizeKeys(\n\t\t\t\t\t'extends',\n\t\t\t\t\t'compilerOptions',\n\t\t\t\t\t'files',\n\t\t\t\t\t'include',\n\t\t\t\t\t'exclude'\n\t\t\t\t),\n\t\t\t},\n\t\t},\n\t],\n} as const satisfies Config;\n","import type { Config } from 'prettier';\nimport { klona as clone } from 'klona/lite';\n\nexport default function mergeConfig(\n\tbaseConfig: Config,\n\textensionConfig: Config\n): Config {\n\tif (\n\t\t!(typeof baseConfig === 'object' && typeof extensionConfig === 'object')\n\t) {\n\t\tthrow new TypeError(\n\t\t\t'Prettier config error: expected config to be an object'\n\t\t);\n\t}\n\n\tconst result = clone(baseConfig);\n\n\tfor (const [key, value] of Object.entries(clone(extensionConfig))) {\n\t\tif (value === undefined) {\n\t\t\t/* oxlint-disable-next-line typescript/no-dynamic-delete */\n\t\t\tdelete result[key];\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (isArray(value) && isArray(result[key])) {\n\t\t\tresult[key] = [...result[key], ...value];\n\t\t\tcontinue;\n\t\t}\n\n\t\tresult[key] = value;\n\t}\n\n\treturn result;\n}\n\nfunction isArray(value: unknown): value is unknown[] {\n\treturn Array.isArray(value);\n}\n","import type { Config } from 'prettier';\nimport { DEFAULT_CONFIG } from '../config.ts';\nimport mergeConfig from '../merge-config/index.ts';\n\nexport default function defineConfig(config: Config = {}): Config {\n\treturn mergeConfig(DEFAULT_CONFIG, config);\n}\n"],"m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ACxB;GACD;EACD;GACC,OAAO;IACN;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;GACD,SAAS,EACR,eAAe,eACd,WACA,SACA,WACA,WACA,cACA,OACA,YACA,SACA,YACA,EACD;GACD;EACD;GACC,OAAO,CAAC,eAAe;GACvB,SAAS;IACR,SAAS,CAAC,mBAAmB,eAAe;IAC5C,kBAAkB;KACjB;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;IACD;GACD;EACD;GACC,OAAO;IACN;IACA;IACA;IACA;IACA;GACD,SAAS,EACR,eAAe,eACd,WACA,mBACA,SACA,WACA,UACA,EACD;GACD;EACD;CACD;;;;ACxLD,SAAwB,YACvB,YACA,iBACS;AACT,KACC,EAAE,OAAO,eAAe,YAAY,OAAO,oBAAoB,UAE/D,OAAM,IAAI,UACT,yDACA;CAGF,MAAM,SAASA,MAAM,WAAW;AAEhC,MAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQA,MAAM,gBAAgB,CAAC,EAAE;AAClE,MAAI,UAAU,QAAW;AAExB,UAAO,OAAO;AACd;;AAGD,MAAI,QAAQ,MAAM,IAAI,QAAQ,OAAO,KAAK,EAAE;AAC3C,UAAO,OAAO,CAAC,GAAG,OAAO,MAAM,GAAG,MAAM;AACxC;;AAGD,SAAO,OAAO;;AAGf,QAAO;;AAGR,SAAS,QAAQ,OAAoC;AACpD,QAAO,MAAM,QAAQ,MAAM;;;;;AChC5B,SAAwB,aAAa,SAAiB,EAAE,EAAU;AACjE,QAAO,YAAY,gBAAgB,OAAO"}
1
+ {"version":3,"file":"index.mjs","names":["clone"],"sources":["../src/prioritize-keys/index.ts","../src/config/index.ts","../src/merge-config/index.ts","../src/define-config/index.ts"],"sourcesContent":["export default function prioritizeKeys(...keys: ReadonlyArray<string>): string {\n\t/* oxlint-disable-next-line typescript/no-restricted-types */\n\tconst order: Record<string, null> = {};\n\n\tfor (const key of keys) {\n\t\torder[String(key)] = null;\n\t}\n\n\treturn JSON.stringify({\n\t\t...order,\n\t\t/* oxlint-disable-next-line typescript/no-explicit-any */\n\t\t[/.*/ as any]: 'lexical',\n\t});\n}\n","import type { Config, Options } from 'prettier';\nimport * as pluginOxidation from '@prettier/plugin-oxc';\nimport * as pluginExpandJSON from 'prettier-plugin-expand-json';\nimport * as pluginPackageJSON from 'prettier-plugin-packagejson';\nimport * as pluginShell from 'prettier-plugin-sh';\nimport * as pluginSortJSON from 'prettier-plugin-sort-json';\nimport prioritizeKeys from '../prioritize-keys/index.ts';\n\n/**\n * Shell files can’t be reliably identified by name alone—they’re recognized by\n * the shebang, not the extension. As a result, shell formatting options\n * (two-space indentation) must be defined as the global defaults.\n *\n * This requires overriding those options for other file types individually\n * with what we consider the actual defaults. This object defines them.\n */\nexport const DEFAULT_OPTIONS = {\n\ttabWidth: 4,\n\tuseTabs: true,\n} as const satisfies Options;\n\nexport const DEFAULT_CONFIG = {\n\tplugins: [pluginOxidation, pluginShell, pluginExpandJSON],\n\tbracketSpacing: true,\n\tprintWidth: 80,\n\tquoteProps: 'consistent',\n\tsingleQuote: true,\n\ttabWidth: 2,\n\ttrailingComma: 'es5',\n\tuseTabs: false,\n\toverrides: [\n\t\t{\n\t\t\tfiles: ['*.css', '*.scss'],\n\t\t\toptions: {\n\t\t\t\t...DEFAULT_OPTIONS,\n\t\t\t\tprintWidth: 100,\n\t\t\t\tsingleQuote: false,\n\t\t\t},\n\t\t},\n\t\t/**\n\t\t * Fish file formatting follows the output of `fish_indent`, which\n\t\t * defaults to four-space indentation.\n\t\t */\n\t\t{\n\t\t\tfiles: ['*.fish'],\n\t\t\toptions: {\n\t\t\t\ttabWidth: 4,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tfiles: ['*.graphql', '*.graphqls', '*.gql'],\n\t\t\toptions: {\n\t\t\t\t...DEFAULT_OPTIONS,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tfiles: ['*.html', '*.htm'],\n\t\t\toptions: {\n\t\t\t\t...DEFAULT_OPTIONS,\n\t\t\t\tprintWidth: 100,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tfiles: ['*.js', '*.jsx', '*.cjs', '*.mjs'],\n\t\t\toptions: {\n\t\t\t\t...DEFAULT_OPTIONS,\n\t\t\t\tparser: 'oxc',\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tfiles: ['*.json', '*.jsonc', '*.json5'],\n\t\t\toptions: {\n\t\t\t\t...DEFAULT_OPTIONS,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tfiles: ['*.json', '*.jsonc', '*.json5'],\n\t\t\texcludeFiles: ['package.json'],\n\t\t\toptions: {\n\t\t\t\tplugins: [pluginSortJSON, pluginExpandJSON],\n\t\t\t\tjsonRecursiveSort: true,\n\t\t\t\tjsonSortOrder: prioritizeKeys('$schema'),\n\t\t\t},\n\t\t},\n\t\t/**\n\t\t * Tab-based indentation becomes inconvenient when rendered outside the\n\t\t * context of a code editor. In documentation, tabs in code blocks\n\t\t * require special handling that very few renderers support.\n\t\t *\n\t\t * At the time of writing, GitHub renders tabs correctly on the web, but\n\t\t * not in its mobile app. `npm`, often the point of discovery for\n\t\t * packages, does not provide any special handling for tabs either.\n\t\t *\n\t\t * To maximize the readability of code blocks in documentation, spaces\n\t\t * are the right compromise.\n\t\t */\n\t\t{\n\t\t\tfiles: ['*.md', '*.mdx'],\n\t\t\toptions: {\n\t\t\t\t...DEFAULT_OPTIONS,\n\t\t\t\tuseTabs: false,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tfiles: ['*.ts', '*.tsx', '*.cts', '*.mts'],\n\t\t\toptions: {\n\t\t\t\t...DEFAULT_OPTIONS,\n\t\t\t\tparser: 'oxc-ts',\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tfiles: ['*.xml', '*.plist', '*.svg'],\n\t\t\toptions: {\n\t\t\t\t...DEFAULT_OPTIONS,\n\t\t\t\tparser: 'html',\n\t\t\t\tprintWidth: 80,\n\t\t\t\tsingleAttributePerLine: true,\n\t\t\t},\n\t\t},\n\t\t/**\n\t\t * All `.oxlintrc.json` fields defined by the Oxlint documentation\n\t\t * are sorted, including nested fields.\n\t\t */\n\t\t{\n\t\t\tfiles: [\n\t\t\t\t'oxlintrc.json',\n\t\t\t\t'oxlintrc.jsonc',\n\t\t\t\t'oxlintrc.*.json',\n\t\t\t\t'oxlintrc.*.jsonc',\n\t\t\t\t'.oxlintrc.json',\n\t\t\t\t'.oxlintrc.jsonc',\n\t\t\t\t'.oxlintrc.*.json',\n\t\t\t\t'.oxlintrc.*.jsonc',\n\t\t\t],\n\t\t\toptions: {\n\t\t\t\tjsonSortOrder: prioritizeKeys(\n\t\t\t\t\t'$schema',\n\t\t\t\t\t'files',\n\t\t\t\t\t'extends',\n\t\t\t\t\t'ignorePatterns',\n\t\t\t\t\t'plugins',\n\t\t\t\t\t'jsPlugins',\n\t\t\t\t\t'categories',\n\t\t\t\t\t'env',\n\t\t\t\t\t'globals',\n\t\t\t\t\t'settings',\n\t\t\t\t\t'rules',\n\t\t\t\t\t'overrides'\n\t\t\t\t),\n\t\t\t},\n\t\t},\n\t\t/**\n\t\t * All `package.json` fields defined in the `npm@11` specification\n\t\t * are sorted, along with additional commonly used fields.\n\t\t */\n\t\t{\n\t\t\tfiles: ['package.json'],\n\t\t\toptions: {\n\t\t\t\tplugins: [pluginPackageJSON, pluginExpandJSON],\n\t\t\t\tpackageSortOrder: [\n\t\t\t\t\t'$schema',\n\t\t\t\t\t'name',\n\t\t\t\t\t'version',\n\t\t\t\t\t'private',\n\t\t\t\t\t'description',\n\t\t\t\t\t'license',\n\t\t\t\t\t'author',\n\t\t\t\t\t'contributors',\n\t\t\t\t\t'funding',\n\t\t\t\t\t'homepage',\n\t\t\t\t\t'repository',\n\t\t\t\t\t'bugs',\n\t\t\t\t\t'keywords',\n\t\t\t\t\t'workspaces',\n\t\t\t\t\t'directories',\n\t\t\t\t\t'files',\n\t\t\t\t\t'type',\n\t\t\t\t\t'browser',\n\t\t\t\t\t'sideEffects',\n\t\t\t\t\t'main',\n\t\t\t\t\t'module',\n\t\t\t\t\t'exports',\n\t\t\t\t\t'types',\n\t\t\t\t\t'typesVersions',\n\t\t\t\t\t'bin',\n\t\t\t\t\t'man',\n\t\t\t\t\t'imports',\n\t\t\t\t\t'engines',\n\t\t\t\t\t'os',\n\t\t\t\t\t'cpu',\n\t\t\t\t\t'libc',\n\t\t\t\t\t'gypfile',\n\t\t\t\t\t'packageManager',\n\t\t\t\t\t'devEngines',\n\t\t\t\t\t'dependencies',\n\t\t\t\t\t'bundleDependencies',\n\t\t\t\t\t'peerDependencies',\n\t\t\t\t\t'peerDependenciesMeta',\n\t\t\t\t\t'optionalDependencies',\n\t\t\t\t\t'devDependencies',\n\t\t\t\t\t'overrides',\n\t\t\t\t\t'pnpm',\n\t\t\t\t\t'config',\n\t\t\t\t\t'publishConfig',\n\t\t\t\t\t'scripts',\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\t\t/**\n\t\t * All `tsconfig.json` fields defined by the TypeScript documentation\n\t\t * are sorted, including nested fields.\n\t\t */\n\t\t{\n\t\t\tfiles: [\n\t\t\t\t'tsconfig.json',\n\t\t\t\t'tsconfig.*.json',\n\t\t\t\t'jsconfig.json',\n\t\t\t\t'jsconfig.*.json',\n\t\t\t],\n\t\t\toptions: {\n\t\t\t\tjsonSortOrder: prioritizeKeys(\n\t\t\t\t\t'$schema',\n\t\t\t\t\t'extends',\n\t\t\t\t\t'enable',\n\t\t\t\t\t'references',\n\t\t\t\t\t'compilerOptions',\n\t\t\t\t\t'typeAcquisition',\n\t\t\t\t\t'files',\n\t\t\t\t\t'include',\n\t\t\t\t\t'exclude',\n\t\t\t\t\t'watchOptions',\n\t\t\t\t\t'watchDirectory',\n\t\t\t\t\t'watchFile',\n\t\t\t\t\t'fallbackPolling',\n\t\t\t\t\t'synchronousWatchDirectory',\n\t\t\t\t\t'compileOnSave'\n\t\t\t\t),\n\t\t\t},\n\t\t},\n\t],\n} as const satisfies Config;\n","import type { Config } from 'prettier';\nimport { klona as clone } from 'klona/lite';\n\nexport default function mergeConfig(\n\tbaseConfig: Config,\n\textensionConfig: Config\n): Config {\n\tif (\n\t\t!(typeof baseConfig === 'object' && typeof extensionConfig === 'object')\n\t) {\n\t\tthrow new TypeError(\n\t\t\t'Prettier config error: expected config to be an object'\n\t\t);\n\t}\n\n\tconst result = clone(baseConfig);\n\n\tfor (const [key, value] of Object.entries(clone(extensionConfig))) {\n\t\tif (value === undefined) {\n\t\t\t/* oxlint-disable-next-line typescript/no-dynamic-delete */\n\t\t\tdelete result[key];\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (isArray(value) && isArray(result[key])) {\n\t\t\tresult[key] = [...result[key], ...value];\n\t\t\tcontinue;\n\t\t}\n\n\t\tresult[key] = value;\n\t}\n\n\treturn result;\n}\n\nfunction isArray(value: unknown): value is unknown[] {\n\treturn Array.isArray(value);\n}\n","import type { Config } from 'prettier';\nimport { DEFAULT_CONFIG } from '../config/index.ts';\nimport mergeConfig from '../merge-config/index.ts';\n\nexport default function defineConfig(config: Config = {}): Config {\n\treturn mergeConfig(DEFAULT_CONFIG, config);\n}\n"],"mappings":";;;;;;;;AAAA,SAAwB,eAAe,GAAG,MAAqC;CAE9E,MAAM,QAA8B,EAAE;AAEtC,MAAK,MAAM,OAAO,KACjB,OAAM,OAAO,IAAI,IAAI;AAGtB,QAAO,KAAK,UAAU;EACrB,GAAG;GAEF,OAAc;EACf,CAAC;;;;;;;;;;;;;ACIH,MAAa,kBAAkB;CAC9B,UAAU;CACV,SAAS;CACT;AAED,MAAa,iBAAiB;CAC7B,SAAS;EAAC;EAAiB;EAAa;EAAiB;CACzD,gBAAgB;CAChB,YAAY;CACZ,YAAY;CACZ,aAAa;CACb,UAAU;CACV,eAAe;CACf,SAAS;CACT,WAAW;EACV;GACC,OAAO,CAAC,SAAS,SAAS;GAC1B,SAAS;IACR,GAAG;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KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;IACD;GACD;;;;;;EAKD;GACC,OAAO;IACN;IACA;IACA;IACA;IACA;GACD,SAAS,EACR,eAAe,eACd,WACA,WACA,UACA,cACA,mBACA,mBACA,SACA,WACA,WACA,gBACA,kBACA,aACA,mBACA,6BACA,gBACA,EACD;GACD;EACD;CACD;;;;AC7OD,SAAwB,YACvB,YACA,iBACS;AACT,KACC,EAAE,OAAO,eAAe,YAAY,OAAO,oBAAoB,UAE/D,OAAM,IAAI,UACT,yDACA;CAGF,MAAM,SAASA,MAAM,WAAW;AAEhC,MAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQA,MAAM,gBAAgB,CAAC,EAAE;AAClE,MAAI,UAAU,QAAW;AAExB,UAAO,OAAO;AACd;;AAGD,MAAI,QAAQ,MAAM,IAAI,QAAQ,OAAO,KAAK,EAAE;AAC3C,UAAO,OAAO,CAAC,GAAG,OAAO,MAAM,GAAG,MAAM;AACxC;;AAGD,SAAO,OAAO;;AAGf,QAAO;;AAGR,SAAS,QAAQ,OAAoC;AACpD,QAAO,MAAM,QAAQ,MAAM;;;;;AChC5B,SAAwB,aAAa,SAAiB,EAAE,EAAU;AACjE,QAAO,YAAY,gBAAgB,OAAO"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@standard-config/prettier",
3
- "version": "1.2.1",
3
+ "version": "1.4.0",
4
4
  "description": "TypeScript-first Prettier config",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -29,13 +29,14 @@
29
29
  "engines": {
30
30
  "node": ">=22"
31
31
  },
32
- "packageManager": "pnpm@10.28.0",
32
+ "packageManager": "pnpm@10.28.1",
33
33
  "dependencies": {
34
34
  "@prettier/plugin-oxc": "^0.1.3",
35
35
  "klona": "^2.0.6",
36
- "prettier-plugin-packagejson": "^2.5.21",
36
+ "prettier-plugin-expand-json": "^1.0.0",
37
+ "prettier-plugin-packagejson": "^3.0.0",
37
38
  "prettier-plugin-sh": "^0.18.0",
38
- "prettier-plugin-sort-json": "4.1.1"
39
+ "prettier-plugin-sort-json": "^4.2.0"
39
40
  },
40
41
  "peerDependencies": {
41
42
  "prettier": ">=3.7"
@@ -44,9 +45,9 @@
44
45
  "@standard-config/tsconfig": "2.0.0",
45
46
  "@vitest/coverage-v8": "4.0.17",
46
47
  "husky": "9.1.7",
47
- "oxlint": "1.39.0",
48
- "oxlint-tsgolint": "0.11.0",
49
- "prettier": "3.7.4",
48
+ "oxlint": "1.41.0",
49
+ "oxlint-tsgolint": "0.11.1",
50
+ "prettier": "3.8.0",
50
51
  "publint": "0.3.16",
51
52
  "tsdown": "0.19.0",
52
53
  "typescript": "5.9.3",