Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[eslint] convert to @typescript-eslint/no-unused-expressions #76471

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/elastic-eslint-config-kibana/typescript.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,8 @@ module.exports = {
'no-undef-init': 'error',
'no-unsafe-finally': 'error',
'no-unsanitized/property': 'error',
'no-unused-expressions': 'error',
'no-unused-expressions': 'off',
'@typescript-eslint/no-unused-expressions': 'error',
'no-unused-labels': 'error',
'no-var': 'error',
'object-shorthand': 'error',
Expand Down
18 changes: 10 additions & 8 deletions test/functional/apps/visualize/_tsvb_markdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
await visualBuilder.markdownSwitchSubTab('markdown');
const rerenderedTable = await visualBuilder.getMarkdownTableVariables();
rerenderedTable.forEach((row) => {
// eslint-disable-next-line no-unused-expressions
variableName === 'label'
? expect(row.key).to.include.string(checkedValue)
: expect(row.key).to.not.include.string(checkedValue);
if (variableName === 'label') {
expect(row.key).to.include.string(checkedValue);
} else {
expect(row.key).to.not.include.string(checkedValue);
}
});
}

Expand Down Expand Up @@ -107,10 +108,11 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {

table.forEach((row, index) => {
// exception: last index for variable is always: {{count.label}}
// eslint-disable-next-line no-unused-expressions
index === table.length - 1
? expect(row.key).to.not.include.string(VARIABLE)
: expect(row.key).to.include.string(VARIABLE);
if (index === table.length - 1) {
expect(row.key).to.not.include.string(VARIABLE);
} else {
expect(row.key).to.include.string(VARIABLE);
}
});

await cleanupMarkdownData(VARIABLE, VARIABLE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { MockUrlParamsContextProvider } from '../../../context/UrlParamsContext/
// our current storybook setup has core-js-related problems when trying to import
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is true anymore. Making a note to revisit once #75357 is merged.

// it.
// storiesOf('app/TransactionDurationAlertTrigger', module).add('example',
// eslint-disable-next-line no-unused-expressions
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
() => {
const params = {
threshold: 1500,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export const LogEntryRow = memo(
]);

const handleOpenViewLogInContext = useCallback(() => {
openViewLogInContext?.(logEntry); // eslint-disable-line no-unused-expressions
openViewLogInContext?.(logEntry);
trackMetric({ metric: 'view_in_context__stream' });
}, [openViewLogInContext, logEntry, trackMetric]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ export const LogEntryCategoriesResultsContent: React.FunctionComponent<LogEntryC

const showLoadDataErrorNotification = useCallback(
(error: Error) => {
// eslint-disable-next-line no-unused-expressions
services.notifications?.toasts.addError(error, {
title: loadDataErrorTitle,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ export const LogEntryRateResultsContent: React.FunctionComponent = () => {
}),
};

// eslint-disable-next-line no-unused-expressions
navigateToApp?.('logs', { path: `/stream?${stringify(params)}` });
},
[queryTimeRange, navigateToApp]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,10 @@ const StatefulRowRenderersBrowserComponent: React.FC<StatefulRowRenderersBrowser
const hideFieldBrowser = useCallback(() => setShow(false), []);

const handleDisableAll = useCallback(() => {
// eslint-disable-next-line no-unused-expressions
tableRef?.current?.setSelection([]);
}, [tableRef]);

const handleEnableAll = useCallback(() => {
// eslint-disable-next-line no-unused-expressions
tableRef?.current?.setSelection(renderers);
}, [tableRef]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ const RowRenderersBrowserComponent = React.forwardRef(
(item: RowRendererOption) => () => {
const newSelection = xor([item], notExcludedRowRenderers);
// @ts-expect-error
ref?.current?.setSelection(newSelection); // eslint-disable-line no-unused-expressions
ref?.current?.setSelection(newSelection);
},
[notExcludedRowRenderers, ref]
);
Expand Down