@standard-config/prettier 1.2.1 → 1.3.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
 
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
@@ -158,29 +158,50 @@ const DEFAULT_CONFIG = {
158
158
  options: {
159
159
  plugins: [pluginPackageJSON, pluginSortJSON],
160
160
  packageSortOrder: [
161
+ "$schema",
161
162
  "name",
162
- "private",
163
163
  "version",
164
+ "private",
164
165
  "description",
165
166
  "license",
166
167
  "author",
168
+ "contributors",
169
+ "funding",
170
+ "homepage",
167
171
  "repository",
172
+ "bugs",
168
173
  "keywords",
174
+ "workspaces",
169
175
  "directories",
170
176
  "files",
171
177
  "type",
178
+ "browser",
172
179
  "sideEffects",
173
180
  "main",
181
+ "module",
174
182
  "exports",
175
183
  "types",
184
+ "typesVersions",
176
185
  "bin",
186
+ "man",
177
187
  "imports",
178
188
  "engines",
189
+ "os",
190
+ "cpu",
191
+ "libc",
192
+ "gypfile",
179
193
  "packageManager",
194
+ "devEngines",
180
195
  "dependencies",
196
+ "bundleDependencies",
181
197
  "peerDependencies",
182
198
  "peerDependenciesMeta",
199
+ "optionalDependencies",
183
200
  "devDependencies",
201
+ "overrides",
202
+ "pnpm",
203
+ "config",
204
+ "publishConfig",
184
205
  "scripts"
185
206
  ]
186
207
  }
@@ -192,7 +213,7 @@ const DEFAULT_CONFIG = {
192
213
  "jsconfig.json",
193
214
  "jsconfig.*.json"
194
215
  ],
195
- options: { jsonSortOrder: prioritizeKeys("extends", "compilerOptions", "files", "include", "exclude") }
216
+ options: { jsonSortOrder: prioritizeKeys("$schema", "extends", "references", "compilerOptions", "typeAcquisition", "files", "include", "exclude", "watchOptions", "compileOnSave") }
196
217
  }
197
218
  ]
198
219
  };
@@ -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"],"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;;;;;;;;;;;;;ACGH,MAAa,kBAAkB;CAC9B,UAAU;CACV,SAAS;CACT;AAED,MAAa,iBAAiB;CAC7B,SAAS,CAAC,iBAAiB,YAAY;CACvC,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;IACH,YAAY;IACZ,aAAa;IACb;GACD;;;;;;EAKD;GACC,OAAO,CAAC,SAAS;GACjB,SAAS,EACR,UAAU,GACV;GACD;EACD;GACC,OAAO;IAAC;IAAa;IAAc;IAAQ;GAC3C,SAAS,EACR,GAAG,iBACH;GACD;EACD;GACC,OAAO,CAAC,UAAU,QAAQ;GAC1B,SAAS;IACR,GAAG;IACH,YAAY;IACZ;GACD;EACD;GACC,OAAO;IAAC;IAAQ;IAAS;IAAS;IAAQ;GAC1C,SAAS;IACR,GAAG;IACH,QAAQ;IACR;GACD;EACD;GACC,OAAO;IAAC;IAAU;IAAW;IAAU;GACvC,SAAS;IACR,GAAG;IACH,SAAS,CAAC,eAAe;IACzB,mBAAmB;IACnB,eAAe,eAAe,UAAU;IACxC;GACD;;;;;;;;;;;;;;EAaD;GACC,OAAO,CAAC,QAAQ,QAAQ;GACxB,SAAS;IACR,GAAG;IACH,SAAS;IACT;GACD;EACD;GACC,OAAO;IAAC;IAAQ;IAAS;IAAS;IAAQ;GAC1C,SAAS;IACR,GAAG;IACH,QAAQ;IACR;GACD;EACD;GACC,OAAO;IAAC;IAAS;IAAW;IAAQ;GACpC,SAAS;IACR,GAAG;IACH,QAAQ;IACR,YAAY;IACZ,wBAAwB;IACxB;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.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'$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\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'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'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.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;;;;;;;;;;;;;ACGH,MAAa,kBAAkB;CAC9B,UAAU;CACV,SAAS;CACT;AAED,MAAa,iBAAiB;CAC7B,SAAS,CAAC,iBAAiB,YAAY;CACvC,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;IACH,YAAY;IACZ,aAAa;IACb;GACD;;;;;;EAKD;GACC,OAAO,CAAC,SAAS;GACjB,SAAS,EACR,UAAU,GACV;GACD;EACD;GACC,OAAO;IAAC;IAAa;IAAc;IAAQ;GAC3C,SAAS,EACR,GAAG,iBACH;GACD;EACD;GACC,OAAO,CAAC,UAAU,QAAQ;GAC1B,SAAS;IACR,GAAG;IACH,YAAY;IACZ;GACD;EACD;GACC,OAAO;IAAC;IAAQ;IAAS;IAAS;IAAQ;GAC1C,SAAS;IACR,GAAG;IACH,QAAQ;IACR;GACD;EACD;GACC,OAAO;IAAC;IAAU;IAAW;IAAU;GACvC,SAAS;IACR,GAAG;IACH,SAAS,CAAC,eAAe;IACzB,mBAAmB;IACnB,eAAe,eAAe,UAAU;IACxC;GACD;;;;;;;;;;;;;;EAaD;GACC,OAAO,CAAC,QAAQ,QAAQ;GACxB,SAAS;IACR,GAAG;IACH,SAAS;IACT;GACD;EACD;GACC,OAAO;IAAC;IAAQ;IAAS;IAAS;IAAQ;GAC1C,SAAS;IACR,GAAG;IACH,QAAQ;IACR;GACD;EACD;GACC,OAAO;IAAC;IAAS;IAAW;IAAQ;GACpC,SAAS;IACR,GAAG;IACH,QAAQ;IACR,YAAY;IACZ,wBAAwB;IACxB;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;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,WACA,cACA,mBACA,mBACA,SACA,WACA,WACA,gBACA,gBACA,EACD;GACD;EACD;CACD;;;;AClND,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.3.0",
4
4
  "description": "TypeScript-first Prettier config",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -35,7 +35,7 @@
35
35
  "klona": "^2.0.6",
36
36
  "prettier-plugin-packagejson": "^2.5.21",
37
37
  "prettier-plugin-sh": "^0.18.0",
38
- "prettier-plugin-sort-json": "4.1.1"
38
+ "prettier-plugin-sort-json": "^4.2.0"
39
39
  },
40
40
  "peerDependencies": {
41
41
  "prettier": ">=3.7"