Skip to content

WDFN-928 Use Eslint Plugin Import

Before making a pull request

  • Put the appropriate EXEMPT flag if needed in the MR label (see https://practices.wma.chs.usgs.gov/practice/peer_code_review/)
  • Run all linters (make lint)
  • Run all tests (make test)
  • Update the changelog appropriately
  • If making a release, update code.json metadataLastUpdated and bump CHANGELOG.md to next version.

WDFN-928 Use Eslint Plugin Import

This adds the Eslint Plugin Import and associated eslint-import-resolver-custom-alias which resolves aliased imports. I was not able to use the 'recommended' configuration for the Eslint Plugin Import because of errors that cropped up in several default settings.

Added from 'recommended' config

  • export
  • no-duplicates
  • named

Part of 'recommended' config that won't work because of error: Parse errors in imported module 'vitest-fetch-mock': Cannot use keyword 'await' outside an async function (7:32)

  • no-named-as-default
  • no-named-as-default-member
  • namespace

Part of 'recommended' that won't work because of unable to find a way to resolve the imports for @wma/wdfn-vue-components and vite/modulepreload-polyfill

  • no-unresolved

Not part of 'recommended' but is what does what we want for this ticket

-order

I added custom setting such that the order of imports is pretty close to what we wanted Features

  • spaces between import groups
  • group are ordered - "builtin", "external", "internal","parent", "sibling", "index", "object", "type"
  • custom rules added for files specific to waterdataui

After making a pull request

  • If appropriate, put the link to the PR in the JIRA ticket
  • Assign someone to review unless the change is trivial
  • Check the accessibility CI step and fix or explain any issues.

Merge request reports