npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

eslint-plugin-sfmc

v2.6.1

Published

ESLint plugin for Salesforce Marketing Cloud — AMPscript and Server-Side JavaScript (SSJS)

Readme

eslint-plugin-sfmc

Unified ESLint plugin for Salesforce Marketing Cloud — linting rules for both AMPscript and Server-Side JavaScript (SSJS).

Installation

npm install eslint-plugin-sfmc --save-dev

Requires ESLint 9+ (flat config).

Quick Start

// eslint.config.js
import sfmc from 'eslint-plugin-sfmc';

export default [
  // Lint standalone .ampscript/.amp and .ssjs files
  ...sfmc.configs.recommended,

  // Lint AMPscript + SSJS embedded in .html files
  ...sfmc.configs.embedded,
];

VS Code Setup

To see eslint(sfmc/...) diagnostics in VS Code for .amp, .ssjs, and .html files you need the VS Code ESLint extension to validate the custom SFMC language IDs.

Option A — Install vscode-sfmc-language (recommended)

The SFMC Language Service extension contributes the SFMC language IDs and automatically configures eslint.validate for you. No manual settings required.

Option B — Manual configuration

Add the following to your .vscode/settings.json:

{
    "eslint.validate": [
        "javascript",
        "javascriptreact",
        "typescript",
        "typescriptreact",
        "html",
        "vue",
        "markdown",
        "ampscript",
        "ssjs",
        "sfmc"
    ]
}

Why eslint.validate and not eslint.probe? eslint.probe silently skips files for language IDs that the ESLint extension does not natively recognise. eslint.validate forces the extension to process those files regardless of language ID.

Configs

Marketing Cloud Engagement (default)

| Config | Files | What it does | | -------------------------- | ---------------------------- | --------------------------------------------------------- | | sfmc.configs.ampscript | **/*.ampscript, **/*.amp | AMPscript rules only (recommended severity) | | sfmc.configs.ssjs | **/*.ssjs | SSJS rules only (recommended severity) | | sfmc.configs.recommended | Both of the above | All rules at recommended severity for standalone files | | sfmc.configs.embedded | **/*.html | Combined processor extracts both languages from HTML | | sfmc.configs.strict | All of the above + HTML | All rules at error severity for standalone and embedded |

recommended, embedded, and strict are arrays — spread them with ....

Marketing Cloud Next

Use the -next config variants when targeting Marketing Cloud Next (MCN). MCN supports only a subset of AMPscript functions and does not support SSJS at all.

| Config | Files | What it does | | -------------------------------- | ---------------------------- | ----------------------------------------------------------------------------------------- | | sfmc.configs['ampscript-next'] | **/*.ampscript, **/*.amp | AMPscript rules + flags functions unsupported in MCN (single config object) | | sfmc.configs['ssjs-next'] | **/*.ssjs | Flags all SSJS API calls as MCN-unsupported; all other SSJS quality rules disabled | | sfmc.configs['recommended-next'] | Both of the above | AMPscript MCN-aware + SSJS flagged for standalone files | | sfmc.configs['embedded-next'] | **/*.html | AMPscript MCN-aware + SSJS flagged for HTML-embedded code | | sfmc.configs['strict-next'] | All of the above + HTML | All AMPscript rules at error severity + MCN flag; SSJS fully flagged |

recommended-next, embedded-next, and strict-next are arrays — spread them with ....

// eslint.config.js — targeting Marketing Cloud Next
import sfmc from 'eslint-plugin-sfmc';

export default [
  ...sfmc.configs['recommended-next'],
  ...sfmc.configs['embedded-next'],
];

AMPscript Rules (amp-*)

