
Security News
Browserslist-rs Gets Major Refactor, Cutting Binary Size by Over 1MB
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
eslint-config-ssjs
Advanced tools
ESLint config for Salesforce Marketing Cloud's Server-Side JavaScript
Preset for Salesforce Marketing Cloud's Server-Side JavaScript.
ESLint shareable config
npm install --save-dev eslint eslint-config-ssjs
Important: Requires ESLint >=8.56.0 and eslint-config-ssjs >=2.0.0
This plugin exports a recommended config that enforces good practices.
The folowing will limit SSJS rules to files ending on *.ssjs
:
import sfmcSsjs from 'eslint-config-ssjs';
export default [
// …
{
...sfmcSsjs.configs.recommended,
files: ['**/*.ssjs'],
},
];
If you don't plan on writing any browser (normal) JavaScript, you can also use the following. This will apply the rules to all files:ggn
import sfmcSsjs from 'eslint-config-ssjs';
export default [
// …
sfmcSsjs.configs.recommended,
];
'use strict';
const sfmcSsjs = require('eslint-config-ssjs');
module.exports = [
// …
{
...sfmcSsjs.configs.recommended,
files: ['**/*.ssjs'],
},
];
Important: Requires ESLint <9.0.0 and eslint-config-ssjs <2.0.0
Once the eslint-config-ssjs
package is installed, you can use it by specifying ssjs
in the extends
section of your ESLint configuration.
Important: Make sure that your SSJS files end on *.ssjs
and not on *.js
.
{
"extends": "ssjs",
"rules": {
// your other rules
}
}
It's good practice to use eslint:recommended
ruleset in your project to support front end scripts.
To use SSJS in conjunction with ESLint's recommended rule set, extend with both, making sure to list ssjs
last. We do recommend to also use this together with eslint-config-prettier
and eslint-plugin-prettier
{
"extends": ["eslint:recommended", "prettier", "ssjs"],
"plugins": ["prettier"],
"rules": {
// your other rules that don't conflict with the SSJS config
},
}
Starting with version 2.x of prettier, the plugin automatically has "trailingComma" set to "es5". That's a problem because SSJS actually does not support this.
Also, SFMC tends to remove all tabs when you save queries, scripts, code snippets, emails and cloud pages. We hence strongly recommend to set useTabs
to false
and define tabWidth
according to your liking (2 or 4 are typical values).
Add the following to your .prettierrc
file to ensure the above concerns are adressed:
{
"useTabs": false,
"tabWidth": 4,
"singleQuote": true,
"overrides": [
{
"files": "*.ssjs",
"options": {
"trailingComma": "none"
}
}
]
}
Make sure you associate *.ssjs
with JavaScript in your IDE. That should automatically enable linting via ESLint.
MIT licensed
FAQs
ESLint config for Salesforce Marketing Cloud's Server-Side JavaScript
The npm package eslint-config-ssjs receives a total of 47 weekly downloads. As such, eslint-config-ssjs popularity was classified as not popular.
We found that eslint-config-ssjs demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.