kibana/packages
Tiago Costa ed795d28ee
Migrate from tslint (#33826)
* chore(NA): remove tslint dependencies, configs and enable eslint typescript parser.

* fix(NA): apply recommend eslint typescript rule.s

* chore(NA): upgrade eslint package versions.

* chore(NA): split javascript eslint config in an override section.

* chore(NA): split all eslint configs with overrides.

* chore(NA): remove missing console.log.

* chore(NA): change eslint splits and overrides order.

* chore(NA): replace tslint disable comments with eslint ones.

* chore(NA): solve eslint typescript errors for elastic/kibana-custom/no-default-export

* chore(NA): fixed multiple eslint typescript rule failures.

* chore(NA): add tarfet folder to the eslint ignore.

* chore(NA): apply prettier rule to ts type file.

* chore(NA): remove last mentions to tslint

* chore(NA): add old defined rules

* chore(NA): missing port rules website

* chore(na): ordered rules

* chore(NA): solved eslint typescript problems.

* chore(NA): fix spaced comment problems.

* chore(NA): fix some more eslint typescript rules: import/order no-empty-interface

* chore(NA): fix last rules and comment out what are the ones still failing.

* chore(NA): comment out camelcase rule.

* chore(NA): regenerate kbn pm dist.

* chore(NA): updated snapshots.

* chore(NA): updated snapshots.

* chore(NA): disabled sort-keys rule.

* chore(NA): remove rule prefer-arrow/prefer-arrow-functions.

* chore(NA): fix for @typescript-eslint/no-var-requires rule.

* chore(NA): fixes for @typescript-eslint/camelcase rule.

* chore(NA): fix typo on eslint config kibana typescript.

Co-Authored-By: mistic <tiagoffcc@hotmail.com>

* chore(NA): remove legacy note after the intellij upgrade to 2019.1

* fix(NA): import order plugin.

* chore(NA): fix ts ignore positions after auto fix.

* fix(NA): performance issue with typescript eslint.

* refact(NA): eslint configs organization.

* chore(NA): apply resticted paths to ts files too.

* chore(NA): split comment from eslint ignore.
2019-04-05 17:45:23 +01:00
..
elastic-datemath Migrate from tslint (#33826) 2019-04-05 17:45:23 +01:00
eslint-config-kibana Migrate from tslint (#33826) 2019-04-05 17:45:23 +01:00
kbn-babel-code-parser Migration to Babel7 and @babel/preset-typescript (#33093) 2019-03-26 20:44:03 +00:00
kbn-babel-preset Migration to Babel7 and @babel/preset-typescript (#33093) 2019-03-26 20:44:03 +00:00
kbn-config-schema [ts][ftr] improve types for ftr and expect.js, cleanup changes to tsconfig files (#31948) 2019-02-28 12:06:00 -08:00
kbn-dev-utils Migrate from tslint (#33826) 2019-04-05 17:45:23 +01:00
kbn-es [kbn/es] print headers when requests fail (#34237) 2019-03-31 18:17:12 -07:00
kbn-es-query Migrate from tslint (#33826) 2019-04-05 17:45:23 +01:00
kbn-eslint-import-resolver-kibana Prefer third-party plugin development in ./plugins instead of ../kibana-extra (#31748) 2019-03-07 17:04:29 -06:00
kbn-eslint-plugin-eslint Migrate from tslint (#33826) 2019-04-05 17:45:23 +01:00
kbn-expect Migrate from tslint (#33826) 2019-04-05 17:45:23 +01:00
kbn-i18n Migrate from tslint (#33826) 2019-04-05 17:45:23 +01:00
kbn-interpreter renaming 'api/canvas' endpoint to 'api/interpreter' (#34410) 2019-04-03 12:25:45 +02:00
kbn-plugin-generator Migrate from tslint (#33826) 2019-04-05 17:45:23 +01:00
kbn-plugin-helpers Migration to Babel7 and @babel/preset-typescript (#33093) 2019-03-26 20:44:03 +00:00
kbn-pm Migrate from tslint (#33826) 2019-04-05 17:45:23 +01:00
kbn-test Migration to Babel7 and @babel/preset-typescript (#33093) 2019-03-26 20:44:03 +00:00
kbn-test-subj-selector Migrate from tslint (#33826) 2019-04-05 17:45:23 +01:00
kbn-ui-framework Update readme for KUI to note deprecation (#34389) 2019-04-02 14:38:45 -07:00
README.md [npm] prepare @kbn/datemath for publishing (#26559) 2018-12-03 16:01:16 -08:00

Kibana-related packages

This folder contains packages that are intended for use in Kibana and Kibana plugins.

tl;dr:

  • Don't publish to npm registry
  • Always use the @kbn namespace
  • Always set "private": true in package.json

Using these packages

We no longer publish these packages to the npm registry. Now, instead of specifying a version when including these packages, we rely on yarn workspaces, which sets up a symlink to the package.

For example if you want to use the @kbn/i18n package in Kibana itself, you can specify the dependency like this:

"@kbn/i18n": "1.0.0"

However, if you want to use this from a Kibana plugin, you need to use a link: dependency and account for the relative location of the Kibana repo, so it would instead be:

"@kbn/i18n": "link:../../kibana/packages/kbn-i18n"

How all of this works is described in more detail in the @kbn/pm docs.

Creating a new package

Create a new sub-folder. The name of the folder should mirror the name in the package's package.json. E.g. if the name is @kbn/i18n the folder name should be kbn-i18n.

All new packages should use the @kbn namespace, and should be marked with "private": true.

Unit tests for a package

Currently there are two patterns used to test packages, one using Mocha and one using Jest. These patterns emerged out of convention and we'd like to make them more similar to each other in the near future.

1. Mocha

Today a package can follow the pattern of having a __tests__ directory in each source code directory of a package which contains the tests for that module. These are usually run by Mocha.

If a package's tests should be run with Mocha, you'll have to opt-in to run them by appending the package's test file pattern(s) to Kibana's tasks/config/simplemocha.js file. These will then be run by the unit test runner.

  • yarn test or yarn grunt test runs all unit tests.
  • node scripts/mocha runs all Mocha tests.

2. Jest

A package can also follow the pattern of having .test.js files as siblings of the source code files, and these run by Jest.

A package using the .test.js naming convention will have those tests automatically picked up by Jest and run by the unit test runner, currently mapped to the Kibana test script in the root package.json.

  • yarn test or yarn grunt test runs all unit tests.
  • node scripts/jest runs all Jest tests in Kibana.

Each package can also specify its own test script in the package's package.json, for cases where you'd prefer to run the tests from the local package directory.