diff --git a/.eslintrc b/.eslintrc index 8ab3ee175..b013cd5aa 100644 --- a/.eslintrc +++ b/.eslintrc @@ -25,6 +25,7 @@ "rules": { "eqeqeq": 2, "curly": 2, + "object-shorthand": "error", "no-mixed-operators": "off", "no-useless-escape": "off", "es/no-regexp-lookbehind-assertions": "error", diff --git a/app/editor/index.tsx b/app/editor/index.tsx index 0de98128f..f39989099 100644 --- a/app/editor/index.tsx +++ b/app/editor/index.tsx @@ -430,7 +430,7 @@ export class Editor extends React.PureComponent< state: this.createState(this.props.value), editable: () => !this.props.readOnly, nodeViews: this.nodeViews, - dispatchTransaction: function (transaction) { + dispatchTransaction(transaction) { // callback is bound to have the view instance as its this binding const { state, transactions } = this.state.applyTransaction( transaction diff --git a/app/scenes/GroupEdit.tsx b/app/scenes/GroupEdit.tsx index 31d9cd43b..f3907ab1e 100644 --- a/app/scenes/GroupEdit.tsx +++ b/app/scenes/GroupEdit.tsx @@ -25,7 +25,7 @@ function GroupEdit({ group, onSubmit }: Props) { try { await group.save({ - name: name, + name, }); onSubmit(); } catch (err) { diff --git a/app/scenes/GroupNew.tsx b/app/scenes/GroupNew.tsx index 1484d7453..ff84b9ab3 100644 --- a/app/scenes/GroupNew.tsx +++ b/app/scenes/GroupNew.tsx @@ -29,7 +29,7 @@ function GroupNew({ onSubmit }: Props) { const group = new Group( { - name: name, + name, }, groups ); diff --git a/app/stores/DocumentsStore.ts b/app/stores/DocumentsStore.ts index efd4c74b1..01f70fe60 100644 --- a/app/stores/DocumentsStore.ts +++ b/app/stores/DocumentsStore.ts @@ -532,7 +532,7 @@ export default class DocumentsStore extends BaseStore { id: documentId, collectionId, parentDocumentId, - index: index, + index, }); invariant(res?.data, "Data not available"); res.data.documents.forEach(this.add); diff --git a/app/utils/browser.ts b/app/utils/browser.ts index 2fc7fb098..fe60c4a51 100644 --- a/app/utils/browser.ts +++ b/app/utils/browser.ts @@ -20,7 +20,7 @@ let supportsPassive = false; try { const opts = Object.defineProperty({}, "passive", { - get: function () { + get() { supportsPassive = true; }, }); diff --git a/server/__mocks__/bull.ts b/server/__mocks__/bull.ts index 0ad21460d..33fc4cb32 100644 --- a/server/__mocks__/bull.ts +++ b/server/__mocks__/bull.ts @@ -35,7 +35,7 @@ export default class Queue { createJob = function (data: any) { return { - data: data, + data, }; }; } diff --git a/server/commands/teamUpdater.ts b/server/commands/teamUpdater.ts index 8ab383d8a..ebdd660a1 100644 --- a/server/commands/teamUpdater.ts +++ b/server/commands/teamUpdater.ts @@ -119,7 +119,7 @@ const teamUpdater = async ({ params, user, team, ip }: TeamUpdaterProps) => { actorId: user.id, teamId: user.teamId, data, - ip: ip, + ip, }, { transaction, diff --git a/server/models/Group.ts b/server/models/Group.ts index 362b52718..1f6d8c0fd 100644 --- a/server/models/Group.ts +++ b/server/models/Group.ts @@ -31,7 +31,7 @@ import NotContainsUrl from "./validators/NotContainsUrl"; tableName: "groups", modelName: "group", validate: { - isUniqueNameInTeam: async function () { + async isUniqueNameInTeam() { const foundItem = await Group.findOne({ where: { teamId: this.teamId, diff --git a/server/presenters/webhook.ts b/server/presenters/webhook.ts index 4017f8d5e..a7592a1e2 100644 --- a/server/presenters/webhook.ts +++ b/server/presenters/webhook.ts @@ -33,6 +33,6 @@ export default function present({ webhookSubscriptionId: delivery.webhookSubscriptionId, createdAt: delivery.createdAt, event: event.name, - payload: payload, + payload, }; } diff --git a/server/routes/auth/providers/index.ts b/server/routes/auth/providers/index.ts index 364ffb7b1..67c9a604a 100644 --- a/server/routes/auth/providers/index.ts +++ b/server/routes/auth/providers/index.ts @@ -39,7 +39,7 @@ requireDirectory(__dirname).forEach(([module, id]) => { name: config.name, enabled: config.enabled, authUrl: signin(id), - router: router, + router, }); } }); diff --git a/server/utils/turndown/breaks.ts b/server/utils/turndown/breaks.ts index 82494d504..b7af821a3 100644 --- a/server/utils/turndown/breaks.ts +++ b/server/utils/turndown/breaks.ts @@ -8,7 +8,7 @@ import TurndownService from "turndown"; export default function breaks(turndownService: TurndownService) { turndownService.addRule("breaks", { filter: ["br"], - replacement: function () { + replacement() { return "\n"; }, }); diff --git a/server/utils/turndown/confluence-code-block.ts b/server/utils/turndown/confluence-code-block.ts index 52b53f1f5..50f295178 100644 --- a/server/utils/turndown/confluence-code-block.ts +++ b/server/utils/turndown/confluence-code-block.ts @@ -10,7 +10,7 @@ const highlightRegExp = /brush: ([a-z0-9]+);/; */ export default function confluenceCodeBlock(turndownService: TurndownService) { turndownService.addRule("fencedConfluenceHighlightedCodeBlock", { - filter: function (node) { + filter(node) { const firstChild = node.firstChild; return ( node.nodeName === "DIV" && @@ -19,7 +19,7 @@ export default function confluenceCodeBlock(turndownService: TurndownService) { firstChild.className === "syntaxhighlighter-pre" ); }, - replacement: function (content, node) { + replacement(content, node) { const dataSyntaxhighlighterParams = // @ts-expect-error getAttribute exists node.firstChild?.getAttribute("data-syntaxhighlighter-params") ?? ""; diff --git a/server/utils/turndown/confluence-task-list.ts b/server/utils/turndown/confluence-task-list.ts index b8de96d86..7b5d512ef 100644 --- a/server/utils/turndown/confluence-task-list.ts +++ b/server/utils/turndown/confluence-task-list.ts @@ -7,7 +7,7 @@ import TurndownService from "turndown"; */ export default function confluenceTaskList(turndownService: TurndownService) { turndownService.addRule("confluenceTaskList", { - filter: function (node) { + filter(node) { return ( node.nodeName === "LI" && node.parentNode?.nodeName === "UL" && @@ -15,7 +15,7 @@ export default function confluenceTaskList(turndownService: TurndownService) { node.parentNode?.className.includes("inline-task-list") ); }, - replacement: function (content, node) { + replacement(content, node) { return ( // @ts-expect-error className exists (node.className === "checked" ? "- [x]" : "- [ ]") + ` ${content} \n` diff --git a/server/utils/validators.ts b/server/utils/validators.ts index 63b37c196..f15787e8c 100644 --- a/server/utils/validators.ts +++ b/server/utils/validators.ts @@ -13,7 +13,7 @@ export function CannotUseWithout( registerDecorator({ name: "cannotUseWithout", target: object.constructor, - propertyName: propertyName, + propertyName, constraints: [property], options: validationOptions, validator: { diff --git a/shared/editor/nodes/Image.tsx b/shared/editor/nodes/Image.tsx index a6923f12e..b350e8637 100644 --- a/shared/editor/nodes/Image.tsx +++ b/shared/editor/nodes/Image.tsx @@ -174,7 +174,7 @@ export default class Image extends Node { src: img?.getAttribute("src"), alt: img?.getAttribute("alt"), title: img?.getAttribute("title"), - layoutClass: layoutClass, + layoutClass, }; }, }, diff --git a/shared/editor/rules/notices.ts b/shared/editor/rules/notices.ts index db2942f57..e4fe19e99 100644 --- a/shared/editor/rules/notices.ts +++ b/shared/editor/rules/notices.ts @@ -6,7 +6,7 @@ export default function notice(md: MarkdownIt): void { return customFence(md, "notice", { marker: ":", validate: () => true, - render: function (tokens: Token[], idx: number) { + render(tokens: Token[], idx: number) { const { info } = tokens[idx]; if (tokens[idx].nesting === 1) {