Skip to content

Commit

Permalink
fix: fix some ESLint errors (#171)
Browse files Browse the repository at this point in the history
  • Loading branch information
Robot-Inventor authored Aug 12, 2024
1 parent 61eb746 commit a8575af
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/ts/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Timeline, Tweet } from "twi-ext";
import { Timeline, type Tweet } from "twi-ext";

// eslint-disable-next-line max-statements
const onNewTweet = (tweet: Tweet): void => {
const tweetElement = tweet.element;
const viewCountWithIcon = tweetElement.querySelector<HTMLAnchorElement>("[role='group'] a[href$='analytics']");
if (viewCountWithIcon && viewCountWithIcon.parentElement) {
if (viewCountWithIcon?.parentElement) {
/*
* Measures against incompatibility with "Minimal Theme for Twitter" or other extensions.
* See [#7](https://github.com/Robot-Inventor/hide-view-count/issues/7)
Expand All @@ -14,12 +14,7 @@ const onNewTweet = (tweet: Tweet): void => {
}

const time = document.querySelector<HTMLElement>(`a[aria-describedby] time`);
if (
time &&
time.parentElement &&
time.parentElement.parentElement &&
time.parentElement.parentElement.parentElement
) {
if (time?.parentElement?.parentElement?.parentElement) {
const timeAndViewCountOuter = time.parentElement.parentElement.parentElement;
const targets = timeAndViewCountOuter.querySelectorAll<HTMLElement>("div ~ *");
for (const target of targets) {
Expand Down

0 comments on commit a8575af

Please sign in to comment.