<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Jshint on bramp.net</title>
    <link>https://blog.bramp.net/</link>
    <description>Recent content in Jshint on bramp.net</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-GB</language>
    <lastBuildDate>Fri, 23 Nov 2012 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://blog.bramp.net/tags/jshint/" rel="self" type="application/rss+xml" />
    
    <item>
      <title>JSHint ‘x’ is an implied global variable</title>
      <link>https://blog.bramp.net/post/2012/11/23/jshint-x-is-an-implied-global-variable/</link>
      <pubDate>Fri, 23 Nov 2012 00:00:00 +0000</pubDate>
      
      <guid>https://blog.bramp.net/post/2012/11/23/jshint-x-is-an-implied-global-variable/</guid>
      <description><p>I’ve started using <a href="http://www.jshint.com/">JSHint</a> to check my javascript. One error I encountered was:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">Errors:
</span></span><span class="line"><span class="cl">     85,5:&#39;grammar&#39; is not defined.
</span></span><span class="line"><span class="cl">Warning:
</span></span><span class="line"><span class="cl">     85,1: &#39;grammar&#39; is an implied global variable.
</span></span></code></pre></div><p>This is saying that I’m using some variable that I’ve not declared in my javascript file. In most cases that would be a mistake, but in my case I was expecting it to be in the global scope included from another javascript file.</p>
<p>To make JSHint stop complaining about this, you can simply place the following at the top of your javascript document:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-javascript" data-lang="javascript"><span class="line"><span class="cl"><span class="cm">/*global grammar */</span>
</span></span></code></pre></div><p>This will tell it that the variable is declared at a global scope. Check out one of <a href="https://github.com/bramp/js-sequence-diagrams/blob/master/diagram.js">my projects</a> for example.</p></description>
    </item>
    
  </channel>
</rss>
