An ESLint Environment for NetSuite SuiteScript 1.0 and 2.0

If you use ESLint to lint your SuiteScript, then you may have found that the no-undef rule doesn’t like any references to global NetSuite functions because they are not defined in your files.

I have published an ESLint plugin on npm that adds an ESLint Environment for SuiteScript 1.0 and 2.0 global functions. By adding this to your ESLint configuration, you can ensure that ESLint will recognize SuiteScript global functions, and you won’t get any false negatives from the no-undef rule.

You can check out the plugin here: https://www.npmjs.com/package/eslint-plugin-suitescript

If you don’t use ESLint, do you lint your SuiteScript projects at all? What do you use?

2 thoughts on “An ESLint Environment for NetSuite SuiteScript 1.0 and 2.0

  1. Hey Eric,

    Do you know what I would need to do to get this plugin working in Eclipse? I am using ESLint in Eclipse using the Tern plugin. I installed the suitescript plugin globally using npm and then added the following to my eslint config file, but Eclipse still doesn’t seem to recognize NetSuite global functions:

    “plugins”: [
    “suitescript”
    ],
    “env”: {
    “suitescript/suitescript1”: true,
    “suitescript/suitescript2”: true
    }

    1. Hey Michael,

      Thanks for checking out the plugin! Sorry it’s not working within Eclipse; I haven’t ever tested it there as I’m not familiar with Tern, and I use WebStorm for my JS/NS dev work.

      I don’t have any suggestions off the top of my head as I have no idea how Tern works or what it might be expecting.

      Sorry I can’t be of more help =/

      -EG

Leave a Reply

Your email address will not be published. Required fields are marked *