Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prevent-abbreviations should check all-uppercase variable names #269

Closed
ehmicky opened this issue Mar 28, 2019 · 3 comments
Closed

prevent-abbreviations should check all-uppercase variable names #269

ehmicky opened this issue Mar 28, 2019 · 3 comments

Comments

@ehmicky
Copy link

ehmicky commented Mar 28, 2019

a.js:

const opts = []
$ eslint a.js
/home/user/a.js
  1:7  error  The variable `opts` should be named `options`. A more descriptive name will do too  unicorn/prevent-abbreviations

✖ 1 problem (1 error, 0 warnings)
  1 error and 0 warnings potentially fixable with the `--fix` option.

b.js:

const OPTS = []
$ eslint b.js

b.js does not report any error but it should.

Configuration

.eslintrc.json:

{
  "parserOptions": {
    "ecmaVersion": 2019
  },
  "plugins": ["unicorn"],
  "rules": {
    "unicorn/prevent-abbreviations": "error"
  }
}

Environment

$ npm ls eslint eslint-plugin-unicorn
desktop@1.0.0 /home/user/Desktop
├── eslint@5.15.3 
└── eslint-plugin-unicorn@8.0.0

$ node --version
v11.12.0

$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 18.10
Release:	18.10
Codename:	cosmic
@sindresorhus
Copy link
Owner

It was an intentional choice to ignore those:

@ehmicky
Copy link
Author

ehmicky commented May 1, 2019

Reading up the comment, it seems that the reason was to prevent reporting environment variables, since they are almost always uppercase, and user might not decide on them considering they come from the calling process.

This makes sense.

However, it's too bad because some users (like me) like to name constants with uppercase letters. Those variables cannot be linted. Is there a way this could be done without getting issues with environment variables?

@fregante
Copy link
Collaborator

fregante commented Jan 8, 2023

Closing for now, no movement in 3+ years

@fregante fregante closed this as not planned Won't fix, can't repro, duplicate, stale Jan 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants