Skip to content

Commit

Permalink
Fix linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
thomheymann committed Mar 3, 2021
1 parent 4c2b9cc commit 65c4cd2
Show file tree
Hide file tree
Showing 10 changed files with 41 additions and 34 deletions.
2 changes: 1 addition & 1 deletion x-pack/plugins/security/common/model/api_key.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

import { Role } from './role';
import type { Role } from './role';

export interface ApiKey {
id: string;
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/security/public/components/breadcrumb.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import type { FunctionComponent } from 'react';
import React, { createContext, useContext, useEffect, useRef } from 'react';

import { useKibana } from '../../../../../src/plugins/kibana_react/public';
import { ChromeStart } from '../../../../../src/core/public';
import type { ChromeStart } from '../../../../../src/core/public';

interface BreadcrumbsContext {
parents: BreadcrumbProps[];
Expand Down
5 changes: 3 additions & 2 deletions x-pack/plugins/security/public/components/copy_code_field.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
* 2.0.
*/

import React, { FunctionComponent } from 'react';
import type { FunctionComponent } from 'react';
import React from 'react';
import { i18n } from '@kbn/i18n';
import type { EuiFieldTextProps } from '@elastic/eui';
import {
EuiButtonIcon,
EuiCode,
EuiCopy,
EuiFieldTextProps,
EuiFlexGroup,
EuiFlexItem,
EuiFormControlLayout,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
* 2.0.
*/

import { useRef, useEffect, DependencyList } from 'react';
import type { DependencyList } from 'react';
import { useRef, useEffect } from 'react';

/**
* Creates a ref for an HTML element, which will be focussed on mount.
Expand All @@ -32,6 +33,6 @@ export function useInitialFocus<T extends HTMLElement>(deps: DependencyList = []
if (inputRef.current) {
inputRef.current.focus();
}
}, deps);
}, deps); // eslint-disable-line react-hooks/exhaustive-deps
return inputRef;
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
/*
* 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.
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

import React, { FunctionComponent } from 'react';
import type { FunctionComponent } from 'react';
import React from 'react';
import { EuiEmptyPrompt } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';
import { DocLink } from '../../../components/doc_link';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n/react';
import type { PublicMethodsOf } from '@kbn/utility-types';
import { Route } from 'react-router-dom';
import { History } from 'history';
import type { History } from 'history';
import type { NotificationsStart } from 'src/core/public';

import { SectionLoading } from '../../../../../../../src/plugins/es_ui_shared/public';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
/*
* 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.
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

import React, { useEffect, FunctionComponent } from 'react';
import type { FunctionComponent } from 'react';
import React, { useEffect } from 'react';
import {
EuiCallOut,
EuiFieldNumber,
Expand All @@ -24,18 +26,17 @@ import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n/react';
import useAsyncFn from 'react-use/lib/useAsyncFn';
import { useKibana, CodeEditor } from '../../../../../../../src/plugins/kibana_react/public';
import {
APIKeysAPIClient,
CreateApiKeyRequest,
CreateApiKeyResponse,
} from '../api_keys_api_client';
import { useForm, ValidationErrors } from '../../../components/use_form';
import { FormFlyout, FormFlyoutProps } from '../../../components/form_flyout';
import type { CreateApiKeyRequest, CreateApiKeyResponse } from '../api_keys_api_client';
import { APIKeysAPIClient } from '../api_keys_api_client';
import type { ValidationErrors } from '../../../components/use_form';
import { useForm } from '../../../components/use_form';
import type { FormFlyoutProps } from '../../../components/form_flyout';
import { FormFlyout } from '../../../components/form_flyout';
import { DocLink } from '../../../components/doc_link';
import { useCurrentUser } from '../../../components/use_current_user';
import { useInitialFocus } from '../../../components/use_initial_focus';
import { RolesAPIClient } from '../../roles/roles_api_client';
import { RoleDescriptors } from '../../../../common/model';
import type { RoleDescriptors } from '../../../../common/model';

export interface ApiKeyFormValues {
name: string;
Expand Down Expand Up @@ -114,7 +115,7 @@ export const CreateApiKeyFlyout: FunctionComponent<CreateApiKeyFlyoutProps> = ({
useEffect(() => {
if (currentUser && roles) {
const userPermissions = currentUser.roles.reduce<RoleDescriptors>((accumulator, roleName) => {
const role = roles.find((role) => role.name === roleName)!;
const role = roles.find((r) => r.name === roleName)!;
if (role) {
accumulator[role.name] = role.elasticsearch;
}
Expand All @@ -124,7 +125,7 @@ export const CreateApiKeyFlyout: FunctionComponent<CreateApiKeyFlyoutProps> = ({
form.setValue('role_descriptors', JSON.stringify(userPermissions, null, 2));
}
}
}, [currentUser, roles]);
}, [currentUser, roles]); // eslint-disable-line react-hooks/exhaustive-deps

const firstFieldRef = useInitialFocus<HTMLInputElement>([isLoading]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,21 @@
* 2.0.
*/

import React, { FunctionComponent } from 'react';
import type { FunctionComponent } from 'react';
import React from 'react';
import { render, unmountComponentAtNode } from 'react-dom';
import { Router } from 'react-router-dom';
import { History } from 'history';
import type { History } from 'history';
import { i18n } from '@kbn/i18n';
import { I18nProvider } from '@kbn/i18n/react';
import { StartServicesAccessor, CoreStart } from '../../../../../../src/core/public';
import { RegisterManagementAppArgs } from '../../../../../../src/plugins/management/public';
import type { StartServicesAccessor, CoreStart } from '../../../../../../src/core/public';
import type { RegisterManagementAppArgs } from '../../../../../../src/plugins/management/public';
import { KibanaContextProvider } from '../../../../../../src/plugins/kibana_react/public';
import { AuthenticationServiceSetup } from '../../authentication';
import { PluginStartDependencies } from '../../plugin';
import type { AuthenticationServiceSetup } from '../../authentication';
import type { PluginStartDependencies } from '../../plugin';
import type { BreadcrumbsChangeHandler } from '../../components/breadcrumb';
import {
BreadcrumbsProvider,
BreadcrumbsChangeHandler,
Breadcrumb,
createBreadcrumbsChangeHandler,
} from '../../components/breadcrumb';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ import type { RegisterManagementAppArgs } from 'src/plugins/management/public';

import { KibanaContextProvider } from '../../../../../../src/plugins/kibana_react/public';
import type { AuthenticationServiceSetup } from '../../authentication';
import type { BreadcrumbsChangeHandler } from '../../components/breadcrumb';
import {
BreadcrumbsProvider,
BreadcrumbsChangeHandler,
Breadcrumb,
createBreadcrumbsChangeHandler,
} from '../../components/breadcrumb';
Expand Down
7 changes: 4 additions & 3 deletions x-pack/plugins/security/server/routes/api_keys/create.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
/*
* 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.
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

import { schema } from '@kbn/config-schema';
import { createLicensedRouteHandler } from '../licensed_route_handler';
import { wrapIntoCustomErrorResponse } from '../../errors';
import { RouteDefinitionParams } from '..';
import type { RouteDefinitionParams } from '..';

export function defineCreateApiKeyRoutes({
router,
Expand Down

0 comments on commit 65c4cd2

Please sign in to comment.