Skip to content

Commit

Permalink
Migrate x-pack-kibana source to kibana
Browse files Browse the repository at this point in the history
  • Loading branch information
Jenkins CI authored and spalger committed Apr 24, 2018
1 parent d9d9fb2 commit fe46096
Show file tree
Hide file tree
Showing 3,245 changed files with 276,937 additions and 2,352 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
13 changes: 10 additions & 3 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
node_modules
bower_components
/data
/build
/.es
/plugins
/optimize
/src/fixtures/vislib/mock_data
/src/ui/public/angular-bootstrap
Expand All @@ -9,8 +15,6 @@
/src/core_plugins/console/public/tests/webpackShims
/src/ui/public/utils/decode_geo_hash.js
/src/core_plugins/timelion/public/webpackShims/jquery.flot.*
/tasks/vendor
/packages/*/node_modules
/packages/*/target
/packages/eslint-config-kibana
/packages/eslint-plugin-kibana-custom
Expand All @@ -19,5 +23,8 @@
/packages/kbn-ui-framework/dist
/packages/kbn-ui-framework/doc_site/build
/packages/kbn-ui-framework/generator-kui/*/templates/
!/.eslintrc.js
/x-pack/coverage
/x-pack/build
/x-pack/plugins/**/__tests__/fixtures/**
**/*.js.snap
!/.eslintrc.js
208 changes: 185 additions & 23 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
const { resolve } = require('path');
const { readdirSync } = require('fs');
const dedent = require('dedent');

