mediamonks / frontend-coding-standards

Media.Monks - Frontend Coding Standards
60 stars 23 forks source link

Hexadecimal number formatting #104

Open markknol opened 8 months ago

markknol commented 8 months ago

When I write a nice color in code like 0xFF0000, prettier converts this to 0xff_00_00. This is inconvenient because you can't copy this value back to photoshop or somewhere else which accepts hexadecimal colors. Can we turn this off?

ThaNarie commented 8 months ago

Prettier only lowercases them, it doesn't add numeric separators;

https://prettier.io/playground/#N4Igxg9gdgLgprEAuc0DOMAEkA2EBOmAvJgAwAeAYpQGw2mkDcAOlCADQgQAOMAlumSgAhvnwQA7gAVRCNMhDCcE4QE95nAEb5hYANZwYAZWEBbOABk+UOMgBmStHC079ho913WA5shj4AV2cQJ1M+P0DgtB8cOABFAIh4e0dggCs0ciMY+MTkpAccJ04ARzy4KXFueRRhNABaGzgAExaOEH9hPhwfAGEIU1NhBSUcduiob1iAQRh-Pk0A+Ck4fCsbFKLggAsYUxwAdW2+eDRPMDgjORO+ADcT1QUwNA0QW6CASShW2CMwfD4vGm3yMMFUsU2xRA3HETgOOm4ChhcCc+Futk41lRMEqwm8Q0hwU8+FRCk0wk0cDGnBh1hgBz4zRg22QAA5SJx8HAynwubj8cMCqlODAKQymSykAAmTgBJwAFQpNUKULgpkpzVazQswkmATxcEoBCGcx8IyWEBAAF8rUA

ThaNarie commented 8 months ago

It's likely it's from the numeric-separators-style eslint rule instead: https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/numeric-separators-style.md

It can be turned of for hexadecimal by setting onlyIfContainsSeparator: true in that config object, while leaving it enabled for other number types.

leroykorterink commented 8 months ago

On it 😄