Remove unused full arguments

As distinct from removing destructured props.

GitOrigin-RevId: d02ad8d36fb532559ed2899268d7b699f2f2fa37
This commit is contained in:
andrew rumble
2024-09-13 15:21:01 +01:00
committed by Copybot
parent eb60d364f6
commit 4960569648
28 changed files with 49 additions and 67 deletions

View File

@@ -28,11 +28,7 @@ function HistoryDropdownContent({
return (
<>
{permissions.labelVersion && (
<AddLabel
projectId={projectId}
version={version}
closeDropdown={closeDropdown}
/>
<AddLabel version={version} closeDropdown={closeDropdown} />
)}
<Download
projectId={projectId}

View File

@@ -4,18 +4,12 @@ import OLDropdownMenuItem from '@/features/ui/components/ol/ol-dropdown-menu-ite
import OLTagIcon from '@/features/ui/components/ol/icons/ol-tag-icon'
import AddLabelModal from '../../add-label-modal'
type DownloadProps = {
projectId: string
type AddLabelProps = {
version: number
closeDropdown: () => void
}
function AddLabel({
version,
projectId,
closeDropdown,
...props
}: DownloadProps) {
function AddLabel({ version, closeDropdown, ...props }: AddLabelProps) {
const { t } = useTranslation()
const [showModal, setShowModal] = useState(false)

View File

@@ -238,7 +238,7 @@ class EmptyLineAdditionMarkerWidget extends WidgetType {
super()
}
toDOM(view: EditorView): HTMLElement {
toDOM(): HTMLElement {
const element = document.createElement('span')
element.classList.add(
'ol-cm-empty-line-addition-marker',
@@ -255,7 +255,7 @@ class EmptyLineDeletionMarkerWidget extends WidgetType {
super()
}
toDOM(view: EditorView): HTMLElement {
toDOM(): HTMLElement {
const element = document.createElement('span')
element.classList.add(
'ol-cm-empty-line-deletion-marker',
@@ -297,7 +297,7 @@ class ChangeGutterMarker extends GutterMarker {
super()
}
toDOM(view: EditorView) {
toDOM() {
const el = document.createElement('div')
el.className = 'ol-cm-changed-line-gutter'
el.style.setProperty('--hue', this.hue.toString())

View File

@@ -599,7 +599,7 @@ export class DocumentContainer extends EventEmitter {
this.doc.on('remoteop', (...ops: AnyOperation[]) => {
return this.trigger('remoteop', ...ops)
})
this.doc.on('op:sent', (op: AnyOperation) => {
this.doc.on('op:sent', () => {
return this.trigger('op:sent')
})
this.doc.on('op:acknowledged', (op: AnyOperation) => {
@@ -609,7 +609,7 @@ export class DocumentContainer extends EventEmitter {
})
return this.trigger('op:acknowledged')
})
this.doc.on('op:timeout', (op: AnyOperation) => {
this.doc.on('op:timeout', () => {
this.trigger('op:timeout')
return this.onError(new Error('op timed out'))
})

View File

@@ -91,7 +91,7 @@ function TagsDropdown() {
data-testid="project-tools-more-dropdown-menu"
>
<DropdownHeader>{t('add_to_tag')}</DropdownHeader>
{sortBy(tags, tag => tag.name?.toLowerCase()).map((tag, index) => (
{sortBy(tags, tag => tag.name?.toLowerCase()).map(tag => (
<li role="none" key={tag._id}>
<DropdownItem
onClick={e =>

View File

@@ -17,7 +17,7 @@ const ReviewPanel: FC<{ mini?: boolean }> = ({ mini = false }) => {
[choosenSubView, mini]
)
const style = useReviewPanelStyles(mini)
const style = useReviewPanelStyles()
const className = classnames('review-panel-container', {
'review-panel-mini': mini,

View File

@@ -1,7 +1,7 @@
import { CSSProperties, useCallback, useEffect, useState } from 'react'
import { useCodeMirrorViewContext } from '@/features/source-editor/components/codemirror-context'
export const useReviewPanelStyles = (mini: boolean) => {
export const useReviewPanelStyles = () => {
const view = useCodeMirrorViewContext()
const [styles, setStyles] = useState<CSSProperties>({

View File

@@ -45,16 +45,16 @@ const themeGenerators: Record<BorderTheme, ThemeGenerator> = {
left: true,
right: number === numColumns - 1,
}),
row: (number: number, numRows: number) => '\\hline',
row: () => '\\hline',
multicolumn: () => ({ left: true, right: true }),
lastRow: () => '\\hline',
},
[BorderTheme.BOOKTABS]: {
column: (number: number, numColumns: number) => ({
column: () => ({
left: false,
right: false,
}),
row: (number: number, numRows: number) => {
row: (number: number) => {
if (number === 0) {
return '\\toprule'
}

View File

@@ -187,7 +187,7 @@ class CursorMarker extends RectangleMarker {
const cursorHighlightsLayer = layer({
above: true,
class: 'ol-cm-cursorHighlightsLayer',
update: (update, layer) => {
update: update => {
return (
update.docChanged ||
update.selectionSet ||

View File

@@ -42,7 +42,7 @@ export const cursorPosition = ({
// Asynchronously dispatch cursor position when the selection changes and
// provide a little debouncing. Using requestAnimationFrame postpones it
// until the next CM6 DOM update.
ViewPlugin.define(view => {
ViewPlugin.define(() => {
let animationFrameRequest: number | null = null
return {

View File

@@ -71,7 +71,7 @@ const cursorLayer = layer({
updateHasMouseDownEffect(update)
)
},
mount(dom, view) {
mount(dom) {
dom.style.animationDuration = '1200ms'
},
class: 'cm-cursorLayer',
@@ -90,7 +90,7 @@ const selectionLayer = layer({
}
return markers
},
update(update, dom) {
update(update) {
return (
update.docChanged ||
update.selectionSet ||

View File

@@ -9,13 +9,13 @@ import {
import browser from './browser'
class EmptyLineWidget extends WidgetType {
toDOM(view: EditorView): HTMLElement {
toDOM(): HTMLElement {
const element = document.createElement('span')
element.className = 'ol-cm-filler'
return element
}
eq(widget: EmptyLineWidget) {
eq() {
return true
}
}

View File

@@ -34,17 +34,14 @@ const customiseVimOnce = (_Vim: typeof Vim, _CodeMirror: typeof CodeMirror) => {
// Allow copy via Ctrl-C in insert mode
_Vim.unmap('<C-c>', 'insert')
_Vim.defineAction(
'insertModeCtrlC',
(cm: CodeMirror, actionArgs: object, state: any) => {
if (hasNonEmptySelection(cm)) {
navigator.clipboard.writeText(cm.getSelection())
cm.setSelection(cm.getCursor(), cm.getCursor())
} else {
_Vim.exitInsertMode(cm)
}
_Vim.defineAction('insertModeCtrlC', (cm: CodeMirror) => {
if (hasNonEmptySelection(cm)) {
navigator.clipboard.writeText(cm.getSelection())
cm.setSelection(cm.getCursor(), cm.getCursor())
} else {
_Vim.exitInsertMode(cm)
}
)
})
// Overwrite the moveByCharacters command with a decoration-aware version
_Vim.defineMotion(

View File

@@ -68,7 +68,7 @@ export const rangesDataField = StateField.define<RangesData | null>({
export const ranges = () => [
rangesDataField,
// handle viewportChanged updates
ViewPlugin.define(view => {
ViewPlugin.define(() => {
let timer: number
return {

View File

@@ -334,10 +334,7 @@ class HistoryOTAdapter {
}
}
handleUpdateFromCM(
transactions: readonly Transaction[],
ranges?: RangesTracker
) {
handleUpdateFromCM(transactions: readonly Transaction[]) {
for (const transaction of transactions) {
if (
this.maxDocLength &&

View File

@@ -188,7 +188,7 @@ class TopPaddingWidget extends WidgetType {
this.height = height
}
toDOM(view: EditorView): HTMLElement {
toDOM(): HTMLElement {
const element = document.createElement('div')
element.style.height = this.height + 'px'
return element

View File

@@ -7,7 +7,7 @@ export class EndWidget extends WidgetType {
return element
}
eq(widget: EndWidget) {
eq() {
return true
}

View File

@@ -1,4 +1,4 @@
import { EditorView, WidgetType } from '@codemirror/view'
import { WidgetType } from '@codemirror/view'
export class EnvironmentLineWidget extends WidgetType {
constructor(
@@ -8,7 +8,7 @@ export class EnvironmentLineWidget extends WidgetType {
super()
}
toDOM(view: EditorView) {
toDOM() {
const element = document.createElement('div')
element.classList.add(`ol-cm-environment-${this.environment}`)
element.classList.add('ol-cm-environment-edge')

View File

@@ -1,7 +1,7 @@
import { indentService } from '@codemirror/language'
export const latexIndentService = () =>
indentService.of((indentContext, pos) => {
indentService.of(indentContext => {
// only use this for insertNewLineAndIndent
if (indentContext.simulatedBreak) {
// match the indentation of the previous line (if present)

View File

@@ -20,7 +20,7 @@ function ChangeToPlanButton({ planCode }: { planCode: string }) {
)
}
function KeepCurrentPlanButton({ plan }: { plan: Plan }) {
function KeepCurrentPlanButton() {
const { t } = useTranslation()
const { handleOpenModal } = useSubscriptionDashboardContext()
@@ -43,7 +43,7 @@ function ChangePlanButton({ plan }: { plan: Plan }) {
plan.planCode === personalSubscription.planCode.split('_')[0]
if (isCurrentPlanForUser && personalSubscription.pendingPlan) {
return <KeepCurrentPlanButton plan={plan} />
return <KeepCurrentPlanButton />
} else if (isCurrentPlanForUser && !personalSubscription.pendingPlan) {
return (
<b>

View File

@@ -72,7 +72,7 @@ const initialize = () => {
}
}, 0)
},
$on: (eventName: string, callback: () => void) => {
$on: () => {
//
},
$broadcast: () => {},

View File

@@ -100,7 +100,7 @@ export const mockClearCache = fetchMock =>
})
export const mockBuildFile = fetchMock =>
fetchMock.get('express:/build/:file', (url, options, request) => {
fetchMock.get('express:/build/:file', url => {
const { pathname } = new URL(url, 'https://example.com')
switch (pathname) {
@@ -190,7 +190,7 @@ export const mockEventTracking = fetchMock =>
fetchMock.get('express:/event/:event', 204)
export const mockValidPdf = fetchMock =>
fetchMock.get('express:/build/output.pdf', (url, options, request) => {
fetchMock.get('express:/build/output.pdf', () => {
return new Promise(resolve => {
const xhr = new XMLHttpRequest()
xhr.addEventListener('load', () => {

View File

@@ -127,7 +127,7 @@ export default {
displayOnVariants: ['active'],
},
decorators: [
(Story, context) => (
Story => (
<SplitTestContext.Provider value={splitTestContextValue}>
<Story />
</SplitTestContext.Provider>

View File

@@ -60,7 +60,7 @@ export const Active = (args: Args) => {
)
}
export const MultipleSelection = (args: Args) => {
export const MultipleSelection = () => {
return (
<DropdownMenu show>
<DropdownHeader>Header</DropdownHeader>
@@ -191,7 +191,7 @@ export const LeadingIcon = (args: Args) => {
)
}
export const TrailingIcon = (args: Args) => {
export const TrailingIcon = () => {
return (
<DropdownMenu show>
<OLDropdownMenuItem eventKey="1" href="#/action-1" trailingIcon="check">

View File

@@ -11,9 +11,7 @@ import {
import Button from '@/features/ui/components/bootstrap-5/button'
import { ButtonGroup } from 'react-bootstrap'
type Args = React.ComponentProps<typeof Dropdown>
export const Sizes = (args: Args) => {
export const Sizes = () => {
const { t } = useTranslation()
const sizes = {
Large: 'lg',

View File

@@ -19,7 +19,7 @@ describe('<DictionaryModalContent />', function () {
})
it('list words', function () {
cy.then(win => {
cy.then(() => {
learnedWords.global = new Set(['foo', 'bar'])
})
@@ -34,7 +34,7 @@ describe('<DictionaryModalContent />', function () {
})
it('shows message when empty', function () {
cy.then(win => {
cy.then(() => {
learnedWords.global = new Set([])
})
@@ -50,7 +50,7 @@ describe('<DictionaryModalContent />', function () {
it('removes words', function () {
cy.intercept('/spelling/unlearn', { statusCode: 200 })
cy.then(win => {
cy.then(() => {
learnedWords.global = new Set(['Foo', 'bar'])
})
@@ -76,7 +76,7 @@ describe('<DictionaryModalContent />', function () {
it('handles errors', function () {
cy.intercept('/spelling/unlearn', { statusCode: 500 }).as('unlearn')
cy.then(win => {
cy.then(() => {
learnedWords.global = new Set(['foo'])
})

View File

@@ -13,7 +13,7 @@ const testInstitutionData = [
describe('<AddEmailInput/>', function () {
const defaultProps = {
onChange: (value: string) => {},
onChange: () => {},
handleAddNewEmail: () => {},
}

View File

@@ -6,7 +6,7 @@ const fixturePath = '../../helpers/fixtures/logs/'
const fs = require('fs')
const path = require('path')
describe('logParser', function (done) {
describe('logParser', function () {
it('should parse errors', function () {
const { errors } = parseLatexLog('errors.log', { ignoreDuplicates: true })
expect(errors.map(e => [e.line, e.message])).to.deep.equal([