Monday, May 20, 2024
104
rated 0 times [  107] [ 3]  / answers: 1 / hits: 44821  / 11 Years ago, wed, july 17, 2013, 12:00:00

In my project we have some global variables that work as containers:



MyProject.MyFreature.someFunction = function() { ... }


So then I use that script across the site and JSLint / JSHint complains about that:




'MyProject' is not defined




I know that I can go to every JavaScript file and add the comment /*global MyProject*/ on top of it. But I'm looking a way to define that comment in some sort of config file so I don't have to go file by file adding this comment.



Some kind on option in the config/jshint.yml would be nice.


More From » global-variables

 Answers
8

For JSHint you can create .jshintrc to your project directory with



{
globals: { MyProject: true }
}

[#76922] Wednesday, July 17, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
monetm

Total Points: 615
Total Questions: 103
Total Answers: 119

Location: Finland
Member since Fri, Oct 21, 2022
2 Years ago
monetm questions
Fri, Feb 26, 21, 00:00, 3 Years ago
Wed, Sep 9, 20, 00:00, 4 Years ago
Sun, Jul 26, 20, 00:00, 4 Years ago
Thu, Jun 11, 20, 00:00, 4 Years ago
;