Skip to content

Commit

Permalink
Merge branch 'master' into alerting/cannot_disable
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine authored Oct 1, 2021
2 parents ba7d9ec + 56e17cd commit aab6a88
Show file tree
Hide file tree
Showing 214 changed files with 4,307 additions and 1,468 deletions.
8 changes: 0 additions & 8 deletions .buildkite/pipelines/es_snapshots/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,5 @@ steps:
- wait: ~
continue_on_failure: true

- plugins:
- junit-annotate#v1.9.0:
artifacts: target/junit/**/*.xml
job-uuid-file-pattern: '-bk__(.*).xml'

- wait: ~
continue_on_failure: true

- command: .buildkite/scripts/lifecycle/post_build.sh
label: Post-Build
8 changes: 0 additions & 8 deletions .buildkite/pipelines/hourly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -159,13 +159,5 @@ steps:
- wait: ~
continue_on_failure: true

- plugins:
- junit-annotate#v1.9.0:
artifacts: target/junit/**/*.xml
job-uuid-file-pattern: '-bk__(.*).xml'

- wait: ~
continue_on_failure: true

- command: .buildkite/scripts/lifecycle/post_build.sh
label: Post-Build
14 changes: 14 additions & 0 deletions .buildkite/scripts/lifecycle/annotate_test_failures.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const { TestFailures } = require('kibana-buildkite-library');

(async () => {
try {
await TestFailures.annotateTestFailures();
} catch (ex) {
console.error('Annotate test failures error', ex.message);
if (ex.response) {
console.error('HTTP Error Response Status', ex.response.status);
console.error('HTTP Error Response Body', ex.response.data);
}
process.exit(1);
}
})();
5 changes: 5 additions & 0 deletions .buildkite/scripts/lifecycle/post_command.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,9 @@ if [[ "$IS_TEST_EXECUTION_STEP" == "true" ]]; then
buildkite-agent artifact upload '.es/**/*.hprof'

node scripts/report_failed_tests --build-url="${BUILDKITE_BUILD_URL}#${BUILDKITE_JOB_ID}" 'target/junit/**/*.xml'

if [[ -d 'target/test_failures' ]]; then
buildkite-agent artifact upload 'target/test_failures/**/*'
node .buildkite/scripts/lifecycle/annotate_test_failures.js
fi
fi
1 change: 0 additions & 1 deletion docs/setup/install/deb.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ locations for a Debian-based system:
| Configuration files including `kibana.yml`
| /etc/kibana
| <<settings,KBN_PATH_CONF>>
d|

