Skip to Content

JavaScript

SFCC-aware JavaScript in JetBrains IDEs - typed SFRA routes, callbacks and hooks, require paths, templates, resource keys, forms and custom attributes

Intellij SFCC teaches the IDE's JavaScript support how B2C Commerce runs your code. Completion, Go to Declaration, types, Find Usages and checks follow your cartridges the way the server does, from require('*/...') to the template a route renders and the type of every callback parameter

In an SFRA route, req and res complete with their types, so req.currentCustomer.profile and res.render come up as you type. Cmd+Click on server.middleware.https opens the function in your project's modules/server/middleware.js

Explore JavaScript support

Before you start

NeedsWhy
A valid license or trialSFCC completion, references, parameter types and gutter icons are paid features, see Free and licensed
At least one linked cartridgeThe plugin works only with linked cartridges, see Cartridges & Modules
Finished indexingRoutes, templates, resources and metadata come from the IDE index. Wait for the progress bar to finish

Server-side code is anything inside a cartridge folder. Files under cartridge/static, cartridge/js, cartridge/client, cartridge/front-end and cartridge/front are browser code and don't get Script API completion

Server-side .js and .ds files resolve names against the bundled Script API typings and your project's modules. The typings declare the standard library the server runs, so the IDE's ES libraries stay out. Map and Set resolve, as the Script API declares them. window, document and fetch don't, and are reported as host objects, see Scopes & Types. Other files come in through require, see Module Resolution. Browser code keeps the IDE's usual scope

What the plugin adds

IDE featureIn SFCC codeMore
CompletionScript API members, require paths, routes, templates, resource keys, hooks, forms, custom attributes and Page Designer attributes. Items from another cartridge name it on the right with its icon and path, Script API items their package such as dw.utilSFCC Contracts
Typesdw classes from the bundled typings, typed req and res in SFRA routes, callback, hook and job step parameters, module.superModule, forms and custom attributesType Inference
Go to Declarationrequire('*/...') to the winning cartridge, server.middleware.https to SFRA's middleware, a route string to its controller, a template, bundle key, hook, form field or attributeSearch & Navigation
Find Usages and RenameTemplates with the calls that render them, picked templates included, form fields and job step functions. Custom attributes list every readSFRA Controllers
Gutter iconsNavigate to template on every render call, with Choose Template when several cartridges have itGutter icons
Code VisionOpen Endpoint, Copy Endpoint URL, usages and append or replace counts above each route, the hook above a hook function, the step type above a job stepCode Vision
FoldingResource.msg('title', 'loyalty', null) reads as "Loyalty rewards"Resource bundles
InspectionsHook functions that return what the hook doesn't expect, unknown forms and form elements, and the Digital Script and compatibility mode checksHooks
Search EverywhereEvery route, hook, step type and custom API in the B2C Entry Points tabSearch Everywhere

Use it

Type or ask for completion

Inside a string, suggestions open on their own only in the arguments of calls named url, abs, http, https, render, renderTemplate, getRenderedHtml, sendEmail, append, prepend, replace, msg, msgf and on, and of methods added in SFCC Route Calls. In other strings, for example require('') or HookMgr.callHook(''), press Ctrl+Space

Read the item

SFCC items carry the Salesforce cloud icon or a matching one such as route or custom attribute . The right side names the source: cartridge, dw package, resource bundle or metadata file

Jump to the source

Cmd+Click or Cmd+B (Ctrl+Click or Ctrl+B on Windows and Linux) opens the file, route, template, bundle key, hook or attribute behind a string. With several targets the IDE lets you pick, and a site scope limits them to that site's cartridge path

Free and licensed

A license change applies at once, without a restart:

FreeNeeds a license or trial
The bundled Script API, SFRA and OCAPI typings, with completion and quick documentation of dw classesCompletion and Cmd+Click of SFCC strings: routes, templates, resource keys, hooks, forms and custom attributes
Types of module.superModule, for each over Script API collections and ES6 importsCmd+Click on require paths and module.superModule, and the cartridge on each completion item
Server .js files parsed as Digital Script, with the compatibility mode and Rhino syntax checksParameter types of callbacks, hooks, pipelets and job steps
Live templates and the New Digital Script File dialogThe template gutter icon, Code Vision, Resource.msg folding, hook documentation and the hook return check

See Purchase & License for the trial

Fast in large projects

From the plugin's performance tests on a large storefront:

TaskBefore 2026.3Now
Index a 114,000-file storefront with every plugin index32 s24 s
Resource bundle keys after opening a project or switching branches13 s0.1 s
The hooks index of the same storefront1.3 s0.45 s
Highlighting a library that 100 scripts import, after one typed character118 ms85 ms
Reindex after saving a controller35 ms31 ms

Caches follow only the files they read, so typing in one script recomputes nothing in the others, see Faster in large projects

Digital Script

.ds files and server .js files are parsed as Digital Script, the Rhino dialect B2C Commerce runs, with the same completion and navigation as JavaScript. Import calls, for each loops, type annotations and E4X work there, and the @input and @output headers of .ds pipelet scripts feed the script nodes of the Pipeline Editor, see Digital Script

Quieter inspections

The plugin turns off a few generic JavaScript checks that SFCC code trips. Your other inspections keep running

InspectionTurned off
Missing module dependencyIn every JavaScript file. require paths of a cartridge aren't npm packages
Expression statement which is not assignment or callIn every JavaScript file
ECMAScript specification is not followedIn Digital Script and server scripts of a project with linked cartridges. Real syntax errors still show. Client code under cartridge/client/ and cartridge/static/ keeps every check
The await checks and type validation against the API typingsIn Digital Script and server scripts, as above
ESLint no-undefOnly the exact 'session' is not defined. (no-undef) report, for the SFCC runtime globals such as dw, session, request, response, customer, slotcontent, importPackage, PIPELET_NEXT and trace, in server scripts of linked cartridges. B2C and global modules keep it, and every other ESLint report stays. Needs a license

Troubleshooting

SymptomWhat to do
No SFCC items in completionCheck that your license or trial is active, a cartridge is linked and indexing has finished, see Before you start
Script API completion is missing in one fileThe file is under a browser-code folder such as cartridge/client, or outside any cartridge folder
Members of a function parameter don't completePass the function straight to a typed call, or document the parameter with its dw. type, see Type Inference
req. or res. lists nothing in a routeMark SFRA's modules folder as Modules (Global Modules) Root, see SFRA Controllers
Go to Declaration lists several filesThe path exists in more than one cartridge. Pick a site scope
window, document or fetch is unresolved in a scriptExpected in server-side .js and .ds files, which B2C Commerce runs without them, see Host objects
Completion still shows nothing after linkingUse File › Invalidate Caches and restart, the index may be stale

On this page