{"id":624,"date":"2022-08-30T15:04:27","date_gmt":"2022-08-30T15:04:27","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/11\/09\/jshint-functions-with-dots-in-the-name-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:04:27","modified_gmt":"2022-08-30T15:04:27","slug":"jshint-functions-with-dots-in-the-name-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/jshint-functions-with-dots-in-the-name-collection-of-common-programming-errors\/","title":{"rendered":"jshint functions with dots in the name-Collection of common programming errors"},"content":{"rendered":"<p>I&#8217;m running jshint on a javascript file, and some of the functions have dots in their names (as a way of namespacing). In particular, I&#8217;m using the d3 library, and I have a lot of code that looks like<\/p>\n<pre><code>d3.select(\"something\")\n<\/code><\/pre>\n<p>Do I just need to turn off jshint&#8217;s checking of using undefined variables? Or is there a way to suppress just certain variable names from being checked. I&#8217;m using grunt to build the project.<\/p>\n<ol>\n<li>\n<p>Wrong.<\/p>\n<p>You are calling the <code>select<\/code> method on the <code>d3<\/code> variable.<br \/>\nYou&#8217;re getting a warning because JSHint doesn&#8217;t know about the <code>d3<\/code> variable.<\/p>\n<p>You need to tell it that the <code>d3<\/code> global has been defined elsewhere, like this:<\/p>\n<pre><code>\/*global d3:false *\/\n<\/code><\/pre>\n<p>The <code>:false<\/code> will tell it to complain if you ever overwrite the global.<\/p>\n<\/li>\n<\/ol>\n<p id=\"rop\"><small>Originally posted 2013-11-09 21:08:38. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>I&#8217;m running jshint on a javascript file, and some of the functions have dots in their names (as a way of namespacing). In particular, I&#8217;m using the d3 library, and I have a lot of code that looks like d3.select(&#8220;something&#8221;) Do I just need to turn off jshint&#8217;s checking of using undefined variables? Or is [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-624","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/624","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=624"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/624\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=624"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=624"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=624"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}