-
-
Notifications
You must be signed in to change notification settings - Fork 832
Labels
A-formatter-prettier-diffArea - Formatter difference with PrettierArea - Formatter difference with Prettier
Description
Description
Oxfmt is not idempotent when formatting CSS comments inside styled-components template literals. Each formatting pass adds additional
indentation to comment lines, causing the indentation to grow indefinitely.
Steps to reproduce
- Format the code below with oxfmt
- Format the output again with oxfmt
- Repeat and observe the indentation increasing each time
Input
import styled from 'styled-components';
export const DocumentedComponent = styled.div`
/**
* @description This is a documented section
* @param {number} value - Some value
*/
padding: 16px;
`;Output
After 1st format
export const DocumentedComponent = styled.div`
/**
* @description This is a documented section
* @param {number} value - Some value
*/
padding: 16px;
`;After 2nd format
export const DocumentedComponent = styled.div`
/**
* @description This is a documented section
* @param {number} value - Some value
*/
padding: 16px;
`;After 3rd format
export const DocumentedComponent = styled.div`
/**
* @description This is a documented section
* @param {number} value - Some value
*/
padding: 16px;
`;Expected behavior
Formatting should be idempotent. Running oxfmt on already-formatted code should produce identical output.
Environment
- oxfmt version: 0.26.0
- Reproduction repository: https://github.com/re-taro/reproduction_oxfmt_prettier_diff
- Run pnpm test to observe the stability tests failing
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-formatter-prettier-diffArea - Formatter difference with PrettierArea - Formatter difference with Prettier