figma-plugin icon indicating copy to clipboard operation
figma-plugin copied to clipboard

Add option to choose json indentation type

Open MaiLeeTR opened this issue 2 years ago • 4 comments

Is your feature request related to a problem? Please describe. Our project uses Prettier code formatter and tabs instead of spaces for indentation. Our team is currently setting up and applying tokens to components in Figma and code.

What our process currently looks like:

  1. Designer pushes up their changes to a tokens branch in GitHub with json file using the default spaces instead of tabs indentation
  2. Checks always fail due to Prettier indentation error
  3. Developer pulls down changes from the tokens branch into their own branch, fixes the error, applies tokens in code, and merges changes
  4. The tokens branch gets conflicts due to differences in formatting, and the developer has to fix conflicts and revert the formatting to what's coming from the plugin for the designer's next push

Due to the indentation formatting differences between the Figma json file and our code, we always have to fix formatting issues and perform additional and time-consuming steps.

Describe the solution you'd like Add an option to change the indentation formatting of the json file to tabs.

Additional context Error Screen Shot 2023-02-15 at 8 15 45 AM

Current indentation Screen Shot 2023-02-15 at 8 14 08 AM

Option for preferred indentation Screen Shot 2023-02-15 at 8 13 47 AM

MaiLeeTR avatar Feb 15 '23 14:02 MaiLeeTR

I think this would make a nice config parameter that users can define in the settings and we save in the $metadata.json (or $metadata key in the single file sync)

We basically currently stringify our JSON by using 2 spaces, but that could be something users could configure to be tabs instead.

six7 avatar Feb 17 '23 09:02 six7

@six7 Thanks for the response. Any idea about the priority of getting this implemented?

MaiLeeTR avatar Mar 06 '23 15:03 MaiLeeTR

It's not very high on our list so far, but I'll add it to our quick wins which means it might get picked up sooner during sprints.

six7 avatar Mar 12 '23 22:03 six7

It's not very high on our list so far, but I'll add it to our quick wins which means it might get picked up sooner during sprints.

I hope it gets picked up sooner due to being a quick win. Thanks for the update!

MaiLeeTR avatar Mar 14 '23 18:03 MaiLeeTR