Skip to content

fix: Add eslint disable to the bundled import script file - #91

Merged
swetabar merged 1 commit into
mainfrom
xmod-issue-845
Apr 23, 2026
Merged

fix: Add eslint disable to the bundled import script file#91
swetabar merged 1 commit into
mainfrom
xmod-issue-845

Conversation

@swetabar

Copy link
Copy Markdown
Contributor

Description

Added banner: { js: '/* eslint-disable */' } to the esbuild config in aem-import-helper's src/import/bundler.js (and updated test/import/bundler.test.js) so
generated .bundle.js files don't trigger lint errors in downstream EDS projects.

Related Issue

https://github.com/Adobe-AEM-Foundation/aem-experience-catalyst/issues/845

Motivation and Context

Bundles generated by aem-import-helper bundle are written to tools/importer/<name>.bundle.js in consuming EDS projects, where they get picked up by the project's
ESLint config and produce hundreds of lint errors during the build (unused vars, non-standard formatting from the minified IIFE, etc.).

Downstream consumers currently work around this by either adding tools/importer/**/*.bundle.js to .eslintignore or post-processing the file to prepend a disable
banner. Both approaches require every consumer to know about the issue and apply the fix themselves.

Since the bundler is the single source of these files and esbuild already supports a banner option, emitting /* eslint-disable */ as the first line at generation
time is the cleanest fix — it makes the artifact safe by default for every consumer with no additional config.

How Has This Been Tested?

  cd /tmp && rm -rf banner-test && mkdir banner-test && cd banner-test                                                                                                 

Minimal valid import script

cat > import-foo.js <<'EOF'
  export default {                                                                                                                                                     
    transform: ({ document }) => ({ path: '/foo', document }),
  }; 

Point npx at your local checkout so it uses your edits

npx --package=<absolute-path-to-aem-import-helper-repo> aem-import-helper bundle --importjs ./import-foo.js                                                                                                                                                           
head -n 1 import-foo.bundle.js   # should print: /* eslint-disable */                   

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@swetabar
swetabar requested a review from arumsey April 23, 2026 17:41

@arumsey arumsey left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! I think it is fine to add this to every bundle request. Even those outside of ExMod.

@swetabar
swetabar merged commit 1ec6e79 into main Apr 23, 2026
6 checks passed
@swetabar
swetabar deleted the xmod-issue-845 branch April 23, 2026 17:44
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 1.5.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants