Skip to content

feat: Eslint for Magento driver exports in package.json#4447

Draft
joannalauu wants to merge 3 commits intodevelopfrom
driver-eslint
Draft

feat: Eslint for Magento driver exports in package.json#4447
joannalauu wants to merge 3 commits intodevelopfrom
driver-eslint

Conversation

@joannalauu
Copy link
Copy Markdown
Contributor

@joannalauu joannalauu commented Apr 20, 2026

PR Checklist

  • Commit message follows our contributing guidelines
  • Tests added/updated (for bug fixes/features)
  • Documentation added/updated (for bug fixes/features)

PR Type

  • Bug fix
  • Feature
  • Style update
  • Refactor
  • Test
  • Build
  • CI
  • Docs
  • Performance
  • Other (please describe)

Current behavior

Fixes: #4436

New behavior

Provides the following eslint errors to ensure naming consistency in Magento driver exports in package.json:

  • invalidKey: Key {{key}} is not a valid Magento version condition. Expected magento-<major>.<minor>.<patch>
  • missingVersion: Missing Magento version condition {{key}}. All @daffodil packages exposing a Magento driver must declare the same set of versions
  • entryNotObject: Condition {{key}} must be an object with types and default fields
  • missingField: Condition {{key}} is missing required field {{field}} - this checks that there are exports conditions for all Magento driver versions in that package
  • typesPathMismatch: Condition {{key}} has a types path that does not reference ./driver/magento/{{version}}/
  • defaultPathMismatch: Condition {{key}} has a default path that does not end with -magento-{{version}}.mjs

Breaking change?

  • Yes
  • No

Additional context

@joannalauu joannalauu requested a review from a team as a code owner April 20, 2026 06:31
@joannalauu joannalauu changed the title eslint rule for magento driver exports in package.json feat: Eslint for Magento driver exports in package.json Apr 20, 2026
const VERSION_FROM_KEY_RE = /^magento-(\d+\.\d+\.\d+)$/;
const VERSION_DIR_RE = /^\d+\.\d+\.\d+$/;

function readPackageVersions(pkgDir) {
Copy link
Copy Markdown
Contributor Author

@joannalauu joannalauu Apr 22, 2026

Choose a reason for hiding this comment

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

Different packages have a different set of Magento versions. For example, order has versions 2-4-0 and 2-4-1 while external-router has versions 2.4.1, 2.4.2, 2.4.3. There is unresolved complexity on whether we should define different versions for different packages, or standardize versions across all packages so that we can set the version once for all packages

Comment on lines +14 to +16
const MAGENTO_KEY_RE = /^magento-\d+\.\d+\.\d+$/;
const VERSION_FROM_KEY_RE = /^magento-(\d+\.\d+\.\d+)$/;
const VERSION_DIR_RE = /^\d+\.\d+\.\d+$/;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This currently expects the folder of the versioned Magento driver to be named as driver/magento/<v>.<v>.<v>. However, in the order package, it is named as driver/magento/<v>-<v>-<v>, which deviates from expected pattern

@joannalauu joannalauu marked this pull request as draft April 22, 2026 06:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

build: create ESLint rule for package.json exports

1 participant