Uploaded image for project: 'Hybrid Cloud Console'
  1. Hybrid Cloud Console
  2. RHCLOUD-26623

ESLint's disallow-fec-relative-imports rule rewrites to invalid paths

XMLWordPrintable

    • False
    • Hide

      None

      Show
      None
    • False
    • Unset
    • No
    • Plat-Ex Services Sprint 2, Plat-Ex Services Sprint 3, Plat-Ex Services Sprint 4

      The custom ESLint rule published by platform `disallow-fec-relative-imports` rewrites named imports from all of the @redhat-cloud-services/frontend-components-* libraries.

      For example,

      `import { changePagination } from '@redhat-cloud-services/frontend-components-utilities` must be rewritten to

      `import changePagination from '@redhat-cloud-services/frontend-components-utilities/changePagination';`

      However, the library doesn't contain default export from the /changePagination path and the build will fail because path cannot be resolved. Ignoring the rule is not the best practice (especially, if one puts the ignore label to the whole module: any situations, where this rule in this particular module would be helpful, will be not noticed by devs).

       

      You can find more examples here: https://github.com/RedHatInsights/insights-inventory-frontend/pull/1908/commits/5b81ce96fcf2258a0fe5650d6c2e7bb4b2858335.

       

      Acceptance criteria

      • The algorithm is enhanced and the eslint rule fires only when the suggested path rewrite does really exists and won't break a build.

              apinkert-insights Austin Pinkerton
              gkaratae Georgii Karataev
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: