Skip to content

Commit bfc7de9

Browse files
authored
[Enterprise Search] Enable unused var linting (elastic#127305)
1 parent 27b5735 commit bfc7de9

File tree

10 files changed

+21
-22
lines changed

10 files changed

+21
-22
lines changed

.eslintrc.js

+4
Original file line numberDiff line numberDiff line change
@@ -1488,6 +1488,10 @@ module.exports = {
14881488
'import/newline-after-import': 'error',
14891489
'react-hooks/exhaustive-deps': 'off',
14901490
'react/jsx-boolean-value': ['error', 'never'],
1491+
'@typescript-eslint/no-unused-vars': [
1492+
'error',
1493+
{ vars: 'all', args: 'after-used', ignoreRestSiblings: true, varsIgnorePattern: '^_' },
1494+
],
14911495
},
14921496
},
14931497
{

x-pack/plugins/enterprise_search/public/applications/app_search/app_logic.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export const AppLogic = kea<MakeLogicType<AppValues, AppActions, Required<Initia
4444
selectors: {
4545
myRole: [
4646
(selectors) => [selectors.account, LicensingLogic.selectors.hasPlatinumLicense],
47-
({ role }, hasPlatinumLicense) => (role ? getRoleAbilities(role, hasPlatinumLicense) : {}),
47+
({ role }) => (role ? getRoleAbilities(role) : {}),
4848
],
4949
},
5050
});

x-pack/plugins/enterprise_search/public/applications/app_search/components/documents/search_experience/search_experience_content.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { useValues } from 'kea';
1111

1212
import { EuiFlexGroup, EuiSpacer, EuiEmptyPrompt } from '@elastic/eui';
1313
// @ts-expect-error types are not available for this package yet
14-
import { Results, Paging, ResultsPerPage } from '@elastic/react-search-ui';
14+
import { Results } from '@elastic/react-search-ui';
1515
import { i18n } from '@kbn/i18n';
1616

1717
import { Loading } from '../../../../shared/loading';

x-pack/plugins/enterprise_search/public/applications/app_search/components/library/library.tsx

+6-6
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ export const Library: React.FC = () => {
364364
items={[{ id: 1 }, { id: 2 }, { id: 3 }]}
365365
columns={[
366366
{ name: 'ID', render: (item) => <div>{item.id}</div> },
367-
{ name: 'Whatever', render: (item) => <div>Whatever</div> },
367+
{ name: 'Whatever', render: () => <div>Whatever</div> },
368368
]}
369369
/>
370370
<EuiSpacer />
@@ -379,7 +379,7 @@ export const Library: React.FC = () => {
379379
items={[{ id: 1 }, { id: 2 }, { id: 3 }]}
380380
columns={[
381381
{ name: 'ID', render: (item) => <div>{item.id}</div> },
382-
{ name: 'Whatever', render: (item) => <div>Whatever</div> },
382+
{ name: 'Whatever', render: () => <div>Whatever</div> },
383383
]}
384384
/>
385385
<EuiSpacer />
@@ -394,7 +394,7 @@ export const Library: React.FC = () => {
394394
items={[{ id: 1 }, { id: 2 }, { id: 3 }]}
395395
columns={[
396396
{ name: 'ID', render: (item) => <div>{item.id}</div> },
397-
{ name: 'Whatever', render: (item) => <div>Whatever</div> },
397+
{ name: 'Whatever', render: () => <div>Whatever</div> },
398398
]}
399399
/>
400400
<EuiSpacer />
@@ -409,7 +409,7 @@ export const Library: React.FC = () => {
409409
unreorderableItems={[{ id: 4 }, { id: 5 }]}
410410
columns={[
411411
{ name: 'ID', render: (item) => <div>{item.id}</div> },
412-
{ name: 'Whatever', render: (item) => <div>Whatever</div> },
412+
{ name: 'Whatever', render: () => <div>Whatever</div> },
413413
]}
414414
/>
415415
<EuiSpacer />
@@ -428,7 +428,7 @@ export const Library: React.FC = () => {
428428
items={[{ id: 1 }, { id: 2 }, { id: 3 }]}
429429
columns={[
430430
{ name: 'ID', render: (item) => <div>{item.id}</div> },
431-
{ name: 'Whatever', render: (item) => <div>Whatever</div> },
431+
{ name: 'Whatever', render: () => <div>Whatever</div> },
432432
]}
433433
/>
434434

@@ -442,7 +442,7 @@ export const Library: React.FC = () => {
442442
items={[]}
443443
columns={[
444444
{ name: 'ID', render: (item: { id: number }) => <div>{item.id}</div> },
445-
{ name: 'Whatever', render: (item) => <div>Whatever</div> },
445+
{ name: 'Whatever', render: () => <div>Whatever</div> },
446446
]}
447447
/>
448448
<EuiSpacer />

x-pack/plugins/enterprise_search/public/applications/app_search/utils/role/get_role_abilities.test.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -76,19 +76,19 @@ describe('getRoleAbilities', () => {
7676
const canManageEngines = { ability: { manage: ['account_engines'] } };
7777

7878
it('returns true when the user can manage any engines and the account has a platinum license', () => {
79-
const myRole = getRoleAbilities({ ...mockRole, ...canManageEngines }, true);
79+
const myRole = getRoleAbilities({ ...mockRole, ...canManageEngines });
8080

8181
expect(myRole.canManageMetaEngines).toEqual(true);
8282
});
8383

8484
it('returns true when the user can manage any engines but the account does not have a platinum license', () => {
85-
const myRole = getRoleAbilities({ ...mockRole, ...canManageEngines }, false);
85+
const myRole = getRoleAbilities({ ...mockRole, ...canManageEngines });
8686

8787
expect(myRole.canManageMetaEngines).toEqual(true);
8888
});
8989

9090
it('returns false when has a platinum license but the user cannot manage any engines', () => {
91-
const myRole = getRoleAbilities({ ...mockRole, ability: { manage: [] } }, true);
91+
const myRole = getRoleAbilities({ ...mockRole, ability: { manage: [] } });
9292

9393
expect(myRole.canManageMetaEngines).toEqual(false);
9494
});

x-pack/plugins/enterprise_search/public/applications/app_search/utils/role/get_role_abilities.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { RoleTypes, AbilityTypes, Role } from './types';
1313
* Transforms the `role` data we receive from the Enterprise Search
1414
* server into a more convenient format for front-end use
1515
*/
16-
export const getRoleAbilities = (role: Account['role'], hasPlatinumLicense = false): Role => {
16+
export const getRoleAbilities = (role: Account['role']): Role => {
1717
// Role ability function helpers
1818
const myRole = {
1919
can: (action: AbilityTypes, subject: string): boolean => {

x-pack/plugins/enterprise_search/public/applications/shared/hidden_text/hidden_text.test.tsx

+2-4
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@ import { HiddenText } from '.';
1414
describe('HiddenText', () => {
1515
it('provides the passed "text" in a "hiddenText" field, with all characters obfuscated', () => {
1616
const wrapper = shallow(
17-
<HiddenText text="hidden_test">
18-
{({ hiddenText, isHidden, toggle }) => <div>{hiddenText}</div>}
19-
</HiddenText>
17+
<HiddenText text="hidden_test">{({ hiddenText }) => <div>{hiddenText}</div>}</HiddenText>
2018
);
2119
expect(wrapper.text()).toEqual('•••••••••••');
2220
});
@@ -26,7 +24,7 @@ describe('HiddenText', () => {
2624

2725
const wrapper = shallow(
2826
<HiddenText text="hidden_test">
29-
{({ hiddenText, isHidden, toggle }) => {
27+
{({ hiddenText, toggle }) => {
3028
toggleFn = toggle;
3129
return <div>{hiddenText}</div>;
3230
}}

x-pack/plugins/enterprise_search/public/applications/shared/tables/inline_editable_table/inline_editable_table.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ export const InlineEditableTableContents = <Item extends ItemWithAnID>({
9393
description,
9494
isLoading,
9595
lastItemWarning,
96-
defaultItem,
9796
noItemsMessage = () => null,
9897
uneditableItems,
9998
...rest

x-pack/plugins/enterprise_search/public/applications/shared/tables/reorderable_table/cell.tsx

+2-4
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,12 @@ import { EuiFlexItem } from '@elastic/eui';
1111

1212
import { DraggableUXStyles } from './types';
1313

14-
type CellProps<Item> = DraggableUXStyles;
15-
16-
export const Cell = <Item extends object>({
14+
export const Cell = ({
1715
children,
1816
alignItems,
1917
flexBasis,
2018
flexGrow,
21-
}: CellProps<Item> & { children?: React.ReactNode }) => {
19+
}: DraggableUXStyles & { children?: React.ReactNode }) => {
2220
return (
2321
<EuiFlexItem
2422
style={{

x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/synchronization/synchronization_logic.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ export const SynchronizationLogic = kea<
254254

255255
return schedule;
256256
},
257-
addBlockedWindow: (state, _) => {
257+
addBlockedWindow: (state) => {
258258
const schedule = cloneDeep(state);
259259
const blockedWindows = schedule.blockedWindows || [];
260260
blockedWindows.push(emptyBlockedWindow);

0 commit comments

Comments
 (0)