we have added es lint to our workflow how do you d...
# suitescript
s
we have added es lint to our workflow how do you deal with
Copy code
'log' is not defined                            no-undef
e
One option is to use eslint-plugin-suitescript and its
suitescript/no-log-module
rule
s
i have that
Copy code
rules: {
    "suitescript/script-type": "error",
    "suitescript/no-log-module": "error",
  },
e
^ You have it set to an error
If you don't want it to be an error, change the setting
Otherwise, you can define the
log
module in all your scripts that use it
Copy code
define(['N/log'], (log) => { ...
  log.debug(...);
})
You can also change your
no-undef
rule to a warning or none, since it looks like that's actually the one triggering the error here
s
the documentation seems to say that error would throw an error if i did define the module
e
Gotcha; I think the alternative is to define
log
as an eslint global
(I'm new to using the eslint plugin)
s
update : you need do both
Copy code
extends: ["plugin:suitescript/all", "eslint:recommended"],

  plugins: ["suitescript"],
e
The plugin also provides you with some Environments