@standard-config/prettier 1.8.0 → 1.9.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 +6 -2
- package/dist/index.d.mts +3 -0
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +59 -35
- package/dist/index.mjs.map +1 -1
- package/package.json +14 -10
package/README.md
CHANGED
|
@@ -8,7 +8,8 @@ TypeScript-first Prettier config with carefully considered details.
|
|
|
8
8
|
|
|
9
9
|
- Uses the [`oxc` parser](https://oxc.rs/docs/guide/usage/parser.html) for lightning-fast TypeScript and JavaScript formatting.
|
|
10
10
|
- Formats shell scripts out of the box, including `git` hook files.
|
|
11
|
-
-
|
|
11
|
+
- Formats raw HTML fragments in `README.md` and other Markdown documents.
|
|
12
|
+
- Sorts all JSON files, with curated order patterns for common configs like `package.json`, `tsconfig.json`, `.oxlintrc.json`, and more.
|
|
12
13
|
|
|
13
14
|
## Install
|
|
14
15
|
|
|
@@ -50,7 +51,10 @@ ln -s node_modules/@standard-config/prettier/.editorconfig
|
|
|
50
51
|
|
|
51
52
|
## Related
|
|
52
53
|
|
|
53
|
-
- [**@standard-config/
|
|
54
|
+
- [**@standard-config/oxlint**](https://github.com/standard-config/oxlint)
|
|
55
|
+
- [**prettier-plugin-expand-json**](https://github.com/porada/prettier-plugin-expand-json)
|
|
56
|
+
- [**prettier-plugin-markdown-html**](https://github.com/porada/prettier-plugin-markdown-html)
|
|
57
|
+
- [**prettier-plugin-yaml**](https://github.com/porada/prettier-plugin-yaml)
|
|
54
58
|
|
|
55
59
|
## License
|
|
56
60
|
|
package/dist/index.d.mts
CHANGED
|
@@ -10,6 +10,9 @@ type DefaultOptions = {
|
|
|
10
10
|
bracketSpacing?: Options['bracketSpacing'];
|
|
11
11
|
/**
|
|
12
12
|
* Define a custom sort order for JSON files.
|
|
13
|
+
*
|
|
14
|
+
* When using an array, use `*` to place unmatched keys anywhere in the sort
|
|
15
|
+
* order. If the wildcard isn’t present, unmatched keys will be sorted last.
|
|
13
16
|
*/
|
|
14
17
|
jsonSortOrder?: string | string[] | undefined;
|
|
15
18
|
/**
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":["Options","PrettierOptions","PrettierPlugin","NonNullable","PrettierPlugins","DefaultOptions","bracketSpacing","jsonSortOrder","printWidth","quoteProps","shellTabWidth","shellUseTabs","singleQuote","tabWidth","trailingComma","useTabs","StandardOptions","K","IndentationOptions","Pick","ShellIndentationOptions","StandardConfigOverride","excludeFiles","files","options","StandardConfigOverrides","StandardConfigPluginOverrides","Record","StandardConfig","overrides","pluginOverrides"],"sources":["../src/types/index.d.ts","../src/define-config/index.ts","../src/prioritize-keys/index.ts"],"mappings":";;;KAEYE,cAAAA,GAAiBC,WAAAA,CAAYF,OAAAA;AAAAA,KAIpCI,cAAAA;EAJmD;AAET;;;EAO9CC,cAAAA,GAAiBL,OAAAA
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":["Options","PrettierOptions","PrettierPlugin","NonNullable","PrettierPlugins","DefaultOptions","bracketSpacing","jsonSortOrder","printWidth","quoteProps","shellTabWidth","shellUseTabs","singleQuote","tabWidth","trailingComma","useTabs","StandardOptions","K","IndentationOptions","Pick","ShellIndentationOptions","StandardConfigOverride","excludeFiles","files","options","StandardConfigOverrides","StandardConfigPluginOverrides","Record","StandardConfig","overrides","pluginOverrides"],"sources":["../src/types/index.d.ts","../src/define-config/index.ts","../src/prioritize-keys/index.ts"],"mappings":";;;KAEYE,cAAAA,GAAiBC,WAAAA,CAAYF,OAAAA;AAAAA,KAIpCI,cAAAA;EAJmD;AAET;;;EAO9CC,cAAAA,GAAiBL,OAAAA;;;;;;;EAOjBM,aAAAA;;;;;EAKAC,UAAAA,GAAaP,OAAAA;;;;;EAKbQ,UAAAA,GAAaR,OAAAA;;;;;EAKbS,aAAAA,GAAgBT,OAAAA;;;;;EAKhBU,YAAAA,GAAeV,OAAAA;;;;;EAKfW,WAAAA,GAAcX,OAAAA;EAkBY;;;;EAb1BY,QAAAA,GAAWZ,OAAAA;;;;;EAKXa,aAAAA,GAAgBb,OAAAA;EAcC;;;;EATjBc,OAAAA,GAAUd,OAAAA;AAAAA;AAAAA,KAGCe,eAAAA;EAAAA;AAAAA,YAGCf,OAAAA,IAAmBgB,CAAAA,eAAgBZ,cAAAA,WAE5CY,CAAAA,GAAIhB,OAAAA,CAAgBgB,CAAAA,MACpBZ,cAAAA;AAAAA,KASQgB,sBAAAA;EACXC,YAAAA;EACAC,KAAAA;EACAC,OAAAA,EAASR,eAAAA;AAAAA;AAAAA,KAGES,uBAAAA,GAA0BJ,sBAAAA;AAAAA,KAE1BK,6BAAAA,GAAgCC,MAAAA,SAE3CzB,cAAAA;AAAAA,KAGW0B,cAAAA,GAAiBZ,eAAAA;;;;EAI5Ba,SAAAA,GAAYJ,uBAAAA;;;;EAIZK,eAAAA,GAAkBJ,6BAAAA;AAAAA;;;;AA/FnB;;iBCOwB,YAAA,CACvB,MAAA,GAAQ,cAAA,GACN,MAAA;;;;;;iBCNqB,cAAA,CAAA,GAAkB,IAAA,EAAM,aAAA"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
import defineClone from "rfdc";
|
|
2
|
-
import
|
|
3
|
-
import * as pluginExpandJSON from "prettier-plugin-expand-json";
|
|
4
|
-
import * as pluginMarkdownHTML from "prettier-plugin-markdown-html";
|
|
5
|
-
import * as pluginPackageJSON from "prettier-plugin-packagejson";
|
|
6
|
-
import * as pluginShell from "prettier-plugin-sh";
|
|
7
|
-
import * as pluginSortJSON from "prettier-plugin-sort-json";
|
|
8
|
-
import * as pluginYAML from "prettier-plugin-yaml";
|
|
2
|
+
import { fileURLToPath } from "node:url";
|
|
9
3
|
|
|
10
4
|
//#region src/clone/index.ts
|
|
11
5
|
var clone_default = defineClone({ circles: true });
|
|
@@ -29,6 +23,7 @@ function generateConfig(baseDefaults = {}, shellDefaults = {}) {
|
|
|
29
23
|
return clone_default({
|
|
30
24
|
plugins: [
|
|
31
25
|
"@prettier/plugin-oxc",
|
|
26
|
+
"@prettier/plugin-xml",
|
|
32
27
|
"prettier-plugin-expand-json",
|
|
33
28
|
"prettier-plugin-markdown-html",
|
|
34
29
|
"prettier-plugin-sh",
|
|
@@ -131,8 +126,8 @@ function getFileTypeOverrides(baseDefaults = {}, shellDefaults = {}) {
|
|
|
131
126
|
{
|
|
132
127
|
files: ["*.md"],
|
|
133
128
|
options: {
|
|
134
|
-
|
|
135
|
-
|
|
129
|
+
htmlFragmentPrintWidth: Number.POSITIVE_INFINITY,
|
|
130
|
+
htmlFragmentSingleAttributePerLine: true
|
|
136
131
|
}
|
|
137
132
|
},
|
|
138
133
|
{
|
|
@@ -159,22 +154,37 @@ function getFileTypeOverrides(baseDefaults = {}, shellDefaults = {}) {
|
|
|
159
154
|
],
|
|
160
155
|
options: {
|
|
161
156
|
...baseDefaults,
|
|
162
|
-
parser: "
|
|
157
|
+
parser: "xml",
|
|
163
158
|
printWidth: 80,
|
|
164
|
-
singleAttributePerLine: true
|
|
159
|
+
singleAttributePerLine: true,
|
|
160
|
+
xmlQuoteAttributes: "double",
|
|
161
|
+
xmlWhitespaceSensitivity: "ignore"
|
|
165
162
|
}
|
|
166
163
|
},
|
|
167
164
|
{
|
|
168
165
|
files: ["*.yaml", "*.yml"],
|
|
169
166
|
options: {
|
|
170
|
-
|
|
171
|
-
|
|
167
|
+
useTabs: false,
|
|
168
|
+
yamlCollectionStyle: "block"
|
|
172
169
|
}
|
|
173
170
|
}
|
|
174
171
|
];
|
|
175
172
|
}
|
|
176
173
|
function getFileNameOverrides() {
|
|
177
174
|
return [
|
|
175
|
+
{
|
|
176
|
+
files: [
|
|
177
|
+
".oxfmtrc.json",
|
|
178
|
+
".oxfmtrc.jsonc",
|
|
179
|
+
".oxfmtrc.*.json",
|
|
180
|
+
".oxfmtrc.*.jsonc"
|
|
181
|
+
],
|
|
182
|
+
options: { jsonSortOrder: [
|
|
183
|
+
"$schema",
|
|
184
|
+
"*",
|
|
185
|
+
"overrides"
|
|
186
|
+
] }
|
|
187
|
+
},
|
|
178
188
|
(
|
|
179
189
|
/**
|
|
180
190
|
* All `.oxlintrc.json` fields defined by the Oxlint documentation
|
|
@@ -182,10 +192,6 @@ function getFileNameOverrides() {
|
|
|
182
192
|
*/
|
|
183
193
|
{
|
|
184
194
|
files: [
|
|
185
|
-
"oxlintrc.json",
|
|
186
|
-
"oxlintrc.jsonc",
|
|
187
|
-
"oxlintrc.*.json",
|
|
188
|
-
"oxlintrc.*.jsonc",
|
|
189
195
|
".oxlintrc.json",
|
|
190
196
|
".oxlintrc.jsonc",
|
|
191
197
|
".oxlintrc.*.json",
|
|
@@ -321,10 +327,10 @@ function getFileNameOverrides() {
|
|
|
321
327
|
* Deep-merge two Standard Config objects.
|
|
322
328
|
*/
|
|
323
329
|
function mergeConfig(baseConfig, extensionConfig) {
|
|
324
|
-
if (!(
|
|
330
|
+
if (!(isObject(baseConfig) && isObject(extensionConfig))) throw new TypeError("Standard Config error: expected config to be an object");
|
|
325
331
|
const result = clone_default(baseConfig);
|
|
326
332
|
for (const [key, value] of Object.entries(clone_default(extensionConfig))) {
|
|
327
|
-
if (value === void 0) {
|
|
333
|
+
if (value === void 0 || value === null) {
|
|
328
334
|
delete result[key];
|
|
329
335
|
continue;
|
|
330
336
|
}
|
|
@@ -339,6 +345,9 @@ function mergeConfig(baseConfig, extensionConfig) {
|
|
|
339
345
|
function isArray(value) {
|
|
340
346
|
return Array.isArray(value);
|
|
341
347
|
}
|
|
348
|
+
function isObject(value) {
|
|
349
|
+
return typeof value === "object" && value !== null;
|
|
350
|
+
}
|
|
342
351
|
|
|
343
352
|
//#endregion
|
|
344
353
|
//#region src/prioritize-keys/index.ts
|
|
@@ -346,12 +355,16 @@ function isArray(value) {
|
|
|
346
355
|
* @deprecated Use an array value for the `jsonSortOrder` property instead.
|
|
347
356
|
*/
|
|
348
357
|
function prioritizeKeys(...keys) {
|
|
358
|
+
const sortKeys = [...new Set(keys)];
|
|
359
|
+
if (!sortKeys.includes("*")) sortKeys.push("*");
|
|
349
360
|
const order = {};
|
|
350
|
-
for (const key of
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
361
|
+
for (const key of sortKeys) if (key === "*") order[createExclusionKey(sortKeys)] = "lexical";
|
|
362
|
+
else order[key] = null;
|
|
363
|
+
return JSON.stringify(order);
|
|
364
|
+
}
|
|
365
|
+
function createExclusionKey(keys) {
|
|
366
|
+
const escapedGroup = keys.filter((key) => key !== "*").map((key) => key.replaceAll(/[$()*+.?[\\\]^{}|]/g, String.raw`\$&`)).join("|");
|
|
367
|
+
return escapedGroup ? new RegExp(`^(?!(?:${escapedGroup})$).*$`) : /.*/;
|
|
355
368
|
}
|
|
356
369
|
|
|
357
370
|
//#endregion
|
|
@@ -379,13 +392,16 @@ function transformJSONSortOrder(jsonSortOrder) {
|
|
|
379
392
|
}
|
|
380
393
|
function transformPlugins(plugins, pluginOverrides) {
|
|
381
394
|
const pluginMap = {
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
395
|
+
...Object.fromEntries([
|
|
396
|
+
"@prettier/plugin-oxc",
|
|
397
|
+
"@prettier/plugin-xml",
|
|
398
|
+
"prettier-plugin-expand-json",
|
|
399
|
+
"prettier-plugin-markdown-html",
|
|
400
|
+
"prettier-plugin-packagejson",
|
|
401
|
+
"prettier-plugin-sh",
|
|
402
|
+
"prettier-plugin-sort-json",
|
|
403
|
+
"prettier-plugin-yaml"
|
|
404
|
+
].map((name) => [name, transformPlugin(name)])),
|
|
389
405
|
...pluginOverrides
|
|
390
406
|
};
|
|
391
407
|
const resolved = [];
|
|
@@ -395,6 +411,14 @@ function transformPlugins(plugins, pluginOverrides) {
|
|
|
395
411
|
}
|
|
396
412
|
return resolved;
|
|
397
413
|
}
|
|
414
|
+
function transformPlugin(plugin) {
|
|
415
|
+
try {
|
|
416
|
+
return fileURLToPath(import.meta.resolve(plugin));
|
|
417
|
+
} catch {
|
|
418
|
+
/* v8 ignore next -- @preserve */
|
|
419
|
+
return plugin;
|
|
420
|
+
}
|
|
421
|
+
}
|
|
398
422
|
|
|
399
423
|
//#endregion
|
|
400
424
|
//#region src/define-config/index.ts
|
|
@@ -404,11 +428,11 @@ function transformPlugins(plugins, pluginOverrides) {
|
|
|
404
428
|
function defineConfig(config = {}) {
|
|
405
429
|
const { pluginOverrides, shellTabWidth, shellUseTabs, tabWidth, useTabs, ...extensionConfig } = config;
|
|
406
430
|
return transformConfig(mergeConfig(generateConfig({
|
|
407
|
-
|
|
408
|
-
|
|
431
|
+
tabWidth,
|
|
432
|
+
useTabs
|
|
409
433
|
}, {
|
|
410
|
-
|
|
411
|
-
|
|
434
|
+
shellTabWidth,
|
|
435
|
+
shellUseTabs
|
|
412
436
|
}), extensionConfig), pluginOverrides);
|
|
413
437
|
}
|
|
414
438
|
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["clone","clone","clone"],"sources":["../src/clone/index.ts","../src/generate-config/index.ts","../src/merge-config/index.ts","../src/prioritize-keys/index.ts","../src/transform-config/index.ts","../src/define-config/index.ts"],"sourcesContent":["import defineClone from 'rfdc';\n\nexport default defineClone({ circles: true });\n","import type {\n\tIndentationOptions,\n\tShellIndentationOptions,\n\tStandardConfig,\n\tStandardConfigOverrides,\n} from '../types/index.d.ts';\nimport clone from '../clone/index.ts';\n\n/**\n * Generate the base Standard Config.\n *\n * Shell scripts can’t be reliably identified by name alone—they’re recognized\n * by 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 (`baseDefaults`). `generateConfig`\n * is a factory that encapsulates this logic and returns the final config.\n */\nexport default function generateConfig(\n\tbaseDefaults: IndentationOptions = {},\n\tshellDefaults: ShellIndentationOptions = {}\n): StandardConfig {\n\tconst { tabWidth = 4, useTabs = true } = baseDefaults;\n\tconst { shellTabWidth = 2, shellUseTabs = false } = shellDefaults;\n\n\treturn clone({\n\t\tplugins: [\n\t\t\t'@prettier/plugin-oxc',\n\t\t\t'prettier-plugin-expand-json',\n\t\t\t'prettier-plugin-markdown-html',\n\t\t\t'prettier-plugin-sh',\n\t\t\t'prettier-plugin-yaml',\n\t\t],\n\t\tbracketSpacing: true,\n\t\tprintWidth: 80,\n\t\tquoteProps: 'consistent',\n\t\tsingleQuote: true,\n\t\ttabWidth: shellTabWidth,\n\t\ttrailingComma: 'es5',\n\t\tuseTabs: shellUseTabs,\n\t\toverrides: [\n\t\t\t...getFileTypeOverrides(\n\t\t\t\t{ tabWidth, useTabs },\n\t\t\t\t{ tabWidth: shellTabWidth, useTabs: shellUseTabs }\n\t\t\t),\n\t\t\t...getFileNameOverrides(),\n\t\t],\n\t});\n}\n\nfunction getFileTypeOverrides(\n\tbaseDefaults: IndentationOptions = {},\n\tshellDefaults: IndentationOptions = {}\n): StandardConfigOverrides {\n\treturn [\n\t\t{\n\t\t\tfiles: ['*.css', '*.scss'],\n\t\t\toptions: {\n\t\t\t\t...baseDefaults,\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\tfiles: ['*.graphql', '*.graphqls', '*.gql'],\n\t\t\toptions: {\n\t\t\t\t...baseDefaults,\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...baseDefaults,\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...baseDefaults,\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...baseDefaults,\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: [\n\t\t\t\t\t'prettier-plugin-sort-json',\n\t\t\t\t\t'prettier-plugin-expand-json',\n\t\t\t\t],\n\t\t\t\tjsonRecursiveSort: true,\n\t\t\t\tjsonSortOrder: ['$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...baseDefaults,\n\t\t\t\tuseTabs: false,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tfiles: ['*.md'],\n\t\t\toptions: {\n\t\t\t\tprintWidth: Number.POSITIVE_INFINITY,\n\t\t\t\tsingleAttributePerLine: true,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tfiles: ['*.sh'],\n\t\t\toptions: {\n\t\t\t\t...shellDefaults,\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...baseDefaults,\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...baseDefaults,\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: ['*.yaml', '*.yml'],\n\t\t\toptions: {\n\t\t\t\tyamlCollectionStyle: 'block',\n\t\t\t\tuseTabs: false,\n\t\t\t},\n\t\t},\n\t];\n}\n\nfunction getFileNameOverrides(): StandardConfigOverrides {\n\treturn [\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: [\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 * By default, Prettier uses a different parser for `package.json`\n\t\t * files, which causes most JSON plugins to skip them entirely.\n\t\t * This override ensures `package.json` is treated (and sorted)\n\t\t * like any other `*.json` file.\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: [\n\t\t\t\t\t'prettier-plugin-packagejson',\n\t\t\t\t\t'prettier-plugin-expand-json',\n\t\t\t\t],\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: [\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\t{\n\t\t\tfiles: ['.vscode/mcp.json'],\n\t\t\toptions: {\n\t\t\t\tjsonSortOrder: ['$schema', 'command'],\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tfiles: ['.vscode/sessions.json'],\n\t\t\toptions: {\n\t\t\t\tjsonSortOrder: ['$schema', 'name', 'commands', 'active'],\n\t\t\t},\n\t\t},\n\t];\n}\n","import type { StandardConfig } from '../types/index.d.ts';\nimport clone from '../clone/index.ts';\n\n/**\n * Deep-merge two Standard Config objects.\n */\nexport default function mergeConfig(\n\tbaseConfig: StandardConfig,\n\textensionConfig: StandardConfig\n): StandardConfig {\n\tif (\n\t\t!(typeof baseConfig === 'object' && typeof extensionConfig === 'object')\n\t) {\n\t\tthrow new TypeError(\n\t\t\t'Standard 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","/**\n * @deprecated Use an array value for the `jsonSortOrder` property instead.\n */\nexport 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 as PrettierConfig } from 'prettier';\nimport type {\n\tPrettierPlugins,\n\tStandardConfig,\n\tStandardConfigPluginOverrides,\n\tStandardOptions,\n} from '../types/index.d.ts';\nimport * as pluginOxidation from '@prettier/plugin-oxc';\nimport * as pluginExpandJSON from 'prettier-plugin-expand-json';\nimport * as pluginMarkdownHTML from 'prettier-plugin-markdown-html';\nimport * as pluginPackageJSON from 'prettier-plugin-packagejson';\nimport * as pluginShell from 'prettier-plugin-sh';\nimport * as pluginSortJSON from 'prettier-plugin-sort-json';\nimport * as pluginYAML from 'prettier-plugin-yaml';\nimport clone from '../clone/index.ts';\nimport prioritizeKeys from '../prioritize-keys/index.ts';\n\n/**\n * Convert Standard Config to an exportable, Prettier-compatible format.\n */\nexport default function transformConfig(\n\tconfig: StandardConfig,\n\tpluginOverrides: StandardConfigPluginOverrides = {}\n): PrettierConfig {\n\t/* oxlint-disable-next-line eslint/no-param-reassign */\n\tconfig = clone(config);\n\n\tconst transform = (options: StandardOptions) => {\n\t\tif (options.jsonSortOrder) {\n\t\t\toptions.jsonSortOrder = transformJSONSortOrder(\n\t\t\t\toptions.jsonSortOrder\n\t\t\t);\n\t\t}\n\n\t\tif (options.plugins) {\n\t\t\tconst plugins = transformPlugins(options.plugins, pluginOverrides);\n\n\t\t\tif (plugins.length > 0) {\n\t\t\t\toptions.plugins = plugins;\n\t\t\t} else {\n\t\t\t\tdelete options.plugins;\n\t\t\t}\n\t\t}\n\t};\n\n\ttransform(config);\n\n\tif (config.overrides) {\n\t\tfor (const override of config.overrides) {\n\t\t\ttransform(override.options);\n\t\t}\n\t}\n\n\treturn config as PrettierConfig;\n}\n\nfunction transformJSONSortOrder(jsonSortOrder: string | string[]): string {\n\tif (Array.isArray(jsonSortOrder)) {\n\t\treturn prioritizeKeys(...jsonSortOrder);\n\t}\n\n\treturn jsonSortOrder;\n}\n\nfunction transformPlugins(\n\tplugins: PrettierPlugins,\n\tpluginOverrides: StandardConfigPluginOverrides\n): PrettierPlugins {\n\tconst pluginMap: StandardConfigPluginOverrides = {\n\t\t'@prettier/plugin-oxc': pluginOxidation,\n\t\t'prettier-plugin-expand-json': pluginExpandJSON,\n\t\t'prettier-plugin-markdown-html': pluginMarkdownHTML,\n\t\t'prettier-plugin-packagejson': pluginPackageJSON,\n\t\t'prettier-plugin-sh': pluginShell,\n\t\t'prettier-plugin-sort-json': pluginSortJSON,\n\t\t'prettier-plugin-yaml': pluginYAML,\n\t\t...pluginOverrides,\n\t};\n\n\tconst resolved: PrettierPlugins = [];\n\n\tfor (const plugin of plugins) {\n\t\tconst resolvedPlugin =\n\t\t\ttypeof plugin === 'string' && Object.hasOwn(pluginMap, plugin)\n\t\t\t\t? pluginMap[plugin]\n\t\t\t\t: plugin;\n\n\t\tif (resolvedPlugin) {\n\t\t\tresolved.push(resolvedPlugin);\n\t\t}\n\t}\n\n\treturn resolved;\n}\n","import type { Config as PrettierConfig } from 'prettier';\nimport type { StandardConfig } from '../types/index.d.ts';\nimport generateConfig from '../generate-config/index.ts';\nimport mergeConfig from '../merge-config/index.ts';\nimport transformConfig from '../transform-config/index.ts';\n\n/**\n * Combine Standard Config with optional config overrides.\n */\nexport default function defineConfig(\n\tconfig: StandardConfig = {}\n): PrettierConfig {\n\tconst {\n\t\tpluginOverrides,\n\t\tshellTabWidth,\n\t\tshellUseTabs,\n\t\ttabWidth,\n\t\tuseTabs,\n\t\t...extensionConfig\n\t} = config;\n\n\tconst baseConfig = generateConfig(\n\t\t{ useTabs, tabWidth },\n\t\t{ shellUseTabs, shellTabWidth }\n\t);\n\n\tconst extendedConfig = mergeConfig(baseConfig, extensionConfig);\n\n\treturn transformConfig(extended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ACH,SAAS;IACT;GACD;EACD;GACC,OAAO,CAAC,OAAO;GACf,SAAS;IACR,YAAY,OAAO;IACnB,wBAAwB;IACxB;GACD;EACD;GACC,OAAO,CAAC,OAAO;GACf,SAAS,EACR,GAAG,eACH;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,CAAC,UAAU,QAAQ;GAC1B,SAAS;IACR,qBAAqB;IACrB,SAAS;IACT;GACD;EACD;;AAGF,SAAS,uBAAgD;AACxD,QAAO;;;;;;EAKN;GACC,OAAO;IACN;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;GACD,SAAS,EACR,eAAe;IACd;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,EACD;GACD;;;;;;;;;;;EAUD;GACC,OAAO,CAAC,eAAe;GACvB,SAAS;IACR,SAAS,CACR,+BACA,8BACA;IACD,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;;;;;;EAKD;GACC,OAAO;IACN;IACA;IACA;IACA;IACA;GACD,SAAS,EACR,eAAe;IACd;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,EACD;GACD;EACD;GACC,OAAO,CAAC,mBAAmB;GAC3B,SAAS,EACR,eAAe,CAAC,WAAW,UAAU,EACrC;GACD;EACD;GACC,OAAO,CAAC,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O,eAAe,GAAG,cAAc;AAGxC,QAAO;;AAGR,SAAS,iBACR,SACA,iBACkB;CAClB,MAAM,YAA2C;EAChD,wBAAwB;EACxB,+BAA+B;EAC/B,iCAAiC;EACjC,+BAA+B;EAC/B,sBAAsB;EACtB,6BAA6B;EAC7B,wBAAwB;EACxB,GAAG;EACH;CAED,MAAM,WAA4B,EAAE;AAEpC,MAAK,MAAM,UAAU,SAAS;EAC7B,MAAM,iBACL,OAAO,WAAW,YAAY,OAAO,OAAO,WAAW,OAAO,GAC3D,UAAU,UACV;AAEJ,MAAI,eACH,UAAS,KAAK,eAAe;;AAI/B,QAAO;;;;;;;;ACnFR,SAAwB,aACvB,SAAyB,EAAE,EACV;CACjB,MAAM,EACL,iBACA,eACA,cACA,UACA,SACA,GAAG,oBACA;AASJ,QAAO,gBAFgB,YALJ,eAClB;EAAE;EAAS;EAAU,EACrB;EAAE;EAAc;EAAe,CAC/B,EAE8C,gBAAgB,EAExB,gBAAgB"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["clone","clone","clone"],"sources":["../src/clone/index.ts","../src/generate-config/index.ts","../src/merge-config/index.ts","../src/prioritize-keys/index.ts","../src/transform-config/index.ts","../src/define-config/index.ts"],"sourcesContent":["import defineClone from 'rfdc';\n\nexport default defineClone({ circles: true });\n","import type {\n\tIndentationOptions,\n\tShellIndentationOptions,\n\tStandardConfig,\n\tStandardConfigOverrides,\n} from '../types/index.d.ts';\nimport clone from '../clone/index.ts';\n\n/**\n * Generate the base Standard Config.\n *\n * Shell scripts can’t be reliably identified by name alone—they’re recognized\n * by 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 (`baseDefaults`). `generateConfig`\n * is a factory that encapsulates this logic and returns the final config.\n */\nexport default function generateConfig(\n\tbaseDefaults: IndentationOptions = {},\n\tshellDefaults: ShellIndentationOptions = {}\n): StandardConfig {\n\tconst { tabWidth = 4, useTabs = true } = baseDefaults;\n\tconst { shellTabWidth = 2, shellUseTabs = false } = shellDefaults;\n\n\treturn clone({\n\t\tplugins: [\n\t\t\t'@prettier/plugin-oxc',\n\t\t\t'@prettier/plugin-xml',\n\t\t\t'prettier-plugin-expand-json',\n\t\t\t'prettier-plugin-markdown-html',\n\t\t\t'prettier-plugin-sh',\n\t\t\t'prettier-plugin-yaml',\n\t\t],\n\t\tbracketSpacing: true,\n\t\tprintWidth: 80,\n\t\tquoteProps: 'consistent',\n\t\tsingleQuote: true,\n\t\ttabWidth: shellTabWidth,\n\t\ttrailingComma: 'es5',\n\t\tuseTabs: shellUseTabs,\n\t\toverrides: [\n\t\t\t...getFileTypeOverrides(\n\t\t\t\t{ tabWidth, useTabs },\n\t\t\t\t{ tabWidth: shellTabWidth, useTabs: shellUseTabs }\n\t\t\t),\n\t\t\t...getFileNameOverrides(),\n\t\t],\n\t});\n}\n\nfunction getFileTypeOverrides(\n\tbaseDefaults: IndentationOptions = {},\n\tshellDefaults: IndentationOptions = {}\n): StandardConfigOverrides {\n\treturn [\n\t\t{\n\t\t\tfiles: ['*.css', '*.scss'],\n\t\t\toptions: {\n\t\t\t\t...baseDefaults,\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\tfiles: ['*.graphql', '*.graphqls', '*.gql'],\n\t\t\toptions: {\n\t\t\t\t...baseDefaults,\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...baseDefaults,\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...baseDefaults,\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...baseDefaults,\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: [\n\t\t\t\t\t'prettier-plugin-sort-json',\n\t\t\t\t\t'prettier-plugin-expand-json',\n\t\t\t\t],\n\t\t\t\tjsonRecursiveSort: true,\n\t\t\t\tjsonSortOrder: ['$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...baseDefaults,\n\t\t\t\tuseTabs: false,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tfiles: ['*.md'],\n\t\t\toptions: {\n\t\t\t\thtmlFragmentPrintWidth: Number.POSITIVE_INFINITY,\n\t\t\t\thtmlFragmentSingleAttributePerLine: true,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tfiles: ['*.sh'],\n\t\t\toptions: {\n\t\t\t\t...shellDefaults,\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...baseDefaults,\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...baseDefaults,\n\t\t\t\tparser: 'xml',\n\t\t\t\tprintWidth: 80,\n\t\t\t\tsingleAttributePerLine: true,\n\t\t\t\txmlQuoteAttributes: 'double',\n\t\t\t\txmlWhitespaceSensitivity: 'ignore',\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tfiles: ['*.yaml', '*.yml'],\n\t\t\toptions: {\n\t\t\t\tuseTabs: false,\n\t\t\t\tyamlCollectionStyle: 'block',\n\t\t\t},\n\t\t},\n\t];\n}\n\nfunction getFileNameOverrides(): StandardConfigOverrides {\n\treturn [\n\t\t{\n\t\t\tfiles: [\n\t\t\t\t'.oxfmtrc.json',\n\t\t\t\t'.oxfmtrc.jsonc',\n\t\t\t\t'.oxfmtrc.*.json',\n\t\t\t\t'.oxfmtrc.*.jsonc',\n\t\t\t],\n\t\t\toptions: {\n\t\t\t\tjsonSortOrder: ['$schema', '*', 'overrides'],\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],\n\t\t\toptions: {\n\t\t\t\tjsonSortOrder: [\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 * By default, Prettier uses a different parser for `package.json`\n\t\t * files, which causes most JSON plugins to skip them entirely.\n\t\t * This override ensures `package.json` is treated (and sorted)\n\t\t * like any other `*.json` file.\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: [\n\t\t\t\t\t'prettier-plugin-packagejson',\n\t\t\t\t\t'prettier-plugin-expand-json',\n\t\t\t\t],\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: [\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\t{\n\t\t\tfiles: ['.vscode/mcp.json'],\n\t\t\toptions: {\n\t\t\t\tjsonSortOrder: ['$schema', 'command'],\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tfiles: ['.vscode/sessions.json'],\n\t\t\toptions: {\n\t\t\t\tjsonSortOrder: ['$schema', 'name', 'commands', 'active'],\n\t\t\t},\n\t\t},\n\t];\n}\n","import type { StandardConfig } from '../types/index.d.ts';\nimport clone from '../clone/index.ts';\n\n/**\n * Deep-merge two Standard Config objects.\n */\nexport default function mergeConfig(\n\tbaseConfig: StandardConfig,\n\textensionConfig: StandardConfig\n): StandardConfig {\n\tif (!(isObject(baseConfig) && isObject(extensionConfig))) {\n\t\tthrow new TypeError(\n\t\t\t'Standard 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 || value === null) {\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\nfunction isObject(value: unknown): value is Record<string, unknown> {\n\treturn typeof value === 'object' && value !== null;\n}\n","import type { CategorySort } from 'prettier-plugin-sort-json';\n\n/**\n * @deprecated Use an array value for the `jsonSortOrder` property instead.\n */\nexport default function prioritizeKeys(...keys: ReadonlyArray<string>): string {\n\tconst sortKeys = [...new Set(keys)];\n\n\tif (!sortKeys.includes('*')) {\n\t\tsortKeys.push('*');\n\t}\n\n\t/* oxlint-disable-next-line typescript/no-restricted-types */\n\tconst order: Record<any, CategorySort | null> = {};\n\n\tfor (const key of sortKeys) {\n\t\tif (key === '*') {\n\t\t\t/* oxlint-disable-next-line typescript/no-unsafe-member-access */\n\t\t\torder[createExclusionKey(sortKeys) as any] = 'lexical';\n\t\t} else {\n\t\t\torder[key] = null;\n\t\t}\n\t}\n\n\treturn JSON.stringify(order);\n}\n\nfunction createExclusionKey(keys: ReadonlyArray<string>) {\n\tconst escapedGroup = keys\n\t\t.filter((key) => key !== '*')\n\t\t.map((key) => key.replaceAll(/[$()*+.?[\\\\\\]^{}|]/g, String.raw`\\$&`))\n\t\t.join('|');\n\n\treturn escapedGroup ? new RegExp(`^(?!(?:${escapedGroup})$).*$`) : /.*/;\n}\n","import type { Config as PrettierConfig } from 'prettier';\nimport type {\n\tPrettierPlugins,\n\tStandardConfig,\n\tStandardConfigPluginOverrides,\n\tStandardOptions,\n} from '../types/index.d.ts';\nimport { fileURLToPath } from 'node:url';\nimport clone from '../clone/index.ts';\nimport prioritizeKeys from '../prioritize-keys/index.ts';\n\n/**\n * Convert Standard Config to an exportable, Prettier-compatible format.\n */\nexport default function transformConfig(\n\tconfig: StandardConfig,\n\tpluginOverrides: StandardConfigPluginOverrides = {}\n): PrettierConfig {\n\t/* oxlint-disable-next-line eslint/no-param-reassign */\n\tconfig = clone(config);\n\n\tconst transform = (options: StandardOptions) => {\n\t\tif (options.jsonSortOrder) {\n\t\t\toptions.jsonSortOrder = transformJSONSortOrder(\n\t\t\t\toptions.jsonSortOrder\n\t\t\t);\n\t\t}\n\n\t\tif (options.plugins) {\n\t\t\tconst plugins = transformPlugins(options.plugins, pluginOverrides);\n\n\t\t\tif (plugins.length > 0) {\n\t\t\t\toptions.plugins = plugins;\n\t\t\t} else {\n\t\t\t\tdelete options.plugins;\n\t\t\t}\n\t\t}\n\t};\n\n\ttransform(config);\n\n\tif (config.overrides) {\n\t\tfor (const override of config.overrides) {\n\t\t\ttransform(override.options);\n\t\t}\n\t}\n\n\treturn config as PrettierConfig;\n}\n\nfunction transformJSONSortOrder(jsonSortOrder: string | string[]): string {\n\tif (Array.isArray(jsonSortOrder)) {\n\t\treturn prioritizeKeys(...jsonSortOrder);\n\t}\n\n\treturn jsonSortOrder;\n}\n\nfunction transformPlugins(\n\tplugins: PrettierPlugins,\n\tpluginOverrides: StandardConfigPluginOverrides\n): PrettierPlugins {\n\tconst pluginMap: StandardConfigPluginOverrides = {\n\t\t...Object.fromEntries(\n\t\t\t[\n\t\t\t\t'@prettier/plugin-oxc',\n\t\t\t\t'@prettier/plugin-xml',\n\t\t\t\t'prettier-plugin-expand-json',\n\t\t\t\t'prettier-plugin-markdown-html',\n\t\t\t\t'prettier-plugin-packagejson',\n\t\t\t\t'prettier-plugin-sh',\n\t\t\t\t'prettier-plugin-sort-json',\n\t\t\t\t'prettier-plugin-yaml',\n\t\t\t].map((name) => [name, transformPlugin(name)])\n\t\t),\n\t\t...pluginOverrides,\n\t};\n\n\tconst resolved: PrettierPlugins = [];\n\n\tfor (const plugin of plugins) {\n\t\tconst resolvedPlugin =\n\t\t\ttypeof plugin === 'string' && Object.hasOwn(pluginMap, plugin)\n\t\t\t\t? pluginMap[plugin]\n\t\t\t\t: plugin;\n\n\t\tif (resolvedPlugin) {\n\t\t\tresolved.push(resolvedPlugin);\n\t\t}\n\t}\n\n\treturn resolved;\n}\n\nfunction transformPlugin(plugin: string): string {\n\ttry {\n\t\treturn fileURLToPath(import.meta.resolve(plugin));\n\t} catch {\n\t\t/* v8 ignore next -- @preserve */\n\t\treturn plugin;\n\t}\n}\n","import type { Config as PrettierConfig } from 'prettier';\nimport type { StandardConfig } from '../types/index.d.ts';\nimport generateConfig from '../generate-config/index.ts';\nimport mergeConfig from '../merge-config/index.ts';\nimport transformConfig from '../transform-config/index.ts';\n\n/**\n * Combine Standard Config with optional config overrides.\n */\nexport default function defineConfig(\n\tconfig: StandardConfig = {}\n): PrettierConfig {\n\tconst {\n\t\tpluginOverrides,\n\t\tshellTabWidth,\n\t\tshellUseTabs,\n\t\ttabWidth,\n\t\tuseTabs,\n\t\t...extensionConfig\n\t} = config;\n\n\tconst baseConfig = generateConfig(\n\t\t{ tabWidth, useTabs },\n\t\t{ shellTabWidth, shellUseTabs }\n\t);\n\n\tconst extendedConfig = mergeConfig(baseConfig, extensionConfig);\n\treturn transformConfig(extendedConfig, pluginOverrides);\n}\n"],"mappings":";;;;AAEA,oBAAe,YAAY,EAAE,SAAS,MAAM,CAAC;;;;;;;;;;;;;;;ACiB7C,SAAwB,eACvB,eAAmC,EAAE,EACrC,gBAAyC,EAAE,EAC1B;CACjB,MAAM,EAAE,WAAW,GAAG,UAAU,SAAS;CACzC,MAAM,EAAE,gBAAgB,GAAG,eAAe,UAAU;AAEpD,QAAOA,cAAM;EACZ,SAAS;GACR;GACA;GACA;GACA;GACA;GACA;GACA;EACD,gBAAgB;EAChB,YAAY;EACZ,YAAY;EACZ,aAAa;EACb,UAAU;EACV,eAAe;EACf,SAAS;EACT,WAAW,CACV,GAAG,qBACF;GAAE;GAAU;GAAS,EACrB;GAAE,UAAU;GAAe,SAAS;GAAc,CAClD,EACD,GAAG,sBAAsB,CACzB;EACD,CAAC;;AAGH,SAAS,qBACR,eAAmC,EAAE,EACrC,gBAAoC,EAAE,EACZ;AAC1B,QAAO;EACN;GACC,OAAO,CAAC,SAAS,SAAS;GAC1B,SAAS;IACR,GAAG;IACH,YAAY;IACZ,aAAa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SAAS,EACR,eAAe;IACd;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,EACD;GACD;;;;;;;;;;;EAUD;GACC,OAAO,CAAC,eAAe;GACvB,SAAS;IACR,SAAS,CACR,+BACA,8BACA;IACD,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;;;;;;EAKD;GACC,OAAO;IACN;IACA;IACA;IACA;IACA;GACD,SAAS,EACR,eAAe;IACd;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,EACD;GACD;EACD;GACC,OAAO,CAAC,mBAAmB;GAC3B,SAAS,EACR,eAAe,CAAC,WAAW,UAAU,EACrC;GACD;EACD;GACC,OAAO,CAAC,wBAAwB;GAChC,SAAS,EACR,eAAe;IAAC;IAAW;IAAQ;IAAY;IAAS,EACxD;GACD;EACD;;;;;;;;AClTF,SAAwB,YACvB,YACA,iBACiB;AACjB,KAAI,EAAE,SAAS,WAAW,IAAI,SAAS,gBAAgB,EACtD,OAAM,IAAI,UACT,yDACA;CAGF,MAAM,SAASC,cAAM,WAAW;AAEhC,MAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQA,cAAM,gBAAgB,CAAC,EAAE;AAClE,MAAI,UAAU,UAAa,UAAU,MAAM;AAE1C,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,M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ACA;GACA;GACA;GACA,CAAC,KAAK,SAAS,CAAC,MAAM,gBAAgB,KAAK,CAAC,CAAC,CAC9C;EACD,GAAG;EACH;CAED,MAAM,WAA4B,EAAE;AAEpC,MAAK,MAAM,UAAU,SAAS;EAC7B,MAAM,iBACL,OAAO,WAAW,YAAY,OAAO,OAAO,WAAW,OAAO,GAC3D,UAAU,UACV;AAEJ,MAAI,eACH,UAAS,KAAK,eAAe;;AAI/B,QAAO;;AAGR,SAAS,gBAAgB,QAAwB;AAChD,KAAI;AACH,SAAO,cAAc,OAAO,KAAK,QAAQ,OAAO,CAAC;SAC1C;;AAEP,SAAO;;;;;;;;;AC1FT,SAAwB,aACvB,SAAyB,EAAE,EACV;CACjB,MAAM,EACL,iBACA,eACA,cACA,UACA,SACA,GAAG,oBACA;AAQJ,QAAO,gBADgB,YALJ,eAClB;EAAE;EAAU;EAAS,EACrB;EAAE;EAAe;EAAc,CAC/B,EAE8C,gBAAgB,EACxB,gBAAgB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@standard-config/prettier",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.0",
|
|
4
4
|
"description": "TypeScript-first Prettier config",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
"keywords": [
|
|
16
16
|
"json-sorting",
|
|
17
17
|
"oxc",
|
|
18
|
+
"prettier",
|
|
18
19
|
"prettier-config",
|
|
19
20
|
"standard-config",
|
|
20
21
|
"typescript"
|
|
@@ -32,41 +33,44 @@
|
|
|
32
33
|
},
|
|
33
34
|
"dependencies": {
|
|
34
35
|
"@prettier/plugin-oxc": "^0.1.3",
|
|
36
|
+
"@prettier/plugin-xml": "^3.4.2",
|
|
35
37
|
"prettier-plugin-expand-json": "^1.0.4",
|
|
36
|
-
"prettier-plugin-markdown-html": "^1.
|
|
38
|
+
"prettier-plugin-markdown-html": "^1.1.0",
|
|
37
39
|
"prettier-plugin-packagejson": "^3.0.0",
|
|
38
40
|
"prettier-plugin-sh": "^0.18.0",
|
|
39
41
|
"prettier-plugin-sort-json": "^4.2.0",
|
|
40
|
-
"prettier-plugin-yaml": "^1.1.
|
|
42
|
+
"prettier-plugin-yaml": "^1.1.2",
|
|
41
43
|
"rfdc": "^1.4.1"
|
|
42
44
|
},
|
|
43
45
|
"peerDependencies": {
|
|
44
46
|
"prettier": ">=3.7"
|
|
45
47
|
},
|
|
46
48
|
"devDependencies": {
|
|
47
|
-
"@standard-config/eslint": "1.
|
|
49
|
+
"@standard-config/eslint": "1.3.0",
|
|
50
|
+
"@standard-config/oxlint": "1.0.1",
|
|
48
51
|
"@standard-config/tsconfig": "2.0.2",
|
|
52
|
+
"@types/node": "22.19.9",
|
|
49
53
|
"@vitest/coverage-v8": "4.0.18",
|
|
50
54
|
"eslint": "9.39.2",
|
|
51
55
|
"husky": "9.1.7",
|
|
52
56
|
"jiti": "2.6.1",
|
|
53
|
-
"oxlint": "1.
|
|
57
|
+
"oxlint": "1.43.0",
|
|
54
58
|
"oxlint-tsgolint": "0.11.4",
|
|
55
59
|
"prettier": "3.8.1",
|
|
56
60
|
"publint": "0.3.17",
|
|
57
|
-
"tsdown": "0.20.
|
|
61
|
+
"tsdown": "0.20.3",
|
|
58
62
|
"typescript": "5.9.3",
|
|
59
63
|
"vitest": "4.0.18"
|
|
60
64
|
},
|
|
61
65
|
"scripts": {
|
|
62
66
|
"build": "tsdown",
|
|
63
|
-
"fix": "pnpm format && pnpm lint",
|
|
67
|
+
"fix": "pnpm format && pnpm lint && pnpm format",
|
|
64
68
|
"fixtures:scramble": "prettier --config fixtures/config.ts --write fixtures && sleep 1",
|
|
65
69
|
"fixtures:unscramble": "pnpm prettier --write fixtures && sleep 1",
|
|
66
|
-
"format": "prettier --
|
|
70
|
+
"format": "prettier --ignore-unknown --log-level=warn --write .",
|
|
67
71
|
"format:check": "prettier --check --ignore-unknown .",
|
|
68
|
-
"lint": "oxlint --fix --type-aware --type-check
|
|
69
|
-
"lint:check": "oxlint --
|
|
72
|
+
"lint": "oxlint --fix --report-unused-disable-directives --type-aware --type-check && eslint --fix .",
|
|
73
|
+
"lint:check": "oxlint --deny-warnings --report-unused-disable-directives --type-aware --type-check && eslint .",
|
|
70
74
|
"test": "vitest run",
|
|
71
75
|
"test:fixtures": "pnpm run '/^fixtures:/' && git diff --exit-code fixtures",
|
|
72
76
|
"typecheck": "tsc --noEmit"
|