-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lint #6555
Merged
Lint #6555
Changes from 1 commit
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
5b57ec2
Lint
fregante 973b6d8
/2
fregante 93ff7ab
Restore source/github-helpers/index.ts
fregante c94bb34
Restore source/github-helpers/index.test.ts
fregante a2afb13
Drop 5222 from auto-filtered issues
fregante 63eaee0
`enable-file-links-in-compare-view` test urls
fregante 27f34e4
Merge remote-tracking branch 'origin/main' into lint20111
fregante 11d25e5
Update types
fregante 1bf6952
API v4 comment update
fregante File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,12 +38,12 @@ function initRepoList(signal: AbortSignal): void { | |
} | ||
|
||
void features.add(import.meta.url, { | ||
include: [ | ||
pageDetect.hasRepoHeader, | ||
], | ||
asLongAs: [ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
() => /\.github\.(io|com)$/.test(getRepo()?.name ?? 'shush eslint'), | ||
], | ||
include: [ | ||
pageDetect.hasRepoHeader, | ||
], | ||
init: initRepo, | ||
}, { | ||
include: [ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,8 +6,10 @@ import {ParseSelector} from 'typed-query-selector/parser'; | |
import getCallerID from './caller-id'; | ||
import isDevelopmentVersion from './is-development-version'; | ||
|
||
type ObserverListener<Selector extends string> = (element: ParseSelector<Selector, HTMLElement>, options: SignalAsOptions) => void; | ||
|
||
const animation = 'rgh-selector-observer'; | ||
const getListener = <ExpectedElement extends HTMLElement>(seenMark: string, selector: string, callback: (element: ExpectedElement) => void) => function (event: AnimationEvent) { | ||
const getListener = <ExpectedElement extends HTMLElement>(seenMark: string, selector: string, callback: ObserverListener<string>, signal?: AbortSignal) => function (event: AnimationEvent) { | ||
const target = event.target as ExpectedElement; | ||
// The target can match a selector even if the animation actually happened on a ::before pseudo-element, so it needs an explicit exclusion here | ||
if (target.classList.contains(seenMark) || !target.matches(selector)) { | ||
|
@@ -17,7 +19,7 @@ const getListener = <ExpectedElement extends HTMLElement>(seenMark: string, sele | |
// Removes this specific selector’s animation once it was seen | ||
target.classList.add(seenMark); | ||
|
||
callback(target); | ||
callback(target, {signal}); | ||
}; | ||
|
||
const registerAnimation = onetime((): void => { | ||
|
@@ -28,8 +30,8 @@ export default function observe< | |
Selector extends string, | ||
>( | ||
selectors: Selector | readonly Selector[], | ||
listener: (element: ParseSelector<Selector, HTMLElement>) => void, | ||
{signal}: {signal?: AbortSignal} = {}, | ||
listener: ObserverListener<Selector>, | ||
{signal}: SignalAsOptions = {}, | ||
): void { | ||
if (signal?.aborted) { | ||
return; | ||
|
@@ -55,5 +57,5 @@ export default function observe< | |
signal?.addEventListener('abort', () => { | ||
rule.remove(); | ||
}); | ||
window.addEventListener('animationstart', getListener(seenMark, selector, listener), {signal}); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This lets us listen to the feature unload inside the observer’s callback: function add(element, {signal}) {
wrap(element, <strong/>)
signal.addEventListener('abort', () => {
element.remove();
});
}
function init(signal) {
observe('a', add, {signal})
} Mentioned in: |
||
window.addEventListener('animationstart', getListener(seenMark, selector, listener, signal), {signal}); | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PJAX is old news