Skip to content

Add eslint rule to support breaking up packages#130483

Merged
spalger merged 3 commits intoelastic:mainfrom
spalger:implement/eslint/exports-moved-packages-rule
Apr 18, 2022
Merged

Add eslint rule to support breaking up packages#130483
spalger merged 3 commits intoelastic:mainfrom
spalger:implement/eslint/exports-moved-packages-rule

Conversation

@spalger
Copy link
Copy Markdown
Contributor

@spalger spalger commented Apr 18, 2022

Adds a new ESLint rule to assist in breaking up packages. This is a process we expect to encourage folks use quite often, so I wanted to make it easier to handle as well as lessen the cost on contributors who already know where to import specific things from. This rule accepts a single config array in the following shape:

'@kbn/imports/exports_moved_packages': ['error', [
  {
    fromPackage: '@kbn/kitchen-sink',
    toPackage: '@kbn/spatula',
    exportNames: [
      'Spatula',
      'isSpatula'
    ]
  }
]]

This config will find any import of @kbn/kitchen-sink which specifically names either the Spatula or isSpatula export name, remove those exports (and potentially the entire import statement) and move them to a new import for @kbn/kitchen-sink. The rule assumes that toPackage is a new package so there's no reason to support adding the export to another existing import in the file. This is an opportunity for enhancement in the future if we need it.


Originally included this in #130464 but wanted to have a specific point to reference this new rule in the future.

@spalger spalger added Team:Operations Kibana-Operations Team release_note:skip Skip the PR/issue when compiling release notes v8.3.0 labels Apr 18, 2022
@spalger spalger requested a review from a team as a code owner April 18, 2022 16:49
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/kibana-operations (Team:Operations)

Copy link
Copy Markdown
Contributor

@mistic mistic left a comment

Choose a reason for hiding this comment

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

good idea, LGTM

@spalger spalger force-pushed the implement/eslint/exports-moved-packages-rule branch from bc2543e to f330a3a Compare April 18, 2022 17:24
@kibana-ci
Copy link
Copy Markdown

💚 Build Succeeded

Metrics [docs]

✅ unchanged

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@spalger spalger merged commit 20f05e2 into elastic:main Apr 18, 2022
@spalger spalger deleted the implement/eslint/exports-moved-packages-rule branch April 18, 2022 18:47
@kibanamachine kibanamachine added the backport:skip This PR does not require backporting label Apr 18, 2022
jloleysens added a commit to jloleysens/kibana that referenced this pull request Apr 19, 2022
…disable-server-side

* 'main' of github.com:elastic/kibana: (103 commits)
  [Osquery] Update eslint config (elastic#129637)
  [Uptime] Update monitor saved object mappings (elastic#130433)
  Add links to metricbeat module docs (elastic#130519)
  Add link to troubleshooting guide in confirm data copy (elastic#130420)
  [Step 3] Cleanup charts plugin (elastic#130132)
  [Visualize] Adds a deprecation warning to the pie app (elastic#130447)
  [Maps] fix vector tile load errors not displayed in legend (elastic#130395)
  [CI] Split alerting-api-integration tests into separate cigroups (elastic#130414)
  [CI] Use spot instances for default cigroups in PR CI (elastic#130476)
  [functional-tests] TimePicker optimizations (elastic#130200)
  [kbn/pm] use stable module ids in dist (elastic#130497)
  [8.2.1][Security Solution][Session view] fix full screen session view margin (elastic#130496)
  Fix wrong config in comments (elastic#130378)
  Add deprecated telemetry (elastic#130458)
  Add eslint rule to support breaking up packages (elastic#130483)
  [Security Solution][Endpoint] Fix test stability and un-skip flaky tests (elastic#130176)
  Update object types for SharePoint Online external connector (elastic#130478)
  [Workplace Search] Fix broken feedback link (elastic#130475)
  Rename the term "execution" in config to "run" (elastic#130172)
  [Cloud Posture] use index with keyword mapping (elastic#130456)
  ...

# Conflicts:
#	docs/user/reporting/index.asciidoc
#	x-pack/plugins/reporting/public/types.ts
#	x-pack/plugins/screenshotting/server/screenshots/index.test.ts
#	x-pack/plugins/screenshotting/server/screenshots/index.ts
kertal pushed a commit to kertal/kibana that referenced this pull request May 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting release_note:skip Skip the PR/issue when compiling release notes Team:Operations Kibana-Operations Team v8.3.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants