{"id":7449,"date":"2019-09-22T08:34:10","date_gmt":"2019-09-22T08:34:10","guid":{"rendered":"http:\/\/putridparrot.com\/blog\/?p=7449"},"modified":"2024-01-26T11:24:59","modified_gmt":"2024-01-26T11:24:59","slug":"watching-with-eslint","status":"publish","type":"post","link":"https:\/\/putridparrot.com\/blog\/watching-with-eslint\/","title":{"rendered":"Watching with eslint"},"content":{"rendered":"<p>If you have your dev environment set up like me, you&#8217;re used to having Jest in a terminal window of it&#8217;s own continuously running and watching for changes to test files, but what about eslint, there doesn&#8217;t appear to be the same option out of the box.<\/p>\n<p>Whilst there are npm packages for adding this capability the easiest way is to simply use <em>watch<\/em>, although you&#8217;ll need to install it using <em>npm install watch -g<\/em> if not already installed. Our CLI command would then look something like this<\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\nyarn watch 'eslint --ext *.ts,*.tsx,*.js,*.jsx src' src\r\n<\/pre>\n<p>if we ignore the &#8216;eslint&#8230;&#8217; section, basically we&#8217;re just telling watch to watch the folder <em>src<\/em> (the src text at the end of the command). Ofcourse if you&#8217;re working on a specific folder, for example src\/components\/mediaPlayer, you&#8217;ll want to watch that specific folder. Just don&#8217;t forget we&#8217;re running two separate commands, so it&#8217;s no good watching one folder but having lint run against a different folder.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you have your dev environment set up like me, you&#8217;re used to having Jest in a terminal window of it&#8217;s own continuously running and watching for changes to test files, but what about eslint, there doesn&#8217;t appear to be the same option out of the box. Whilst there are npm packages for adding this [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[254,45],"tags":[],"class_list":["post-7449","post","type-post","status-publish","format-standard","hentry","category-eslint","category-javascript"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/7449","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/comments?post=7449"}],"version-history":[{"count":4,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/7449\/revisions"}],"predecessor-version":[{"id":10669,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/7449\/revisions\/10669"}],"wp:attachment":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/media?parent=7449"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/categories?post=7449"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/tags?post=7449"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}