You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What version of this package are you using?
14.3.1
What operating system, Node.js, and npm version?
macOS 10.15.2, Node.js v10.18.1, npm 6.13.4
What happened?
In a JS file for the web, that interacts with a page where there's a variable defined in a template (which comes from an open source e-commerce CMS — changing it would break core functionality because other code expects it) I declare a "global" variable id_product. Using in the code triggers the camelcase rule, but I cannot do anything about it.
/* global $, id_product [...] */varproductId=id_product// Identifier 'id_product' is not in camel case. (camelcase)
What did you expect to happen?
Since it's a global, stylistic rules shouldn't apply. Is it possible to do it with eslint? I just checked my previous configuration and I had camelcase disabled, probably for this reason.
Are you willing to submit a pull request to fix this bug?
Yes.
The text was updated successfully, but these errors were encountered:
I don't see anything regarding globals. Perhaps take a look at ESLint source code; the tests for the camelcase rule; whether there's a test for ignoring globals.
Thank you, sorry I didn't think hard enough about it that it should be an upstream issue... and it seems that there's not much interest there: eslint/eslint#11716
I don't see anything regarding globals. Perhaps take a look at ESLint source code; the tests for the camelcase rule; whether there's a test for ignoring globals.
Well, I landed the feature in eslint, and it got released in 7.4.
Whenever the upgrade will come it would be nice for this option to be included 😊
feross
changed the title
camelcase should not apply to globals
Relax rule: Do not enforce camelcase style for global variables (camelcase)
Oct 29, 2020
What version of this package are you using?
14.3.1
What operating system, Node.js, and npm version?
macOS 10.15.2, Node.js v10.18.1, npm 6.13.4
What happened?
In a JS file for the web, that interacts with a page where there's a variable defined in a template (which comes from an open source e-commerce CMS — changing it would break core functionality because other code expects it) I declare a "global" variable
id_product
. Using in the code triggers thecamelcase
rule, but I cannot do anything about it.What did you expect to happen?
Since it's a global, stylistic rules shouldn't apply. Is it possible to do it with eslint? I just checked my previous configuration and I had camelcase disabled, probably for this reason.
Are you willing to submit a pull request to fix this bug?
Yes.
The text was updated successfully, but these errors were encountered: