prettier / prettier/prettier

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

Open
#13,354 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area:cli area:ranges help wanted type:editor support
Dominant language
JavaScript
Stars
52.3k
Forks
5k
Avg merge
19h 2m
Merged PRs (30d)
117

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with file.js, .prettierrc.js, and the two prettier CLI commands shown in the report. Start by tracing CLI handling for --config-precedence, --range-start, and --range-end; done means both precedence modes produce the same range-limited output.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.