From 6fce990e0d31eda64458ba1ece81c71e12f281cb Mon Sep 17 00:00:00 2001 From: David Taylor Date: Wed, 20 Nov 2024 17:36:46 +0000 Subject: [PATCH] DEV: Update linting (#102) --- .../discourse/components/toc-contents.gjs | 20 +- javascripts/discourse/components/toc-mini.gjs | 10 +- package.json | 2 +- pnpm-lock.yaml | 497 +++++++++--------- 4 files changed, 257 insertions(+), 272 deletions(-) diff --git a/javascripts/discourse/components/toc-contents.gjs b/javascripts/discourse/components/toc-contents.gjs index 5bac763..2866420 100644 --- a/javascripts/discourse/components/toc-contents.gjs +++ b/javascripts/discourse/components/toc-contents.gjs @@ -22,6 +22,16 @@ export default class TocContents extends Component { @tracked headingPositions = []; @tracked activeAncestorIds = []; + willDestroy() { + super.willDestroy(...arguments); + window.removeEventListener("scroll", this.updateActiveHeadingOnScroll); + window.removeEventListener("resize", this.calculateHeadingPositions); + this.appEvents.off( + "topic:current-post-changed", + this.calculateHeadingPositions + ); + } + get mappedToc() { return this.mappedTocStructure(this.args.tocStructure); } @@ -35,16 +45,6 @@ export default class TocContents extends Component { this.updateActiveHeadingOnScroll(); // manual on setup so active class is added } - willDestroy() { - super.willDestroy(...arguments); - window.removeEventListener("scroll", this.updateActiveHeadingOnScroll); - window.removeEventListener("resize", this.calculateHeadingPositions); - this.appEvents.off( - "topic:current-post-changed", - this.calculateHeadingPositions - ); - } - @action listenForScroll() { window.addEventListener("scroll", this.updateActiveHeadingOnScroll); diff --git a/javascripts/discourse/components/toc-mini.gjs b/javascripts/discourse/components/toc-mini.gjs index 0edc0e7..fc52071 100644 --- a/javascripts/discourse/components/toc-mini.gjs +++ b/javascripts/discourse/components/toc-mini.gjs @@ -6,6 +6,11 @@ import DButton from "discourse/components/d-button"; export default class TocMini extends Component { @service tocProcessor; + willDestroy() { + super.willDestroy(...arguments); + this.removeClickOutsideListener(); + } + @action clickOutside() { this.tocProcessor.setOverlayVisible(false); @@ -32,11 +37,6 @@ export default class TocMini extends Component { document.removeEventListener("click", this.clickOutside); } - willDestroy() { - super.willDestroy(...arguments); - this.removeClickOutsideListener(); - } -