Shareable ESLint flat config for Salesforce Commerce Cloud (SFCC) projects.
This config focuses exclusively on JavaScript compatibility for the SFCC/Rhino engine. It detects the use of JavaScript features that are not supported on SFCC sandboxes — it does not enforce any code style or formatting rules. When used alongside a recommended config from eslint, eslint-plugin-unicorn, or eslint-plugin-sonarjs, it disables rules that require ES2015+ features unsupported in the Rhino environment.
pnpm add -D eslint @jenssimon/eslint-config-sfccimport { defineConfig } from "eslint/config"
import sfcc from "@jenssimon/eslint-config-sfcc"
export default defineConfig(
// ...
sfcc.configs.recommended,
)By default, JavaScript files under cartridges/ are linted. Client-side and static asset folders are excluded.
import { defineConfig } from "eslint/config"
import { createRecommendedConfig } from "@jenssimon/eslint-config-sfcc"
export default defineConfig(
createRecommendedConfig({
cartridgesDir: "cartridges/",
}),
)This package ships a built-in ESLint plugin with rules ported from eslint-plugin-sitegenesis and adapted for ESLint 9+. The plugin is automatically registered in the recommended config.
The plugin is also exported for direct use in custom configs:
import { defineConfig } from "eslint/config"
import sfcc, { sitegenesis } from "@jenssimon/eslint-config-sfcc"
export default defineConfig(sfcc.configs.recommended, {
plugins: { sitegenesis },
rules: {
"sitegenesis/no-global-require": "error",
},
})| Rule | Description | Default |
|---|---|---|
sitegenesis/no-global-require |
Disallows top-level require() calls in controller files when not every route function uses them. Only applies to files under cartridge/controllers/. |
error |
This is a major release with breaking changes.
ESLint Flat Config
The package now uses the flat config format (eslint.config.js). The legacy .eslintrc-based format is no longer supported.
Focus: compatibility, not formatting The config no longer enforces any code style or formatting rules. Its sole purpose is to detect JavaScript features that are not supported on SFCC sandboxes (Rhino engine). Formatting should be handled separately, e.g. with Prettier or Oxfmt.
No more base config
The previous version extended @jenssimon/eslint-config-base (Airbnb style guide). This dependency has been removed entirely. Rules like comma-dangle, no-var, import/*, consistent-return, etc. are no longer part of this config.
eslint-plugin-es5 → eslint-plugin-es
The old eslint-plugin-es5 has been replaced by eslint-plugin-es. Rules have been mapped accordingly.
No more SiteGenesis / SFRA configs
The sfra and sfra-storefront configurations have been removed. These configurations were specific to SFRA and SiteGenesis and are not part of this general-purpose SFCC config. The external eslint-plugin-sitegenesis dependency is no longer used — the sitegenesis/no-global-require rule is now built into this package and enabled automatically.
- Replace
.eslintrc.*witheslint.config.js - Update the package name and import (see Usage above)
- Remove
@jenssimon/eslint-config-base,eslint-plugin-es5, andeslint-plugin-sitegenesisfrom your dependencies — thesitegenesis/no-global-requirerule is now built in - Add any formatting rules you need directly to your own
eslint.config.js
vp install
vp test
vp check
vp pack