eslint-plugin-functional icon indicating copy to clipboard operation
eslint-plugin-functional copied to clipboard

Autofix for `functional/prefer-readonly-type` produces confusing formatting

Open maxpatiiuk opened this issue 3 years ago • 1 comments

Bug Report

Autofix for functional/prefer-readonly-type on a mapped type like the following inserts readonly on a wrong line:

let a: {
  [B in 'c']: 'd';
};

Expected behavior

let a: {
  readonly [B in 'c']: 'd';
};

Actual behavior

let a: { readonly
  [B in 'c']: 'd';
};

Proposed changes

Put readonly on the correct line.

Additional information

Related to #384

maxpatiiuk avatar Jul 19 '22 02:07 maxpatiiuk

I'm not sure why this would be happening. I can look into it but formatting isn't the goal of this plugin; another rule or tool should be used to manage/fix formatting.

RebeccaStevens avatar Jul 19 '22 02:07 RebeccaStevens