Skip to content

Commit

Permalink
DEV: Update linting (#102)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidtaylorhq authored Nov 20, 2024
1 parent cb57acc commit 6fce990
Show file tree
Hide file tree
Showing 4 changed files with 250 additions and 265 deletions.
20 changes: 10 additions & 10 deletions javascripts/discourse/components/toc-contents.gjs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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);
Expand Down
10 changes: 5 additions & 5 deletions javascripts/discourse/components/toc-mini.gjs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -32,11 +37,6 @@ export default class TocMini extends Component {
document.removeEventListener("click", this.clickOutside);
}

willDestroy() {
super.willDestroy(...arguments);
this.removeClickOutsideListener();
}

<template>
{{#if this.tocProcessor.hasTOC}}
<span class="d-toc-mini">
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": true,
"devDependencies": {
"@discourse/lint-configs": "2.0.1",
"@discourse/lint-configs": "2.2.1",
"ember-template-lint": "6.0.0",
"eslint": "9.14.0",
"prettier": "2.8.8"
Expand Down
Loading

0 comments on commit 6fce990

Please sign in to comment.