Skip to content

Commit 690cf4e

Browse files
authored
ref(eslint): enable typescript-eslint/no-meaningless-void-operator (#97377)
reports when the `void` operator is used on a function that already returns `void`. Most violations were in test code only.
1 parent 3daf709 commit 690cf4e

File tree

24 files changed

+40
-39
lines changed

24 files changed

+40
-39
lines changed

eslint.config.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,7 @@ export default typescript.config([
485485
'@typescript-eslint/no-for-in-array': 'error',
486486
'@typescript-eslint/no-unnecessary-type-assertion': 'error',
487487
'@typescript-eslint/prefer-optional-chain': 'error',
488+
'@typescript-eslint/no-meaningless-void-operator': 'error',
488489
}
489490
: {},
490491
},

static/app/components/autoComplete.spec.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ describe('AutoComplete', function () {
4545
itemCount: number;
4646
registerItemCount: (count?: number) => void;
4747
}) {
48-
useEffect(() => void registerItemCount(itemCount), [itemCount, registerItemCount]);
48+
useEffect(() => registerItemCount(itemCount), [itemCount, registerItemCount]);
4949
return <ul {...props} />;
5050
}
5151

static/app/components/events/rrwebReplayer/baseRRWebReplayer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function BaseRRWebReplayerComponent({events, className}: Props) {
3030
});
3131
}, [events]);
3232

33-
useEffect(() => void initPlayer(), [initPlayer]);
33+
useEffect(() => initPlayer(), [initPlayer]);
3434

3535
return <div ref={playerEl} className={className} />;
3636
}

static/app/components/groupPreviewTooltip/groupPreviewHovercard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export function GroupPreviewHovercard({
1919
}: GroupPreviewHovercardProps) {
2020
const theme = useTheme();
2121
const handleStackTracePreviewClick = useCallback(
22-
(e: React.MouseEvent) => void e.stopPropagation(),
22+
(e: React.MouseEvent) => e.stopPropagation(),
2323
[]
2424
);
2525

static/app/components/modals/commandPalette.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ function CommandPalette({Body}: ModalRenderProps) {
1313

1414
useEffect(
1515
() =>
16-
void trackAnalytics('omnisearch.open', {
16+
trackAnalytics('omnisearch.open', {
1717
organization: null,
1818
}),
1919
[]

static/app/components/profiling/flamegraph/flamegraph.spec.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ Object.defineProperty(window, 'matchMedia', {
109109
describe('Flamegraph', function () {
110110
beforeEach(() => {
111111
const project = ProjectFixture({slug: 'foo-project'});
112-
act(() => void ProjectsStore.loadInitialData([project]));
112+
act(() => ProjectsStore.loadInitialData([project]));
113113
setWindowLocation('http://localhost/');
114114
});
115115
it('renders a missing profile', async function () {

static/app/components/sidebar/index.spec.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ describe('Sidebar', function () {
168168
});
169169

170170
it('can open "Switch Organization" sub-menu', async function () {
171-
act(() => void ConfigStore.set('features', new Set(['organizations:create'])));
171+
act(() => ConfigStore.set('features', new Set(['organizations:create'])));
172172

173173
renderSidebar({organization});
174174

static/app/components/sidebar/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ function Sidebar() {
127127
}, [collapsed]);
128128

129129
// Close panel on any navigation
130-
useEffect(() => void hidePanel(), [location?.pathname]);
130+
useEffect(() => hidePanel(), [location?.pathname]);
131131

132132
// Add classname to body
133133
useEffect(() => {

static/app/components/themeAndStyleProvider.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ cache.compat = true;
3030
*/
3131
export function ThemeAndStyleProvider({children}: Props) {
3232
// @TODO(jonasbadalic): the preferences state here seems related to just the sidebar collapse state
33-
useEffect(() => void loadPreferencesState(), []);
33+
useEffect(() => loadPreferencesState(), []);
3434

3535
const config = useLegacyStore(ConfigStore);
3636
const theme = useThemeSwitcher();

static/app/stores/useLegacyStore.spec.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {useLegacyStore} from 'sentry/stores/useLegacyStore';
88
describe('useLegacyStore', () => {
99
const team = TeamFixture();
1010

11-
beforeEach(() => void TeamStore.reset());
11+
beforeEach(() => TeamStore.reset());
1212

1313
it('should update on change to store', () => {
1414
const {result} = renderHook(useLegacyStore, {initialProps: TeamStore});

0 commit comments

Comments
 (0)