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.

Namespaced global variables

See original GitHub issue

I would like to solicit feedback about implications of adding this potential extension to the globals configuration.

What version are you using? 4.10.0

What problem do you want to solve? Create a configuration that will allow global variables to be defined dynamically using a namespace. This would allow a namespaced set of global variables that can be used within a context where no-undef is otherwise enforced.

What’s your take on the correct solution to problem? Allow for a configuration along the lines of:

{
  "globals": {
    "somename_": {
      "namespace": true,
      "prefix": true
    }
  }
}

And any global variables prefixed with somename_ would be allowed in files within which they are not declared.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
not-an-aardvarkcommented, Jan 19, 2018

Sorry, I think I used the wrong message (edited my comment above). As you said, this probably would have needed to be a core change and not a custom rule.

0reactions
saschabrattoncommented, Jan 19, 2018

Gotcha. Thanks again!

Read more comments on GitHub >

github_iconTop Results From Across the Web

C++ global variable in namespace [duplicate] - Stack Overflow
This is caused by the initialization order of global static variables. It is undefined and is known as static initialization order fiasco.
Read more >
about Namespace and global variables - C++ Forum
`Use variables in an unnamed namespace instead of using static global variables. when I am learning c++, i read these two sentences above,...
Read more >
Global Namespace (The GNU Awk User's Guide)
In standard awk , there is a single, global, namespace. This means that all function names and global variable names must be unique....
Read more >
6.4 — Introduction to global variables - Learn C++
Global variables have file scope (also informally called global scope or global namespace scope), which means they are visible from the ...
Read more >
26. Global vs. Local Variables and Namespaces
While in many or most other programming languages variables are treated as global if not declared otherwise, Python deals with variables the ...
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