Skip to content

Commit c90b4e4

Browse files
Removed support for the "--config-precedence" option
1 parent f10950b commit c90b4e4

File tree

5 files changed

+7
-23
lines changed

5 files changed

+7
-23
lines changed

src/bin.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,6 @@ const makeBin = (): Bin => {
118118
.option("--config-path <path>", "Path to a Prettier configuration file (.prettierrc, package.json, prettier.config.js)", {
119119
section: "Config",
120120
})
121-
.option("--config-precedence <cli-override|file-override>", 'Define in which order config files and CLI options should be evaluated.\nDefaults to "cli-override"', {
122-
section: "Config",
123-
enum: ["cli-override", "file-override"],
124-
})
125121
.option("--no-editorconfig", "Don't take .editorconfig into account when parsing configuration", {
126122
section: "Config",
127123
default: true,
@@ -304,8 +300,8 @@ const makeWarnedPluggableBin = async (): Promise<Bin> => {
304300
exit('The "--find-config-path" is not currently supported, please open an issue on GitHub if you need it');
305301
}
306302

307-
if (args["config-precedence"] === "prefer-file") {
308-
exit('The "prefer-file" value for "--config-precedence" is not currently supported, please open an issue on GitHub if you need it');
303+
if (args["config-precedence"]) {
304+
exit('The "config-precedence" option is not currently supported, please open an issue on GitHub if you need it');
309305
}
310306

311307
if (args["file-info"]) {

src/prettier_serial.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,11 @@ async function format(
3838
formatOptions = await resolve(formatOptions);
3939
const pluginsBuiltin = await getPluginsBuiltin();
4040
const plugins = await getPluginsOrExit(formatOptions.plugins || []);
41-
const pluginsOverride = contextOptions.configPrecedence !== "file-override";
4241

4342
const options = {
4443
...pluginsDefaultOptions,
45-
...(pluginsOverride ? formatOptions : pluginsCustomOptions),
46-
...(pluginsOverride ? pluginsCustomOptions : formatOptions),
44+
...formatOptions,
45+
...pluginsCustomOptions,
4746
...contextOptions,
4847
filepath: filePath,
4948
plugins: [...pluginsBuiltin, ...plugins],

src/types.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
type Bin = ReturnType<typeof import("tiny-bin").default>;
22

33
type ContextOptions = {
4-
configPrecedence?: "cli-override" | "file-override";
54
cursorOffset?: number;
65
rangeEnd?: number;
76
rangeStart?: number;

src/utils.ts

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,9 @@ function getGlobPaths(rootPath: string, globs: string[], withNodeModules: boolea
111111
}
112112

113113
async function getModule<T = unknown>(modulePath: string): Promise<T> {
114-
const moduleExports = await import(url.pathToFileURL(modulePath).href);
115-
const module = moduleExports.default || moduleExports.exports || moduleExports;
116-
return module;
114+
const moduleExports = await import(url.pathToFileURL(modulePath).href);
115+
const module = moduleExports.default || moduleExports.exports || moduleExports;
116+
return module;
117117
}
118118

119119
function getModulePath(name: string, rootPath: string): string {
@@ -420,13 +420,6 @@ function normalizeContextOptions(options: unknown): ContextOptions {
420420

421421
const contextOptions: ContextOptions = {};
422422

423-
if ("configPrecedence" in options) {
424-
const value = options.configPrecedence;
425-
if (isString(value) && (value === "cli-override" || value === "file-override")) {
426-
contextOptions.configPrecedence = value;
427-
}
428-
}
429-
430423
if ("cursorOffset" in options) {
431424
const value = Number(options.cursorOffset);
432425
if (isInteger(value) && value >= 0) {

test/__tests__/__snapshots__/early-exit.js.snap

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,6 @@ exports[`show usage with --help shows help text 1`] = `
8383
8484
--no-config Do not look for a configuration file
8585
--config-path <path> Path to a Prettier configuration file (.prettierrc, package.json, prettier.config.js)
86-
--config-precedence <cli-override|file-override>
87-
Define in which order config files and CLI options should be evaluated.
88-
Defaults to "cli-override"
8986
--no-editorconfig Don't take .editorconfig into account when parsing configuration
9087
--no-ignore Do not look for an ignore file
9188
--ignore-path <path...> Path to a file with patterns describing files to ignore

0 commit comments

Comments
 (0)