sindresorhus / eslint-plugin-unicorn

More than 100 powerful ESLint rules
MIT License
4.16k stars 360 forks source link

`filename-case`: `camelCase` should (optionally?) allow uppercase abbreviations like DOM #2141

Open thorn0 opened 1 year ago

thorn0 commented 1 year ago

There are two styles of camel case used in the wild:

  1. Uppercase letters are used only to start words. getHtml, convertFromDom
  2. Abbreviations like DOM or HTML are written all uppercase unless they're the first word: innerHTML, getDOMRangeRect, domSelection

Currently the filename-case rule doesn't support the style 2 even though this style is used in the DOM APIs and is overall quite popular.

Example: https://github.com/facebook/lexical/blob/main/packages/lexical-playground/src/utils/getDOMRangeRect.ts

dvislov commented 1 year ago

Yes, I also have in the project files with abbreviations inside like API, KPI, MUI (material-ui) etc.

fregante commented 7 months ago

I think this is generally called camelCase vs strictCamelCase (which is what unicorn uses)

The problem with the non-strict version is that it allows eyesores like XMLHttpRequest