Skip to content

Commit

Permalink
Moving ESLint disable directives back into place.
Browse files Browse the repository at this point in the history
  • Loading branch information
dennisoelkers committed Feb 20, 2024
1 parent b7c442b commit c430643
Show file tree
Hide file tree
Showing 32 changed files with 36 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ module.exports = {
rules: {
'jest/expect-expect': ['error', { assertFunctionNames: ['expect*', '(screen.)?find(All)?By*'] }],
'react/jsx-no-constructed-context-values': 'off',
'react/require-default-props': 'off',
'testing-library/await-async-events': 'off',
'testing-library/no-debugging-utils': 'warn',
'testing-library/prefer-screen-queries': 'off',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,8 @@ const _onSubmitAll = (
});

if (stepsState.authBackendMeta.backendGroupSyncIsActive && !formValues.synchronizeGroups) {
// eslint-disable-next-line no-alert
if (
// eslint-disable-next-line no-alert
window.confirm('Do you really want to remove the group synchronization config for this authentication service?')
) {
return _submit();
Expand Down
2 changes: 1 addition & 1 deletion graylog2-web-interface/src/components/common/Popover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import styled, { css, useTheme } from 'styled-components';

const Popover = (props: React.ComponentProps<typeof MantinePopover>) => {
const theme = useTheme();
// eslint-disable-next-line react/prop-types
const arrowBackground =
// eslint-disable-next-line react/prop-types
!props.position || props.position.startsWith('bottom')
? theme.colors.variant.lightest.default
: theme.colors.global.contentBackground;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ ace.define('ace/theme/graylog', ['require', 'exports', 'module', 'ace/lib/dom'],
dom.importCssString(exports.cssText, exports.cssClass);
});

// eslint-disable-next-line func-names
(function () {
// eslint-disable-line func-names
ace.require(['ace/theme/graylog'], (m) => {
if (typeof module === 'object' && typeof exports === 'object' && module) {
module.exports = m;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import React from 'react';
import PropTypes from 'prop-types';
import styled from 'styled-components';

import { DataTable, Icon, IfPermitted, PageHeader, PaginatedList, SearchForm, OverlayTrigger } from 'components/common';
import { DataTable, IfPermitted, PageHeader, PaginatedList, SearchForm } from 'components/common';
import { Button, ButtonToolbar, Col, Row } from 'components/bootstrap';
import EditPatternModal from 'components/grok-patterns/EditPatternModal';
import BulkLoadPatternModal from 'components/grok-patterns/BulkLoadPatternModal';
Expand All @@ -29,8 +29,6 @@ import { TELEMETRY_EVENT_TYPE } from 'logic/telemetry/Constants';

import GrokPatternQueryHelper from './GrokPatternQueryHelper';

import QueryHelper from '../common/QueryHelper';

const GrokPatternsList = styled(DataTable)`
th.name {
min-width: 200px;
Expand Down Expand Up @@ -146,8 +144,8 @@ class GrokPatterns extends React.Component {
};

confirmedRemove = (pattern) => {
// eslint-disable-next-line no-alert
if (
// eslint-disable-next-line no-alert
window.confirm(
`Really delete the grok pattern ${pattern.name}?\nIt will be removed from the system and unavailable for any extractor. If it is still in use by extractors those will fail to work.`,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import { IndexRangesActions } from 'stores/indices/IndexRangesStore';
import type { IndexSet } from 'stores/indices/IndexSetsStore';

const _onRecalculateIndexRange = (indexSetId: string) => {
// eslint-disable-next-line no-alert
if (
// eslint-disable-next-line no-alert
window.confirm(
'This will recalculate index ranges for this index set using a background system job. Do you want to proceed?',
)
Expand All @@ -35,8 +35,8 @@ const _onRecalculateIndexRange = (indexSetId: string) => {
};

const _onCycleDeflector = (indexSetId: string) => {
// eslint-disable-next-line no-alert
if (
// eslint-disable-next-line no-alert
window.confirm('This will manually cycle the current active write index on this index set. Do you want to proceed?')
) {
DeflectorActions.cycle(indexSetId).then(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,8 @@ const InputThroughput = createReactClass({
<br />
</span>
)}
{/* eslint-disable-next-line jsx-a11y/anchor-is-valid */}
{!isNaN(writtenBytes1Sec) && input.global && (
// eslint-disable-next-line jsx-a11y/anchor-is-valid
<a href="" onClick={this._toggleShowDetails}>
{showDetails ? 'Hide' : 'Show'} details
</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ class NodesActions extends React.Component {
_toggleMessageProcessing = () => {
const { systemOverview, node } = this.props;

// eslint-disable-next-line no-alert
if (
// eslint-disable-next-line no-alert
window.confirm(
`You are about to ${systemOverview.is_processing ? 'pause' : 'resume'} message processing in this node. Are you sure?`,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ const EntityShareModal = ({
if (selectedGranteeId) {
const selectedGrantee = entityShareState?.availableGrantees.find((grantee) => grantee.id === selectedGranteeId);

// eslint-disable-next-line no-alert
if (
// eslint-disable-next-line no-alert
!window.confirm(
`${selectedGrantee.title ? `"${selectedGrantee.title}"` : 'An entity (name not found)'} got selected but was never added as a collaborator. Do you want to continue anyway?`,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -339,8 +339,8 @@ const RuleBuilder = () => {
<Panel.Collapse>
<StyledPanelBody>
{rule.rule_builder.conditions.map((condition, index) => (
// eslint-disable-next-line react/no-array-index-key
<RuleBuilderBlock
// eslint-disable-next-line react/no-array-index-key
key={index}
blockDict={conditionsDict || []}
block={condition}
Expand Down Expand Up @@ -375,8 +375,8 @@ const RuleBuilder = () => {
<Panel.Collapse>
<StyledPanelBody>
{rule.rule_builder.actions.map((action, index) => (
// eslint-disable-next-line react/no-array-index-key
<RuleBuilderBlock
// eslint-disable-next-line react/no-array-index-key
key={index}
blockDict={actionsDict || []}
block={action}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ const SecurityPageEntry = () => {
const securityPagePlugins = usePluginEntities('securityPage');

if (securityPagePlugins?.length) {
// eslint-disable-next-line react/no-array-index-key
return (
<>
{securityPagePlugins.map((Page, index) => (
// eslint-disable-next-line react/no-array-index-key
<Page key={index} />
))}
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,9 @@ const ConfigurationForm = ({ action, configuration, configurationSidecars }: Pro

nextFormData.collector_id = nextId;

// eslint-disable-next-line no-alert
if (
!nextFormData.template ||
// eslint-disable-next-line no-alert
window.confirm('Do you want to use the default template for the selected Configuration?')
) {
_onTemplateChange(defaultTemplate);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ const SimulationTrace = createReactClass({
simulationTrace.forEach((trace, idx) => {
// eslint-disable-next-line react/no-array-index-key
traceEntries.push(<dt key={`${trace.time}-${idx}-title`}>{NumberUtils.formatNumber(trace.time)} &#956;s</dt>);
// eslint-disable-next-line react/no-array-index-key
traceEntries.push(
// eslint-disable-next-line react/no-array-index-key
<dd key={`${trace}-${idx}-description`}>
<span>{trace.message}</span>
</dd>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ class MatchingTypeSwitcher extends React.Component {
handleTypeChange = (newValue) => {
const { onChange, stream } = this.props;

// eslint-disable-next-line no-alert
if (
// eslint-disable-next-line no-alert
window.confirm(
'You are about to change how rules are applied to this stream, do you want to continue? Changes will take effect immediately.',
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ const BulkActions = ({ indexSets }: Props) => {
);

const onDelete = useCallback(() => {
// eslint-disable-next-line no-alert
if (
// eslint-disable-next-line no-alert
window.confirm(`Do you really want to remove ${selectedItemsAmount} ${descriptor}? This action cannot be undone.`)
) {
fetch('POST', qualifyUrl(ApiRoutes.StreamsApiController.bulk_delete().url), { entity_ids: selectedEntities })
Expand Down
2 changes: 1 addition & 1 deletion graylog2-web-interface/src/generator/emit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,8 @@ const emitBlock = (
true,
);

// eslint-disable-next-line no-nested-ternary
const body =
// eslint-disable-next-line no-nested-ternary
formDataParameters.length > 0
? ts.factory.createIdentifier('formData')
: bodyParameter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ class NotificationsFactory {
case 'input_failure_shutdown':
case 'input_failed':
case 'input_failed_to_start': {
// eslint-disable-line padding-line-between-statements
return {
values: {
SYSTEM_INPUTS: Routes.SYSTEM.INPUTS,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ const ResumeStartupButton = ({ setIsWaitingForStartup, children, variant, compac
const { data: dataNodes } = useDataNodes();

const onResumeStartup = useCallback(() => {
// eslint-disable-next-line no-alert
if (
dataNodes?.length ||
// eslint-disable-next-line no-alert
window.confirm(
'Are you sure you want to resume startup without a running Graylog data node? This will cause the configuration to fall back to using an Opensearch instance on localhost:9200.',
)
Expand Down
2 changes: 1 addition & 1 deletion graylog2-web-interface/src/util/deprecationNotice.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import AppConfig from './AppConfig';

export const DEPRECATION_NOTICE = 'Graylog Deprecation Notice:';

// eslint-disable-next-line no-console
const deprecationNotice = (deprecatedMessage) =>
// eslint-disable-next-line no-console
AppConfig.gl2DevMode() && console.warn(DEPRECATION_NOTICE, deprecatedMessage);

export default deprecationNotice;
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,8 @@ const AdaptableQueryTabsConfiguration = ({ show, setShow, queriesList, activeQue
[activeQueryId, dashboardId, disablePageDelete, sendTelemetry, widgetIds],
);

// eslint-disable-next-line react/no-unused-prop-types
const customListItemRender = useCallback(
// eslint-disable-next-line react/no-unused-prop-types
({ item }: { item: PageListItem }) => (
<ListItem item={item} onUpdateTitle={onUpdateTitle} onRemove={removePage} disableDelete={disablePageDelete} />
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,10 @@ const HeaderElements = () => {

return (
<>
{headerElements
{headerElements.map((Component, idx) => (
// eslint-disable-next-line react/no-array-index-key
.map((Component, idx) => (
<Component key={idx} />
))}
<Component key={idx} />
))}
</>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,10 @@ const QueryBarElements = () => {

return (
<>
{queryBarElements
{queryBarElements.map((Component, idx) => (
// eslint-disable-next-line react/no-array-index-key
.map((Component, idx) => (
<Component key={idx} />
))}
<Component key={idx} />
))}
</>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ const exceedsDuration = (
switch (timeRange?.type) {
case 'absolute':
case 'keyword': {
// eslint-disable-line padding-line-between-statements
const durationFrom = timeRange.from;

const durationLimit = formatTime(toDateObject(new Date()).subtract(Number(limitDuration), 'seconds'), 'complete');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ import { isAnyPermitted } from 'util/PermissionsMixin';
import useCurrentUser from 'hooks/useCurrentUser';
import MoreActions from 'components/common/EntityDataTable/MoreActions';

// eslint-disable-next-line no-alert
const defaultDashboardDeletionHook = async (view: View) =>
// eslint-disable-next-line no-alert
window.confirm(`Are you sure you want to delete "${view.title}"?`);

const _extractErrorMessage = (error: FetchError) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ ace.define(
},
{
token: 'constant.language.escape',
// eslint-disable-next-line no-useless-escape

regex: '<d+-d+>|[~&@]',
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ describe('TabKeywordTimeRange', () => {
return formGroup && formGroup.className.includes('has-error') ? 'error' : null;
};

// eslint-disable-next-line testing-library/no-unnecessary-act
const changeInput = async (input, value) =>
// eslint-disable-next-line testing-library/no-unnecessary-act
act(async () => {
const { name } = asElement(input, HTMLInputElement);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ const config = AggregationWidgetConfig.builder()
.columnPivots(columnPivots)
.build();

// eslint-disable-next-line react/require-default-props
const SUT = ({
chartDataProp = chartData,
plotConfig = config,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ import RenderCompletionCallback from '../../widgets/RenderCompletionCallback';
// without CurrentUser & UserPreferences
jest.mock('components/bootstrap/Popover');

// eslint-disable-next-line global-require
jest.mock(
'views/components/visualizations/plotly/AsyncPlot',
// eslint-disable-next-line global-require
() => require('views/components/visualizations/plotly/Plot').default,
);
jest.mock('components/common/ColorPicker', () => 'color-picker');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ const _trendDirection = (delta: number, trendPreference: TrendPreference): Trend
}
};

// eslint-disable-next-line no-nested-ternary
const _trendIcon = (delta: number) =>
// eslint-disable-next-line no-nested-ternary
delta === 0 ? 'arrow-circle-right' : delta > 0 ? 'arrow-circle-up' : 'arrow-circle-down';

const diff = (current: number | undefined, previous: number | undefined): [number, number] => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ type MarkerProps = {
};

const Marker = ({ coordinates, value, min, max, radiusSize, increment, color, name, keys }: MarkerProps) => {
// eslint-disable-next-line no-restricted-globals
const formattedCoordinates = coordinates
.split(',')
.map((component) => Number(component))
// eslint-disable-next-line no-restricted-globals
.filter((n) => !isNaN(n));

if (formattedCoordinates.length !== 2) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ const _onMoveWidgetToPage = async (
}
};

// eslint-disable-next-line no-alert
const defaultOnDeleteWidget = async (_widget: Widget, _view: View, title: string) =>
// eslint-disable-next-line no-alert
window.confirm(`Are you sure you want to remove the widget "${title}"?`);

const _onDelete = (widget: Widget, view: View, title: string) => async (dispatch: AppDispatch) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ type StreamsQuery = {

export type RawQuery = (TimeRangeQueryParameter | { relative?: string }) & StreamsQuery & { q?: string };

// eslint-disable-next-line no-nested-ternary
const normalizeTimeRange = (query: {} | TimeRangeQueryParameter): TimeRange | undefined =>
// eslint-disable-next-line no-nested-ternary
query && 'rangetype' in query
? timeRangeFromQueryParameter(query)
: 'relative' in query
Expand Down

0 comments on commit c430643

Please sign in to comment.