Skip to content

Latest commit

 

History

History
62 lines (41 loc) · 1.21 KB

no-log-module.md

File metadata and controls

62 lines (41 loc) · 1.21 KB

suitescript/no-log-module

Restricts loading of the N/log module in favor of global log.

In most cases, global log can be used instead of the N/log module.

Rule Details

By default, the N/log module is allowed in client scripts because there it is used to log to NetSuite where it would otherwise be impossible. See the rule options below to modify this.

✅ The following pattern is correct:

/* eslint suitescript/no-log-module: "error" */

define([], function() {
  log.debug('Title', 'Details');
});

❌ The following pattern is incorrect:

/* eslint suitescript/no-log-module: "error" */

define(['N/log'], function(log) {
  log.debug('Title', 'Details');
});

Rule Options

'suitescript/no-log-module': [<enabled>, {
  allowInClientScripts: <boolean>
}]

allowInClientScripts

default: true

Allows the N/log module to be loaded in client scripts.

/* eslint suitescript/no-log-module: ["error", { allowInClientScripts: false }] */

/**
 * @NScriptType ClientScript',
 */
define([], function() {
  console.log("can't use N\log");
});

Version

This rule was introduced in version 1.0.0.

Source