| data
| The location of the data files written to disk by Kibana and its plugins
Expand Down
1 change: 1 addition & 0 deletions packages/elastic-eslint-config-kibana/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,5 +93,6 @@ module.exports = {

'@kbn/eslint/no_async_promise_body': 'error',
'@kbn/eslint/no_async_foreach': 'error',
'@kbn/eslint/no_trailing_import_slash': 'error',
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ it('produces the right watch and ignore list', () => {
expect(ignorePaths).toMatchInlineSnapshot(`
Array [
/\\[\\\\\\\\\\\\/\\]\\(\\\\\\.\\.\\*\\|node_modules\\|bower_components\\|target\\|public\\|__\\[a-z0-9_\\]\\+__\\|coverage\\)\\(\\[\\\\\\\\\\\\/\\]\\|\\$\\)/,
/\\\\\\.test\\\\\\.\\(js\\|tsx\\?\\)\\$/,
/\\\\\\.\\(test\\|spec\\)\\\\\\.\\(js\\|ts\\|tsx\\)\\$/,
/\\\\\\.\\(md\\|sh\\|txt\\)\\$/,
/debug\\\\\\.log\\$/,
<absolute path>/src/plugins/*/test/**,
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-cli-dev-mode/src/get_server_watch_paths.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export function getServerWatchPaths({ pluginPaths, pluginScanDirs }: Options) {

const ignorePaths = [
/[\\\/](\..*|node_modules|bower_components|target|public|__[a-z0-9_]+__|coverage)([\\\/]|$)/,
/\.test\.(js|tsx?)$/,
/\.(test|spec)\.(js|ts|tsx)$/,
/\.(md|sh|txt)$/,
/debug\.log$/,
...pluginInternalDirsIgnore,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

export interface ManagedConfigKey {
key: string;
value: string | Record<string, any>;
value: string | Record<string, any> | boolean;
}

/**
Expand Down Expand Up @@ -42,4 +42,8 @@ export const MANAGED_CONFIG_KEYS: ManagedConfigKey[] = [
// we use a relative path here so that it works with remote vscode connections
value: './node_modules/typescript/lib',
},
{
key: 'typescript.enablePromptUseWorkspaceTsdk',
value: true,
},
];
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ const createObjectPropOfManagedValues = (key: string, value: Record<string, any>
const addManagedProp = (
ast: t.ObjectExpression,
key: string,
value: string | Record<string, any>
value: string | Record<string, any> | boolean
) => {
ast.properties.push(
typeof value === 'string'
typeof value === 'string' || typeof value === 'boolean'
? createManagedProp(key, value)
: createObjectPropOfManagedValues(key, value)
);
Expand All @@ -89,7 +89,7 @@ const addManagedProp = (
const replaceManagedProp = (
ast: t.ObjectExpression,
existing: BasicObjectProp,
value: string | Record<string, any>
value: string | Record<string, any> | boolean
) => {
remove(ast.properties, existing);
addManagedProp(ast, existing.key.value, value);
Expand Down
1 change: 1 addition & 0 deletions packages/kbn-eslint-plugin-eslint/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ module.exports = {
no_export_all: require('./rules/no_export_all'),
no_async_promise_body: require('./rules/no_async_promise_body'),
no_async_foreach: require('./rules/no_async_foreach'),
no_trailing_import_slash: require('./rules/no_trailing_import_slash'),
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

/** @typedef {import("eslint").Rule.RuleModule} Rule */
/** @typedef {import("@typescript-eslint/typescript-estree").TSESTree.ImportDeclaration} ImportDeclaration */

const ERROR_MSG =
'Using a trailing slash in package import statements causes issues with webpack and is inconsistent with the rest of the respository.';

/** @type {Rule} */
module.exports = {
meta: {
fixable: 'code',
schema: [],
},
create: (context) => ({
ImportDeclaration(_) {
const node = /** @type {ImportDeclaration} */ (_);
const req = node.source.value;

if (!req.startsWith('.') && req.endsWith('/')) {
context.report({
message: ERROR_MSG,
loc: node.source.loc,
fix(fixer) {
return fixer.replaceText(node.source, `'${req.slice(0, -1)}'`);
},
});
}
},
}),
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

const { RuleTester } = require('eslint');
const rule = require('./no_trailing_import_slash');
const dedent = require('dedent');

const ruleTester = new RuleTester({
parser: require.resolve('@typescript-eslint/parser'),
parserOptions: {
sourceType: 'module',
ecmaVersion: 2018,
ecmaFeatures: {
jsx: true,
},
},
});

ruleTester.run('@kbn/eslint/no_trailing_import_slash', rule, {
valid: [
{
code: dedent`
import foo from 'bar';
`,
},
{
code: dedent`
import foo from './bar';
`,
},
{
code: dedent`
import foo from './bar/';
`,
},
],

invalid: [
{
code: dedent`
import foo from 'bar/';
`,
errors: [
{
line: 1,
message:
'Using a trailing slash in package import statements causes issues with webpack and is inconsistent with the rest of the respository.',
},
],
output: dedent`
import foo from 'bar';
`,
},
{
code: dedent`
import foo from 'bar/box/';
`,
errors: [
{
line: 1,
message:
'Using a trailing slash in package import statements causes issues with webpack and is inconsistent with the rest of the respository.',
},
],
output: dedent`
import foo from 'bar/box';
`,
},
],
});
2 changes: 2 additions & 0 deletions packages/kbn-test/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ RUNTIME_DEPS = [
"@npm//exit-hook",
"@npm//form-data",
"@npm//globby",
"@npm//he",
"@npm//history",
"@npm//jest",
"@npm//jest-cli",
Expand Down Expand Up @@ -85,6 +86,7 @@ TYPES_DEPS = [
"@npm//xmlbuilder",
"@npm//@types/chance",
"@npm//@types/enzyme",
"@npm//@types/he",
"@npm//@types/history",
"@npm//@types/jest",
"@npm//@types/joi",
Expand Down
Loading

0 comments on commit aab6a88

Please sign in to comment.