Commit graph

45 commits

Author SHA1 Message Date
Mike Côté 2fa3c01928
Enable prettier for saved objects (#33194) 2019-03-13 18:35:20 -04:00
Joe Fleming 228d69c708
Fix: set react version to string, not semver object (#33079)
## Summary

While working on a plugin that was just using the Kibana eslint config, I saw a stream of these messages:

> Warning: React version specified in eslint-plugin-react-settings must be a string; got “object”

Looking into our eslint config, I noticed we're using `semver.coerce` to get the version from the `package.json` file in Kibana. This looked right, except that method actually returns an object:

```js
const ver = semver.coerce('^16.8.0');
console.log(ver);
```

That produces:

```
SemVer {
  options: { loose: false, includePrerelease: false },
  loose: false,
  raw: '16.8.0',
  major: 16,
  minor: 8,
  patch: 0,
  prerelease: [],
  build: [],
  version: '16.8.0' }
```

The [semver package](https://www.npmjs.com/package/semver) includes some examples where they wrap that value in `semver.valid`, which produces a string and fixes the warning.

```js
const ver = semver.valid(semver.coerce('^16.8.0'));
console.log(ver); // outputs 16.8.0
```

### So why don't we see this warning in Kibana?

I'm not sure, but I suspect it's because it's a console warning and our tooling prevents that output from showing up. 

This change stops the warning output when you run eslint in my plugin though. 

UPDATE: After some more digging, it looks like it's related to the version override in Kibana's eslintrc. Removing the override stops the linter from running, without the changes in this PR.
2019-03-13 10:50:01 -07:00
Spencer a6afcc5b66
Restore webdriver-based functional test runner driver (#31446)
* Restore webdriver-based functional test runner driver

* run all function test suites 6 times per build, to help spot flakiness

* [tests/reporting] fix flaky click on report generation

* [#31446] stabilize x-pack-ciGroup6 (#31447)

* rerun x-pack-ciGroup6 40 times

* improve reporting tests stability (#31454)

* Revert "rerun x-pack-ciGroup6 40 times"

This reverts commit 63026b1a53.

* Fix Dashboard Save tests (#32112)

* [page_objects/dashboard_page] add waitDialogIsClosed to manage dashboard popup behaviour

* [page_objects/dashboard_page] add waitDialogIsClosed flag

* services: leadfoot -> webdriver

* [services/lib/web_element_wrapper] extend type with charByChar input (#32305)

* Revert "run all function test suites 6 times per build, to help spot flakiness"

This reverts commit 477099337a.
2019-03-01 17:53:05 -08:00
Tiago Costa 514673c46e
Improve dll plugin relation with webpackshims (#30129)
* chore(NA): remove specific watch for x-pack webpackShims folder.

* chore(NA): remove xpack security plugin angular-ui-select webpackShim.

* chore(NA): bump ui-select version on x-pack to match the one used on oss kibana

* chore(NA): remove manual searching for webpackShim imports into the dll plugin. chore(NA): explicit avoid max dll compilations in all environments for the dll plugin. chore(NA): explicit throw an error and list all the not allowed modules bundled into the dll bundle.

* refact(NA): move ui related actions inside webpackShims to proper ui related files

* chore(NA): move angular ui dependencies from webpackShims to kibana core module.

* test(NA): enable xpack jest tests to be able to resolve plugins/xpack_main/*. refact(NA): rewrite code for the old xpack jquery flot webpackShim.

* refact(NA): use the already declared ui module get to list the dependencies for the kibana legacy core plugin.

* chore(NA): move angular ui requires to a better centralized place.

* refact(NA): rename areMaxCompilationsPerformed to assertMaxCompilations.

* refact(NA): remove unnecessary promise resolve on async function.

* refact(NA): remove unnecessary promise resolve on async function.

* refact(NA): apply changes according pr review.

* refact(NA): change from requires to imports in xpack_main plugin jquery flots.

* refact(NA): jquery flots missing statements.

* fix(na): linting problems.

* chore(na): re add jquery flot requires instead of imports.

* refact(NA): moving jquery flots from require to import. test(NA): fix mock for jquery_flot.

* feat(na): allow dynamic dll plugin public modules on dll bundle.

* feat(NA): step verification to not allow modules from xpack source.

* chore(NA): fix linting problems.
2019-02-22 01:45:42 +00:00
Spencer a48a03cd3e
Revert "Replace Leadfoot with WebDriver API (#26477)" (#31382)
* Revert "Replace Leadfoot with WebDriver API (#26477)"

This reverts commit 0bd3b4fdfb.

* leadfoot expectes execute args to be an array

* disable flaky graphql tests
2019-02-17 18:59:03 -08:00
Spencer cb9bf9e3b8
[ftr/services/pipelineList] reduce calls to the browser to avoid flakiness (#31366)
A minor bit of functional test flakiness [seen on master](https://kibana-ci.elastic.co/job/elastic+kibana+master/57/JOB=x-pack-ciGroup2,node=immutable/testReport/junit/X-Pack%20Functional%20Tests/test_functional_apps_logstash_pipeline_create%C2%B7js/logstash_pipeline_create_new_save_button_creates_the_pipeline_and_redirects_to_the_list/), since the move to webdriver, was caused by the `pipelineList` service. This service does a lot of async calls to read the state of the DOM, including the `selected` state of check boxes, so I thought I'd try rewriting the state reading to use a single function that reads the entire pipeline list and all related state in a single `browser.execute()` call.
2019-02-17 04:47:36 -08:00
Dmitry Lemeshko 0bd3b4fdfb
Replace Leadfoot with WebDriver API (#26477)
* [services/browser] switch to webdriver API

* [services/find] switch to webdriver API

* [services/remote] update to use webdriver service

* rename WebDriver service

* [services/remote] remove browser_driver_api

* [services/find] update to use WebDriver element wrapper

* [services/web_element_wrapper] use wrapped elements

* [services/find] use element wrapped moveMouseTo function

* [services/find] fix webdriver service init, add missing functions

* add missing functions for Leadfoot Element API

* [services/web_element_wrapper] add search by tag name

* tune WebDriver API calls to match Leadfoot

* Fixed implementation of moveMouseTo that is causing el.getClientRect error.

* fix references to WebElementWrapper

* [services/find] fix findElement call on webElementWrapper object

* fix issues in find and test_subject services

* [web_element_wrapper] add search by partial link text

* [services/find] adjust wrapper functions with Leadfoot API to support tests

* fix dragAnDrop & filer on elements displayed

* [visualise_page] improve searching of bucket element

* [discover_page] wait for visualisation loaded + dragAndDrop

* [service/find] fix exists, add pressKey for element

* fixes for visualize tests

* [services/browser] update dragAnddrop

* Made change to test to use move() code path in drag and drop.

* tune page objects for chart tests

* fix discover & xpack tests

* [page_objects/upgrade_assistant] fix locator

* [page_objects/discover_page] retry on brushHistogram to fix staleElementException

* update dragAndDrop, retry on getHeaders

* retry on getTextTag

* [services/screenshots] fix webdriver image take

* skip histogram brushed test & remove --bail

* use legacyAction for dragAndDrop with offset

* add missing await

* page objects update

* increase mocha timeout to 5 min

* use data-rendering-count to track visualization loading completion

* adjust waitForVisualizationRenderingCompleted

* [page_objects/visualize_page] add waiting for visualization

* fixes for xpack functional tests

* improve logging in find & testSubjects

* [services/find] fix wrapped element usage

* [page_objects/visual_builder_page] use BACK_SPACE key, supported by WebDriver

* page objects fix

* [services/test_subjects] add async/await

* [visualize/_tile_map] add missing await in tests

* fix tile_map tests for webdriver

* replace bluebird.prop with async/await

* try to wait for rendering in openLegendOptionColors

* additional logs in find.allByCssSelector

* [services/find] fix implicit wait  handling

* fix mapping in getRowsFromTable

* add timeouts and waitForVisualisation in failed tests

* [services/test_subjects] set default timeout to FIND_TIME

* [services/test_subjects] replace bluebird.filter with for loop

* replace retry.try with waitForVisualisation

* add 'visualize' PO import

* [services/web_element_wrapper] add scrollIntoView support

* fixing kibana-intake

* fixes after merging master

* Switching browser temporarily to firefox to get a CI run on FF.

* set chrome back to default browser

* print logs for some WebElementWrapper functions

* fix _wrap function

* update NOTICE.txt

* Fixed some firefox config to get the browser working. Consolidated some of the calls to build out the driver.

* Cleaning driver instance creation

* Added network throttling option for chrome.

* fix implicit wait setting

* uncomment bail

* adjust waiting for timepicker popup

* [services/inspector] process table in sequence

* Added conditional for TEST_THROTTLE_NETWORK option along with updating the speed and comments.

* add cheerio checks

* [services/apps_menu] get links quicker via innerHtml

* install webdriver dependency via yarn

* [services/combo_box] wrap getComboBoxSelectedOptions with retry

* remove leadfoot

* [testSubjects] remove unnecessary method

* [ftr/browser] explicitly export specific keys, keep `BACKSPACE` name

* Revert "[ftr/browser] explicitly export specific keys, keep `BACKSPACE` name"

This reverts commit 779335f2d4.

* [ftr/filterBar] allow finding filters even if they're off the page

* [webdriver] write verbose logs

* [webdriver] shim executor to run all commands in series

Best we can tell WebDriver locks up sometimes when we send too many
commands at once, sometimes... It causes random lockups where we never
receive another response from WedDriver and we don't want to live with
that risk, so for now I've shimmed the Executor class in WebDiver to
queue all calls to Executor#send() if there is already a call in
progress.

* [webdriver] add comment about why we're shimming

* [webdriver] fix queue, actually put things there and take things off

* run all functional four times per build

* [webdriver] extract preventParallelCalls to test it

* Revert "run all functional four times per build"

This reverts commit f91996d977.
2019-02-16 08:29:29 +01:00
CJ Cenizal e4ba818ff5
Reintroduce linting rule that requires single-quotes in x-pack. (#30893)
* Reintroduce linting rule that requires single-quotes in x-pack.
* Remove redundant quotes rule for ML.
* Convert ES-UI code to single quotes.
  - Dev tools
  - CCR
  - ILM
  - Index management
  - License management
  - Remote clusters
  - Rollup
  - Watcher
* Convert Graph code to single quotes.
* Convert Maps to single quotes.
* Convert Monitoring code to single quotes.
* Convert Reporting code to single quotes.
* Convert Security code to single quotes.
* Convert Telemetry code to single quotes.
* Convert Upgrade Assistant code to single quotes.
* Convert Grok Debugger to single quotes.
2019-02-14 12:08:37 -08:00
Thomas Neirynck 52fed8a52d
[Maps] Remove usage of gis from user-facing api (#29800)
This also renames the gis-folders to maps for consistency.
2019-02-01 12:07:05 -05:00
Spencer e355ec47aa
[ftr/element] custom scrollIntoView to support fixed header (#28727)
With https://github.com/elastic/kibana/pull/28503 we will be enabling the k7design by default, which adds a fixed header to the top of the page. This causes issues with the default "scroll into view" logic, as elements which are in the top overflow will be scrolled into view but then covered by the header.

My first attempt to solve this was adjusting the layout to only scroll the content below the header. This allowed the [standard scroll into view algorithm](https://drafts.csswg.org/cssom-view/#element-scrolling-members) to function as intended, but had a slightly worse UX on OSes like macOS, and @elastic/kibana-design ultimately pushed back because not allowing the body to scroll has other implications.

Instead I have implemented a `LeadfootElementWrapper#scrollIntoViewIfNecessary()` method which is automatically called before each `#click()` and `#moveMouseTo()` call. This new method scrolls the element into view when necessary, and then additionally adjusts the scroll position of the root scroll element by the necessary pixels if the top of the element is within `layout.fixedHeaderHeight` pixels.
2019-01-16 12:37:40 -08:00
Thomas Neirynck ffc8bae820
[GIS] Add Maps Plugin (#24804)
This adds the MVP of the Phase 1 version of the Maps Plugin to Kibana (https://github.com/elastic/kibana/issues/19582).

This is added as a new Stack Feature, requiring a basic license.
2018-12-19 16:14:41 -05:00
Spencer ccfa8a3530
[canvas] remove unnecessary eslint style overrides, use curlys (#27176)
* [canvas] remove styling rules that are handled by prettier, always use curlys in if

* [eslint] autofix missing curly brackets

* [eslint/canvas] remove redundant prettier plugin config

* autofix lint errors in canvas_plugin_src/renderers/time_filter/components/datetime_range_absolute/datetime_range_absolute.js
2018-12-17 17:32:06 -08:00
Bhavya RM 7e2e450486
Adding label-has-associated-control to jsx-a11y lint rules and associated UI fixes 2018-12-12 10:04:15 -05:00
Spencer 0b4ae5020b
[npm] prepare @kbn/datemath for publishing (#26559)
We need to share `@kbn/datemath` with `@elastic/eui`, and rather than making them rely on Kibana for their dependencies we've decided to republish `@kbn/datemath` as `@elastic/datemath`. This isn't something we want to do often, so please check with the platform team if you'd like to do this for another module.
2018-12-03 16:01:16 -08:00
Spencer c122fa96a0
[eslint] use disallow license header rule (#26309)
Fixes #26295

There are several places where we have accidentally added new license headers with linters but failed to remove old license headers manually. This prevents that by applying the an inverted version of the license headers rule that removed invalid license headers when files are moved.
2018-11-27 16:49:17 -08:00
Spencer 54f1a739cd
[@kbn/interpreter] improve build/packaging (#26096)
Summary of changes:

 - move all build artifacts under `target` directory
 - run babel and webpack in parallel
 - support optional watch and sourcemaps in build
 - expose /common /public /plugin /server sub-exports as index.js
 - avoid importing deeply from `@kbn/interpreter`
 - move a couple missed dependencies from x-pack to kibana
 - remove custom babel-register implementation
2018-11-23 14:16:38 -07:00
Spencer cfaa1783c3
[canvas] move yarn scripts to node scripts (#25258)
* [canvas] move yarn scripts to node scripts

* [canvas/eslint] allow scripts to access devDeps

* [canvas/eslint] remove packageDir override

* [x-pack] move babel-register to deps for canvas

* [canvas] rename scripts from : to _

* [canvas] update readme with correct script paths

* [canvas] remove yarn.lock file

* Remove redundant require
2018-11-07 10:53:06 -08:00
Spencer 5f9337e35b [canvas] unify eslint config in .eslintrc.js (#25260)
Simply remove the remaining eslint config files from canvas and merge with other canvas related overrides in `.eslintrc.js`
2018-11-07 09:33:39 -07:00
Joe Fleming f6fd86aa4d
Chore: fix canvas linting (#25024)
This fixes `yarn run lint` from within the Canvas plugin path.

- Point to the correct eslint config file
- Use absolute path for `packageDir`
- Remove extraneous `packageDir` settings
2018-11-02 11:24:11 -06:00
Bhavya RM 4c0a5e5a67
Adding jsxa11y into eslint rules (#23932) 2018-11-01 12:47:16 -04:00
Aleh Zasypkin b2baf32fba
Expose core config schema validation system as @kbn/config-schema package. (#23609) 2018-10-04 09:18:40 +02:00
Maryia Lapata 110c987c89 Update versions of @babel/parser and @babel/types (#23268)
Update versions of @babel/parser, @babel/types, eslint, babel-eslint
2018-09-25 14:35:31 +03:00
joe fleming af84ecca84 chore: eslint fixes in canvas
adds license headers and includes project linting overrides
2018-09-13 14:58:36 -07:00
Joe Fleming ef4b694e83
Chore: Reorg the x-pack gulp tasks (#22785)
- Removes deprecated, non-functional lint scripts
- Removes some unused (and barely used) dependencies
- Replaces deprecated `gulp-util` dependency
- Adds eslint rule to prevent future use of deprecated `gulp-util` dependency
- Moves all gulp tasks into `tasks` path
- Moves `gulp_helpers` into `tasks/helpers`
- All tasks in `gulpfile.js` were moved into `tasks` and broken up by domain

This is basically a no-op moving files around PR. All the existing tasks appear to work the same with these changes.

<img width="334" alt="screenshot 2018-09-06 15 42 45" src="https://user-images.githubusercontent.com/404731/45188971-8618c000-b1eb-11e8-9b26-b072ccc7ddb7.png">
2018-09-07 09:43:17 -07:00
Tyler Smalley 46bacc6c64
Workaround for yarn interdependency conflicts (#20805)
Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
2018-07-16 07:42:49 -07:00
Tim Roes cb5ee01c6a
Increase prettier line width to 100 (#20535)
* Increase prettier line width to 100

* Fix packages JS prettier

* Change style guide to 100 width

* Fix line-width in latest master changes
2018-07-09 22:50:37 +02:00
Maxim Tolochko f522b31ac9
Add draft implementation of I18n engine (#19555)
* Add draft implementation of I18n engine

* Add i18n loader

* kbn-i18n refactoring

* Fix react i18n context and update doc

* i18n engine refactoring

* Fix locales data loading and add more jsdoc comments

* Fix verify_translations task

* I18n tests refactoring

* Add build scripts to kbn-i18n package

* Fix some bugs

* Move uiI18nMixin into ui_i18n folder

* Add 'browser' field to kbn-i18n package.json

* Get rid of "showError" method

* Make i18n and i18nLoader a singleton object

* Add default locale as fallback if translation files were not registered

* Update yarn.lock

* kbn-i18n fix

* Add default formats

* Try to fix build

* Add more examples into kbn-i18n/README.md

* kbn-i18n fix

* Fix app_bootstrap tests

* Add links to issues in TODO comments
2018-06-28 12:38:39 +03:00
Josh Soref 2b27fb1c5f Fix misspellings (#19981) 2018-06-26 20:17:41 -07:00
Spencer f0cc432faf
Apache 2.0 license headers (#19383)
In order to make the license that applies to each file as clear as possible, and to be consistent with elasticsearch, we are adding Apache 2.0 license headers to the top of each file.

Existence of this header is enforced by eslint and tslint and missing headers were automatically added in the last commit by running:

```
node scripts/eslint --fix && node scripts/tslint --fix
```
2018-05-28 20:06:30 -07:00
Tiago Costa 194aba149f
Validate current node version (#19154)
* feat(12976): node version validation at runtime.

* refact(12976): move the code into a static utilities class.

* test(12976): added first test case using jest.

* test(12976): added test cases for node_version.

* feat(12976): create setup env node to bootstrap babel, ts-node and node version validator.

* refact(12976): migrated node version code from es6 to es5.

* feat(12976): node version validation at runtime.

* refact(12976): move the code into a static utilities class.

* test(12976): added first test case using jest.

* test(12976): added test cases for node_version.

* feat(12976): create setup env node to bootstrap babel, ts-node and node version validator.

* refact(12976): migrated node version code from es6 to es5.

* fix(12976): remove one level from ts node register cache directory link.

* chore(12976): added caret to semver dependecy in order to support minor versions.

* refact(12976): small change from named import to default import on node version validator.

* refact(12976): removed ts_node_register and add the code to babel_register.

* feat(12976): split eslint config in order to properly support files built to run before and after node version validator. refact(12976): convert script files to es5 code. refact(12976): delete inline eslint configs from node version check related files.

* refact(12976): remove ts node register file.

* refact(12976): completely port setup_node_env to es5.

* refact(12976): remove babel_register invokation from external dependencies in scripts.

* refact(12976): move node_version code directly into node_version_validator inside setup_node_env folder.

* refact(12976): only node version validator for kbn script.
2018-05-25 18:43:01 +01:00
Spencer 0b03166d2d
[eslint] unify resolver configs (#19102)
* [eslint] unify resolver configs

Our eslint resolver settings currently rely on the fact that we define
our resolver with a string globally, and an object in the overrides.
This causes the override value to completely override/replace the global
setting, which is desired, but when the global setting is converted to
an object they are merged, causing both resolvers to run.

This is a problem because some dependencies in the UI side of things
will resolve with the node resolver, but will resolve incorrectly
because they are intended to use some webpack specific override.

While trying to add TypeScript I needed to pass argument to the node
resolver which uncovered this issue. The change here moves us away from
using the node resolver directly and instead uses the kibana resolver
with `forceNode: true` set when linting server code and `forceNode:
false` when resolving imports that will be handled by webpack.

* [import-resolver] use object spread operator
2018-05-16 10:45:41 -07:00
Tim Roes f579d2299f
Update React to 16.3 (#18768)
* Update React to 16.3

* Switch off specific eslint rules

* Update enzyme snapshots

* Incorporate PR feedback
2018-05-14 14:05:17 +02:00
archana b58e757794
Functional test setup with kbn-test package (#18568)
Restructure testing with kbn-test package

 - Run with multiple configs, move cli options to config
 - Package-ify kbn-test
 - Eventually we'll have functional_test_runner live in a package
of its own, and then this kbn-test will use that as a dependency,
probably still as a devDependency.
 - Implement functional_tests_server
 - Collapse single and multiple config apis into one command

Use kbn-es

Replace es_test_cluster + es_test_config with kbn/test utils

Implement new createEsTestCluster

Improve scripts, jsdocs, cli top-level tools

Lift error handling to the top level
2018-05-09 18:23:49 -05:00
Spencer e1a2fcbd96
[uiExports] migrate uiApp "uses" to explicit imports in apps (#17828)
* [uiExports] migrate uiApp "uses" to explicit imports in apps

* [uiApp] update tests for getModules() method

* [optimize/uiExports] improve naming and comments

* [uiExports] sort imports so they load in the same order as before

* [testHarness] load hacks when testing in the browser

* [x-pack/uiExports] use new uiExports modules

* [testHarness] describe why we import uiExports/hacks

* [optimize] remove needless [].concat()

* [optimize/createUiExportsModule] string.includes > string.indexOf

* [uiExports/createUiExportsModule] remove needless capture of module exports
2018-05-03 12:18:50 -07:00
Jenkins CI fe4609647d Migrate x-pack-kibana source to kibana 2018-04-24 13:48:10 -07:00
Kim Joar Bekkelund ef900fd42d
Enable Prettier for more packages (#17763) 2018-04-20 17:13:34 +02:00
Spencer 4f2a19bd9b
[eslint-import-resolver-kibana] bring in repo as package (#17665)
* [eslint-import-resolver-kibana] bring in repo as package

* [eslint-import-resolver] enable prettier
2018-04-11 15:21:29 -07:00
Tyler Smalley 82e17f435f
[kbn-es] Package for managing Elasticsearch during dev and testing (#17168)
Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
2018-03-20 08:30:15 -07:00
Spencer ef3339bd7a
[@kbn/ui-framework] move ui-framework to a package (#17085)
* [@kbn/ui-framework] move ui-framework to a package

* [@kbn/ui-framework] restore doc_site index.html and fix build task names

* [jest] always ignore modules in target dirs
2018-03-13 10:43:39 -07:00
Spencer 4d246a10a8
[kbn-pm] rename from kbn-build (#16739) 2018-02-14 10:57:13 -07:00
Kim Joar Bekkelund 1c3b404774
Production package example: datemath (#16531) 2018-02-13 21:49:55 +01:00
Spencer 2c7a1f34cb
[kbn-plugin-generator] add plugin generator to the repo (#16655)
* [kbn-plugin-generator] add plugin generator to the repo

* [plugin-generator] use snake_case plugin name for directory name

* [plugin-generator] fix typo

* [plugin-generator] remove translation support until we resume i18n efforts

* [yarn] update lockfile

* [mocha] remove plugin-generator selector from mocha tests

* [plugin-generator] update generated readme to recommend yarn

* [plugin-generator] add readme to generator pacakge

* [plugin-generator] link from plugin-resource docs

* [plugin-generator] mention very important `kbn bootstrap` script

* [plugin-generator] rework some parts of the README

* [plugin-generator] log actual directory name with system separators

* [plugin-generator] include bootstrap/yarn preinstall check script
2018-02-12 12:23:23 -07:00
spalger 9f6ebb12b6 [kbn-plugin-helpers] remove redundant configs 2018-02-08 11:57:08 -07:00
Spencer b596ad3d5d
[eslint] un-ignore .eslintrc.js (#16542) 2018-02-05 16:29:30 -07:00
Kim Joar Bekkelund e58b43f744
Prettier + ESLint setup (#16514)
* Move .eslintrc (yaml) to .eslintrc.js (js)

* Add Prettier setup to ESLint

* Run Prettier on @kbn/build

* Update style guide with Prettier
2018-02-05 18:18:43 +01:00