Skip to content

Instantly share code, notes, and snippets.

@myrosblog
Last active October 17, 2026 13:20
Show Gist options
  • Select an option

  • Save myrosblog/c26429d6f002e1637d327d4913614c18 to your computer and use it in GitHub Desktop.

Select an option

Save myrosblog/c26429d6f002e1637d327d4913614c18 to your computer and use it in GitHub Desktop.
Adobe Campaign - ESLint
/**
* Garantees consistent quality of Adobe Campaign code pulled with `acc` with ESLint.
*
* Adobe Campaign JavaScript code can now be controlled with static code analysis
* And integrated in CI/CD pipelines.
*
* @version 2.0.0
* @author myrosblog.com
* @see https://myrosblog.com/adobe-campaign/acc-cli/qa-eslint
*/
export default [
{
ignores: [
"**/node_modules/**",
"**/dist/**",
"eslint.config.js",
"prettier.config.mjs",
],
languageOptions: {
ecmaVersion: 2015, // target ES5
sourceType: "script", // no ES6 modules (import, export)
globals: {
// Adobe Campaign Classic globals
NLWS: true,
NL: true,
loadLibrary: true,
vars: true,
// AC log
logInfo: true,
logVerbose: true,
logWarning: true,
logError: true,
// AC low-level
sqlExec: true,
sqlSelect: true,
// deprecated
XML: true,
},
},
rules: {
// Common-error rules
"no-cond-assign": "error",
"no-constant-condition": "error",
"no-debugger": "error",
"no-duplicate-case": "error",
"no-empty": "error",
"no-extra-semi": "error",
"no-func-assign": "error",
"no-unreachable": "error",
"no-alert": "error", // block alert(), confirm(), prompt()
"no-eval": "error", // block eval()
"no-undef": "error", // block undeclared variables
"no-shadow": "error", // block shadowed variables
"no-new-wrappers": "error", // block new String(), new Number(), etc.
"no-dupe-args": "error",
"no-dupe-keys": "error",
"no-unused-vars": ["error", { varsIgnorePattern: "^_" }], // ignore variables starting with _
"no-console": "error", // error on console.log
eqeqeq: "error", // require === over ==
"prefer-const": "error", // require const for variables that are never reassigned
// AC engine: syntax that parses in ESLint but crashes SpiderMonkey 1.8.5
"no-restricted-syntax": [
"error",
{
selector: "ArrowFunctionExpression",
message: "AC engine: use function()",
},
{
selector: "TemplateLiteral",
message: "AC engine: no template literals",
},
{ selector: "ClassDeclaration", message: "AC engine: no class" },
{ selector: "ClassExpression", message: "AC engine: no class" },
],
},
},
];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment