1 Reply Latest reply on Apr 13, 2016 5:20 AM by Marek Kaczkowski

    jshint flags preprocessor directives

    jonht Level 1

      Hi,

      I'm trying to be good and lint my scripts, but I can't get jshint to ignore preprocessor directives, eg

      #target indesign

      #include "externalFile.jsx"

       

      After a bit of digging I found that you can tell jshint to ignore warnings by placing your code between:

      /* jshint ignore:start */

      code goes here

      /* jshint ignore:end */

       

      Unfortunately, this only works for warnings (W### warning code) but not for errors (E### error code), which preprocessor directives fall under.

       

      So if you're using jshint, are you able to get it to ignore error codes?

       

      Any advice greatly appreciated.

       

      John

        • 1. Re: jshint flags preprocessor directives
          Marek Kaczkowski

          Huh, this is quite old question.

          If you want to ignore those Adobe specific globals, you must add them to globals list like this:

          /*

          globals

            app,

            BitsPerChannelType,

            ChangeMode,

            DocumentFill,

            documents,

            ElementPlacement,

            Extension,

            Folder,

            NewDocumentMode,

            PhotoshopSaveOptions,

            preferences,

            SaveOptions,

            TrimType,

            Units,

            version

          */

          More info on jshint docs page.

          If you find this answer helpful, please mark it as proper answer. Thanks jonht