module.exports = {
extends: [
'@elastic/eslint-config-kibana',
'@elastic/eslint-config-kibana/jest',
],

settings: {
'import/resolver': {
'@kbn/eslint-import-resolver-kibana': {
rootPackageName: 'kibana',
kibanaPath: '.',
},
},
'import/resolver': 'eslint-import-resolver-node',
},

overrides: [
// Enable Prettier
/**
* Prettier
*/
{
files: [
'.eslintrc.js',
Expand All @@ -27,36 +28,68 @@ module.exports = {
'packages/kbn-plugin-generator/**/*',
'packages/kbn-test-subj-selector/**/*',
'packages/kbn-eslint-import-resolver-kibana/**/*',
'x-pack/plugins/apm/**/*',
],
plugins: ['prettier'],
rules: Object.assign(
{ 'prettier/prettier': 'error' },
{
'prettier/prettier': ['error'],
},
require('eslint-config-prettier').rules,
require('eslint-config-prettier/react').rules
),
},

// files not transpiled by babel can't using things like object-spread
/**
* Allow default exports
*/
{
files: [
'.eslintrc.js',
'packages/kbn-plugin-helpers/**/*',
'packages/kbn-plugin-generator/**/*',
],
files: ['x-pack/test/functional/apps/**/*', 'x-pack/plugins/apm/**/*'],
rules: {
'prefer-object-spread/prefer-object-spread': 'off',
'kibana-custom/no-default-export': 'off',
'import/no-named-as-default': 'off',
},
},

// files that are not allowed to use devDepenedncies
/**
* Files that are allowed to import webpack-specific stuff
*/
{
files: ['packages/kbn-ui-framework/**/*'],
excludedFiles: [
'packages/kbn-ui-framework/**/*.test.js',
'packages/kbn-ui-framework/doc_site/**/*',
'packages/kbn-ui-framework/generator-kui/**/*',
'packages/kbn-ui-framework/Gruntfile.js',
files: [
'**/public/**',
'**/webpackShims/**',
'packages/kbn-ui-framework/doc_site/src/**',
'src/fixtures/**', // TODO: this directory needs to be more obviously "public" (or go away)
],
settings: {
// instructs import/no-extraneous-dependencies to treat modules
// in plugins/ or ui/ namespace as "core modules" so they don't
// trigger failures for not being listed in package.json
'import/core-modules': ['plugins', 'ui'],

'import/resolver': {
'@kbn/eslint-import-resolver-kibana': {
rootPackageName: 'kibana',
kibanaPath: '.',
pluginMap: readdirSync(resolve(__dirname, 'x-pack/plugins')).reduce(
(acc, name) => {
if (!name.startsWith('_')) {
acc[name] = `x-pack/plugins/${name}`;
}
return acc;
},
{}
),
},
},
},
},

/**
* files that ARE NOT allowed to use devDepenedncies
*/
{
files: ['packages/kbn-ui-framework/**/*', 'x-pack/**/*'],
rules: {
'import/no-extraneous-dependencies': [
'error',
Expand All @@ -68,13 +101,20 @@ module.exports = {
},
},

// files that are allowed to use devDepenedncies
/**
* files that ARE allowed to use devDepenedncies
*/
{
files: [
'packages/kbn-ui-framework/**/*.test.js',
'packages/kbn-ui-framework/doc_site/**/*',
'packages/kbn-ui-framework/generator-kui/**/*',
'packages/kbn-ui-framework/Gruntfile.js',
'x-pack/{dev-tools,gulp_helpers,scripts,test,build_chromium}/**/*',
'x-pack/**/{__tests__,__test__,__jest__,__fixtures__,__mocks__}/**/*',
'x-pack/**/*.test.js',
'x-pack/gulpfile.js',
'x-pack/plugins/apm/public/utils/testHelpers.js',
],
rules: {
'import/no-extraneous-dependencies': [
Expand All @@ -86,5 +126,127 @@ module.exports = {
],
},
},

/**
* Files that are not transpiled with babel
*/
{
files: [
'.eslintrc.js',
'**/webpackShims/**/*',
'packages/kbn-plugin-generator/**/*',
'packages/kbn-plugin-helpers/**/*',
'packages/kbn-eslint-import-resolver-kibana/**/*',
'packages/kbn-eslint-plugin-license-header/**/*',
'x-pack/gulpfile.js',
'x-pack/dev-tools/mocha/setup_mocha.js',
'x-pack/scripts/*',
],
rules: {
'import/no-commonjs': 'off',
'prefer-object-spread/prefer-object-spread': 'off',
'no-restricted-syntax': [
'error',
'ImportDeclaration',
'ExportNamedDeclaration',
'ExportDefaultDeclaration',
'ExportAllDeclaration',
],
},
},

/**
* X-Pack global overrides
*/
{
files: ['x-pack/**/*'],
rules: {
quotes: 'off',
},
},

/**
* Files that require the license headers
*/
{
files: ['x-pack/**/*.js'],
plugins: ['@kbn/eslint-plugin-license-header'],
rules: {
'@kbn/license-header/require-license-header': [
'error',
{
license: dedent`
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
`,
},
],
},
},

/**
* APM overrides
*/
{
files: ['x-pack/plugins/apm/**/*'],
rules: {
'no-unused-vars': ['error', { ignoreRestSiblings: true }],
'no-console': ['warn', { allow: ['error'] }],
},
},

/**
* Graph overrides
*/
{
files: ['x-pack/plugins/graph/**/*'],
globals: {
angular: true,
$: true,
},
rules: {
'block-scoped-var': 'off',
camelcase: 'off',
eqeqeq: 'off',
'guard-for-in': 'off',
'new-cap': 'off',
'no-loop-func': 'off',
'no-redeclare': 'off',
'no-shadow': 'off',
'no-unused-vars': 'off',
'one-var': 'off',
},
},

/**
* ML overrides
*/
{
files: ['x-pack/plugins/ml/**/*'],
rules: {
quotes: 'error',
'no-shadow': 'error',
},
},

/**
* Monitoring overrides
*/
{
files: ['x-pack/plugins/monitoring/**/*'],
rules: {
'block-spacing': ['error', 'always'],
curly: ['error', 'all'],
'no-unused-vars': ['error', { args: 'all', argsIgnorePattern: '^_' }],
'no-else-return': 'error',
},
},
{
files: ['x-pack/plugins/monitoring/public/**/*'],
env: { browser: true },
},
],
};
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
.DS_Store
.node_binaries
node_modules
!/tasks/lib/packages/__tests__/fixtures/fixture1/node_modules
!/src/dev/npm/__tests__/fixtures/fixture1/node_modules
!/src/dev/notice/__fixtures__/node_modules
trash
/optimize
target
Expand Down Expand Up @@ -38,6 +39,6 @@ selenium
!/packages/kbn-ui-framework/doc_site/build/index.html
package-lock.json
.yo-rc.json
/.vscode
.vscode
npm-debug.log*
.tern-project
16 changes: 15 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ Start elasticsearch from a nightly snapshot.
yarn es snapshot
```

Additional options are available, pass `--help` for more information.
This will run Elasticsearch with a `trial` license and bootstraped with the user `elastic` and password `changeme`. Additional options are available, pass `--help` for more information.

> You'll need to have a `java` binary in `PATH` or set `JAVA_HOME`.
Expand All @@ -197,6 +197,20 @@ Start the development server.

Now you can point your web browser to https://localhost:5601 and start using Kibana! When running `yarn start`, Kibana will also log that it is listening on port 5603 due to the base path proxy, but you should still access Kibana on port 5601.

#### Running Kibana in Open-Source mode

If you're looking to only work with the open-source software, supply the license type to `yarn es`:
```bash
yarn es snapshot --license oss
```
And start Kibana with only open-source code:
```bash
yarn start --oss
```
#### Unsupported URL Type
If you're installing dependencies and seeing an error that looks something like
Expand Down
41 changes: 0 additions & 41 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,51 +5,11 @@ module.exports = function (grunt) {
// and once during so that we have access to it via
// grunt.config.get() within the config files
const config = {
pkg: grunt.file.readJSON('package.json'),
root: __dirname,
src: __dirname + '/src',
buildDir: __dirname + '/build', // temporary build directory
plugins: __dirname + '/src/core_plugins',
server: __dirname + '/src/server',
target: __dirname + '/target', // location of the compressed build targets
configFile: __dirname + '/src/config/kibana.yml',

karmaBrowser: (function () {
if (grunt.option('browser')) {
return grunt.option('browser');
}

switch (require('os').platform()) {
case 'win32':
return 'IE';
default:
return 'Chrome';
}
}()),

nodeVersion: grunt.file.read('.node-version').trim(),

meta: {
banner: '/*! <%= package.name %> - v<%= package.version %> - ' +
'<%= grunt.template.today("yyyy-mm-dd") %>\n' +
'<%= package.homepage ? " * " + package.homepage + "\\n" : "" %>' +
' * Copyright (c) <%= grunt.template.today("yyyy") %> <%= package.author.company %>;' +
' Licensed <%= package.license %> */\n'
},
};

grunt.config.merge(config);

// must run before even services/platforms
grunt.config.set('build', require('./tasks/config/build')(grunt));

config.packageScriptsDir = __dirname + '/tasks/build/package_scripts';
// ensure that these run first, other configs need them
config.services = require('./tasks/config/services')(grunt);
config.platforms = require('./tasks/config/platforms')(grunt);

grunt.config.merge(config);

// load plugins
require('load-grunt-config')(grunt, {
configPath: __dirname + '/tasks/config',
Expand All @@ -62,5 +22,4 @@ module.exports = function (grunt) {

// load task definitions
grunt.task.loadTasks('tasks');
grunt.task.loadTasks('tasks/build');
};
Loading

0 comments on commit fe46096

Please sign in to comment.