kibana/packages/kbn-babel-plugin-package-imports
Spencer d6be4a4b06
Implement package linter (#148496)
This PR implements a linter like the TS Project linter, except for
packages in the repo. It does this by extracting the reusable bits from
the TS Project linter and reusing them for the project linter. The only
rule that exists for packages right now is that the "name" in the
package.json file matches the "id" in Kibana.jsonc. The goal is to use a
rule to migrate kibana.json files on the future.

Additionally, a new rule for validating the indentation of tsconfig.json
files was added.

Validating and fixing violations is what has triggered review by so many
teams, but we plan to treat those review requests as notifications of
the changes and not as blockers for merging.

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-01-09 16:49:29 -07:00
..
babel_plugin_package_imports.js Implement package linter (#148496) 2023-01-09 16:49:29 -07:00
BUILD.bazel Implement package linter (#148496) 2023-01-09 16:49:29 -07:00
index.js Transpile packages on demand, validate all TS projects (#146212) 2022-12-22 19:00:29 -06:00
kibana.jsonc Transpile packages on demand, validate all TS projects (#146212) 2022-12-22 19:00:29 -06:00
package.json Transpile packages on demand, validate all TS projects (#146212) 2022-12-22 19:00:29 -06:00
README.mdx Transpile packages on demand, validate all TS projects (#146212) 2022-12-22 19:00:29 -06:00
tsconfig.json Implement package linter (#148496) 2023-01-09 16:49:29 -07:00
types.ts Transpile packages on demand, validate all TS projects (#146212) 2022-12-22 19:00:29 -06:00

---
id: kibDevDocsOpsBabelPluginPackageImports
slug: /kibana-dev-docs/ops/babel-plugin-package-imports
title: "@kbn/babel-plugin-package-imports"
description: A babel plugin that transforms our @kbn/{NAME} imports into paths
date: 2022-05-19
tags: ['kibana', 'dev', 'contributor', 'operations', 'babel', 'plugin', 'packages', 'imports']
---

When developing inside the Kibana repository importing a package from any other package is just easy as
importing `@kbn/{package-name}`. However not every package is a node_module yet and while that is something we are working on to accomplish we need a way to dealing with it for now. Using this babel plugin is our transitory solution. It allows us to import from module ids and then transform it automatically back into paths on the transpiled code without friction for our engineering teams.