prettier/prettier

--range-{start,end} is ignored for --config-precedence=prefer-file

Open

#13354 opened on Aug 24, 2022

View on GitHub
 (7 comments) (0 reactions) (0 assignees)JavaScript (51,868 stars) (4,716 forks)batch import
area:cliarea:rangeshelp wantedtype:editor support

Description

Environments:

  • Prettier Version: 2.3.0
  • Running Prettier via: CLI
  • Runtime: v16
  • Operating System: Linux, macOS
  • Prettier plugins (if any):

Steps to reproduce:

  • Create file file.js
import {  a }  from 'a'  ;

import {b,  c  } from  'b-c';
  • Create file .prettierrc.js
module.exports = {}
  • Run cat file.js | prettier --stdin-filepath file.js --config-precedence=file-override --range-start 9 --range-end 10
import { a } from "a";

import {b,  c  } from  'b-c';
  • Run cat file.js | prettier --stdin-filepath file.js --config-precedence=prefer-file --range-start 9 --range-end 10
import { a } from "a";

import { b, c } from "b-c";

Expected behavior:

Both output should be the same.

Actual behavior:

--config-precedence=prefer-file ignores --range-start and --range-end flags.

Contributor guide