| Rule | Default | Description | | ------------------------------------------------------------------------------------------- | ------- | ------------------------------------------------------------ | | sfmc/amp-no-unknown-function | error | Disallow calls to unknown AMPscript functions | | sfmc/amp-function-arity | error | Enforce correct argument counts | | sfmc/amp-arg-types | error | Check that literal arguments match expected parameter types and allowed values | | sfmc/amp-set-requires-target | error | Require set to have a target variable | | sfmc/amp-no-smart-quotes | error | Disallow smart/curly quotes in strings | | sfmc/amp-no-var-redeclaration | warn | Disallow re-declaring a variable with var | | sfmc/amp-no-empty-block | warn | Disallow empty %%[ ]%% blocks | | sfmc/amp-no-loop-counter-assign | warn | Disallow assigning to the for loop counter | | sfmc/amp-no-inline-statement | warn | Disallow statements inside inline expressions | | sfmc/amp-no-deprecated-function | warn | Flag deprecated functions and suggest replacements | | sfmc/amp-naming-convention | warn | Enforce variable naming convention | | sfmc/amp-no-empty-then | warn | Disallow IF with empty THEN branch | | sfmc/amp-require-rowcount-check | warn | Require RowCount check before FOR on LookupRows | | sfmc/amp-no-html-comment | warn | Disallow HTML comments inside AMPscript blocks | | sfmc/amp-no-js-line-comment | warn | Disallow JS-style // line comments in AMPscript | | sfmc/amp-no-nested-script-tag | error | Disallow <script> tags nested inside AMPscript script tags | | sfmc/amp-no-nested-ampscript-delimiter | error | Disallow AMPscript delimiters nested inside AMPscript blocks | | sfmc/amp-prefer-attribute-value | off | Prefer AttributeValue() over bare personalization | | sfmc/amp-require-variable-declaration | off | Require var before set | | sfmc/amp-no-email-excluded-function | off | Flag functions unavailable in email context |

SSJS Rules (ssjs-*)

| Rule | Default | Description | | ------------------------------------------------------------------------------------------------------- | ------- | -------------------------------------------------------------------- | | sfmc/ssjs-require-platform-load | error | Require Platform.Load("core") before Core or requiresCoreLoad globals | | sfmc/ssjs-no-unsupported-syntax | error | Flag ES6+ syntax not supported by SFMC | | sfmc/ssjs-no-unknown-function | error | Disallow unknown methods on Platform.*, HTTP, Core Library, and WSProxy | | sfmc/ssjs-no-deprecated-function | error | Flag use of deprecated SFMC SSJS APIs (e.g. ContentArea, ContentAreaObj) | | sfmc/ssjs-no-property-call | error | Disallow calling Platform.Request/Response properties as functions | | sfmc/ssjs-platform-function-arity | error | Enforce correct arity for Platform.Function.* | | sfmc/ssjs-require-platform-load-order | error | Require Platform.Load() before Core usage in order | | sfmc/ssjs-no-hardcoded-credentials | error | Flag hardcoded keys in encryption calls | | sfmc/ssjs-cache-loop-length | warn | Require caching .length in for-loops | | sfmc/ssjs-require-hasownproperty | warn | Require hasOwnProperty guard in for-in loops | | sfmc/ssjs-prefer-platform-load-version | warn | Enforce a minimum Platform.Load version string | | sfmc/ssjs-no-unavailable-method | warn | Flag Array/String methods unavailable or broken in SFMC's ES3 engine | | sfmc/ssjs-prefer-parsejson-safe-arg | warn | Require string coercion on ParseJSON argument | | sfmc/ssjs-no-switch-default | warn | Disallow default clause in switch statements | | sfmc/ssjs-no-treatascontent-injection | warn | Flag dynamic string concatenation in TreatAsContent calls | | sfmc/ssjs-core-method-arity | warn | Enforce correct argument counts for Core Library object methods | | sfmc/ssjs-arg-types | warn | Check that literal arguments match expected parameter types |

Processors

| Processor | Purpose | | ---------------- | ------------------------------------------------------------- | | sfmc/ampscript | Extract %%[ ]%%, %%= =%%, <script language="ampscript"> | | sfmc/ssjs | Extract <script runat="server"> (non-ampscript) | | sfmc/sfmc | Combined: extracts both AMPscript and SSJS from HTML |

License

MIT