[TASK] boilerplate eslint config: lint browser <script> blocks from HTML with core JS rules
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- eslint, javascript
- Domain
- tooling
Research direction
Start with boilerplate/files/eslint.config.js and trace how modernFiles, browserFiles, and serverBlocks are used. Check the boilerplate dependency for eslint-plugin-sfmc and inspect test/tooling.smoke.test.js for the existing lint fixture. Done means the browser script virtual files receive the specified core JS rules, classic script handling is preserved, and the smoke test passes.
Written by the indexing model from the issue text.
Description
What
Since eslint-plugin-sfmc 5.7.0, the combined HTML processor also extracts browser JavaScript from <script> tags without runat="server". Those blocks come out as virtual files named *.html/browser-script-N.mjs (classic scripts) and *.html/browser-module-N.mjs (type="module").
The boilerplate boilerplate/files/eslint.config.js does not cover them yet:
- unicorn recommended already applies, because its
**/*.{js,mjs,cjs,ssjs}pattern matches.mjs. js.configs.recommended,no-varandprefer-constdo not apply, becausemodernFilesonly listsretrieve/**/*.js,deploy/**/*.jsand the Node files.
So inline browser JavaScript in retrieved HTML (CloudPages, emails, code snippets) misses the core JS checks.
Fix
Add a separate file list for the browser blocks and include it in the js.configs.recommended and no-var / prefer-const blocks only:
// Browser JavaScript the sfmc processor extracts from HTML <script> tags (eslint-plugin-sfmc >= 5.7.0).
const htmlBrowserBlocks = ['**/*.html/browser-*.mjs'];
// ...
{ ...js.configs.recommended, files: [...modernFiles, ...htmlBrowserBlocks], ignores: serverBlocks },
{ files: [...modernFiles, ...htmlBrowserBlocks], ignores: serverBlocks, rules: { 'no-var': 'error', 'prefer-const': 'error' } },
Do not add them to browserFiles: that block sets sourceType: 'module', which would override the plugin's script-vs-module split for classic <script> tags. The plugin already sets browser globals and ecmaVersion: 2025 for these blocks. Leave jsdoc off them (too noisy on inline snippets).
Done when
-
boilerplate/files/eslint.config.jsupdated as above - the boilerplate's
eslint-plugin-sfmcdependency is at least5.7.0 - the comment on
serverBlocksstill makes sense (only*.jschildren are SSJS; browser children are.mjs) - tooling smoke test (
test/tooling.smoke.test.js) still passes, ideally with an HTML fixture containing a browser<script>that triggersprefer-const
- Dominant language
- JavaScript
- Stars
- 166
- Forks
- 50
- Avg merge
- 11h 4m
- Merged PRs (30d)
- 36
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Accenture/sfmc-devtools
-
e/DevOps enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
Accenture/sfmc-devtools#2795 ·
Maintainers usually reply within 1 day
-
bug c/Generic validationRule
Difficulty 4/5 3-5 days Newbie friendliness 55/100
Accenture/sfmc-devtools#2794 ·
Maintainers usually reply within 1 day
-
bug c/automation
Difficulty 4/5 3-5 days Newbie friendliness 55/100
Accenture/sfmc-devtools#2792 ·
Maintainers usually reply within 1 day
-
[FEATURE] transactionalPush: check options.customKeys against the app before deployPossibly taken @orshih6 claimed this 8 days ago. Openc/mobilePushApp c/transactionalPush enhancement
Difficulty 3/5 1-2 days Newbie friendliness 74/100
Accenture/sfmc-devtools#2735 ·
Maintainers usually reply within 1 day
-
c/mobileMessage c/mobilePush c/transactionalPush c/transactionalSms enhancement
Difficulty 4/5 3-5 days Newbie friendliness 48/100
Accenture/sfmc-devtools#2733 ·
Maintainers usually reply within 1 day
All issues in Accenture/sfmc-devtools
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Life-Framework/Life-Framework#7017 ·
Maintainers usually reply within 1 day
-
agent/guide documentation help wanted stage/010-actionable
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
kubestellar/console-kb#4003 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
FilOzone/synapse-sdk#1201 · 1 comment ·
Maintainers usually reply within 1 day
-
good first issue task
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
NSC-Tech-Hub/nscth-static-website#107 ·
Maintainers usually reply within 1 day