question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

dot-notation should not apply for reserved words

See original GitHub issue

I have the following code:

vars["if"] = true

I use bracket notation because if is a reserved word, and minifiers like yuicompressor fail if you use vars.if = true instead.

I want to require dot notation except for cases where there may be a reserved word that could cause problems.

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
michaelficarracommented, Mar 16, 2015

You want false, not true.

1reaction
ilyavolodincommented, Mar 16, 2015
"dot-notation": [2, {"allowKeywords": true }]

Should do the trick. Documentation states that allowKeywords is turned on by default, so passing an option should be necessary. If you are seeing an error without allowKeywords, but not seeing it with it, could you reply with that information, so we could fix documentation?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Workaround to allow reserved words to be used as property ...
I want to use class as a property name of an object, and access it using dot notation. Preamble. I already know that,...
Read more >
dot-notation - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >
`dot-notation` with `allowKeywords` false incorrectly reports ...
Wait - I'm not saying it's not a reserved word. I'm saying it's not a syntax error - and eslint reports it as...
Read more >
Property accessors - JavaScript - MDN Web Docs - Mozilla
Dot notation. In the object.propertyName syntax, the propertyName must be a valid JavaScript identifier which can also be a reserved word.
Read more >
Tag: Dot Notation - somewhat abstract
However, as soon as we want a distinct list, the dot notation starts to win out again because C# does not contain a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found