Skip to content

Commit 57e7d78

Browse files
committed
Drop FeatureInit type
`eslint-plugin-import` doesn't support exported types: import-js/eslint-plugin-import#1282
1 parent 12ee45e commit 57e7d78

27 files changed

+56
-57
lines changed

source/features/batch-open-issues.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* eslint-disable no-alert */
22
import React from 'dom-chef';
33
import select from 'select-dom';
4-
import features, {FeatureInit} from '../libs/features';
4+
import features from '../libs/features';
55

66
const confirmationRequiredCount = 10;
77

@@ -32,7 +32,7 @@ function openIssues() {
3232
});
3333
}
3434

35-
function init(): FeatureInit {
35+
function init(): boolean | void {
3636
if (select.all('.js-issue-row').length < 2) {
3737
return false;
3838
}

source/features/branch-buttons.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import select from 'select-dom';
33
import compareVersions from 'tiny-version-compare';
44
import * as api from '../libs/api';
55
import * as icons from '../libs/icons';
6-
import features, {AsyncFeatureInit} from '../libs/features';
6+
import features from '../libs/features';
77
import {isRepoRoot} from '../libs/page-detect';
88
import {appendBefore} from '../libs/dom-utils';
99
import {groupSiblings} from '../libs/group-buttons';
@@ -93,7 +93,7 @@ async function getDefaultBranchLink() {
9393
);
9494
}
9595

96-
async function init(): AsyncFeatureInit {
96+
async function init(): Promise<boolean | void> {
9797
const container = select('.file-navigation');
9898
if (!container) {
9999
return false;

source/features/ci-link.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import domify from 'doma';
22
import select from 'select-dom';
33
import onetime from 'onetime';
4-
import features, {AsyncFeatureInit} from '../libs/features';
4+
import features from '../libs/features';
55
import {appendBefore} from '../libs/dom-utils';
66
import {getRepoURL, getRepoBranch} from '../libs/utils';
77

@@ -16,7 +16,7 @@ const fetchStatus = onetime(async () => {
1616
return icon;
1717
});
1818

19-
async function init(): AsyncFeatureInit {
19+
async function init(): Promise<boolean | void> {
2020
const icon = await fetchStatus();
2121
if (!icon) {
2222
return false;

source/features/extend-status-labels.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import React from 'dom-chef';
22
import select from 'select-dom';
33
import {wrap} from '../libs/dom-utils';
4-
import features, {FeatureInit} from '../libs/features';
4+
import features from '../libs/features';
55

6-
function init(): FeatureInit {
6+
function init(): boolean | void {
77
if (select.exists('.gh-header-meta a .State')) {
88
return false;
99
}

source/features/faster-pr-diff-options.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'dom-chef';
22
import select from 'select-dom';
33
import * as icons from '../libs/icons';
4-
import features, {FeatureInit} from '../libs/features';
4+
import features from '../libs/features';
55

66
function createDiffStyleToggle() {
77
const params = new URLSearchParams(location.search);
@@ -56,7 +56,7 @@ function wrap(...elements: Element[]) {
5656
return <>{elements.map(element => <div className="diffbar-item">{element}</div>)}</>;
5757
}
5858

59-
function init(): FeatureInit {
59+
function init(): boolean | void {
6060
const container = select([
6161
'.table-of-contents.Details .BtnGroup', // In single commit view
6262
'.pr-review-tools > .diffbar-item' // In review view

source/features/fix-squash-and-merge-message.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import select from 'select-dom';
2-
import features, {FeatureInit} from '../libs/features';
2+
import features from '../libs/features';
33

4-
function init(): FeatureInit {
4+
function init(): boolean | void {
55
const button = select('.merge-message .btn-group-squash [type=button]');
66
if (!button) {
77
return false;

source/features/fix-squash-and-merge-title.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import select from 'select-dom';
2-
import features, {FeatureInit} from '../libs/features';
2+
import features from '../libs/features';
33

4-
function init(): FeatureInit {
4+
function init(): boolean | void {
55
const btn = select('.merge-message .btn-group-squash [type=button]');
66
if (!btn) {
77
return false;

source/features/linkify-urls-in-code.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import select from 'select-dom';
22
import linkifyUrls from 'linkify-urls';
33
import linkifyIssues from 'linkify-issues';
4-
import features, {FeatureInit} from '../libs/features';
4+
import features from '../libs/features';
55
import getTextNodes from '../libs/get-text-nodes';
66
import {getOwnerAndRepo} from '../libs/utils';
77

@@ -51,7 +51,7 @@ export const editTextNodes = (
5151
}
5252
};
5353

54-
function init(): FeatureInit {
54+
function init(): boolean | void {
5555
const wrappers = select.all(`
5656
.blob-wrapper:not(.${linkifiedURLClass}),
5757
.comment-body:not(.${linkifiedURLClass})

source/features/mark-private-orgs.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import select from 'select-dom';
22
import {getUsername} from '../libs/utils';
3-
import features, {AsyncFeatureInit} from '../libs/features';
3+
import features from '../libs/features';
44
import * as icons from '../libs/icons';
55
import * as api from '../libs/api';
66

7-
async function init(): AsyncFeatureInit {
7+
async function init(): Promise<boolean | void> {
88
const orgs = select.all<HTMLAnchorElement>('.avatar-group-item[data-hovercard-type="organization"]');
99
if (orgs.length === 0) {
1010
return false;

source/features/move-marketplace-link-to-profile-dropdown.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import React from 'dom-chef';
22
import select from 'select-dom';
3-
import features, {FeatureInit} from '../libs/features';
3+
import features from '../libs/features';
44

5-
function init(): FeatureInit {
5+
function init(): boolean | void {
66
const lastDivider = select.all('.user-nav .dropdown-divider').pop();
77
if (!lastDivider) {
88
return false;

source/features/pr-branches.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ The head branch is added when it's from the same repo or the PR is by the curren
88
import React from 'dom-chef';
99
import select from 'select-dom';
1010
import * as api from '../libs/api';
11-
import features, {AsyncFeatureInit} from '../libs/features';
11+
import features from '../libs/features';
1212
import getDefaultBranch from '../libs/get-default-branch';
1313
import {getOwnerAndRepo} from '../libs/utils';
1414
import {openPullRequest} from '../libs/icons';
@@ -102,7 +102,7 @@ function createLink(ref: RepositoryReference) {
102102
);
103103
}
104104

105-
async function init(): AsyncFeatureInit {
105+
async function init(): Promise<boolean | void> {
106106
const elements = select.all('.js-issue-row');
107107
if (elements.length === 0) {
108108
return false;

source/features/preserve-whitespace-option-in-nav.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ When navigating with next/previous in review mode, preserve whitespace option.
33
*/
44

55
import select from 'select-dom';
6-
import features, {FeatureInit} from '../libs/features';
6+
import features from '../libs/features';
77

8-
function init(): FeatureInit {
8+
function init(): boolean | void {
99
if (new URLSearchParams(location.search).get('w') !== '1') {
1010
return false;
1111
}

source/features/prev-next-commit-buttons.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ This feature duplicates the Prev/Next buttons and inserts them at the bottom of
66
the page too.
77
*/
88
import select from 'select-dom';
9-
import features, {FeatureInit} from '../libs/features';
9+
import features from '../libs/features';
1010

11-
function init(): FeatureInit {
11+
function init(): boolean | void {
1212
const originalPrevNext = select('.commit .BtnGroup.float-right');
1313
if (!originalPrevNext) {
1414
return false;

source/features/profile-gists-link.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import React from 'dom-chef';
22
import select from 'select-dom';
33
import * as api from '../libs/api';
4-
import features, {AsyncFeatureInit} from '../libs/features';
4+
import features from '../libs/features';
55
import {getCleanPathname} from '../libs/utils';
66
import {isEnterprise} from '../libs/page-detect';
77

8-
async function init(): AsyncFeatureInit {
8+
async function init(): Promise<boolean | void> {
99
const container = select('body.page-profile .UnderlineNav-body');
1010

1111
if (!container) {

source/features/profile-hotkey.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import select from 'select-dom';
2-
import features, {FeatureInit} from '../libs/features';
2+
import features from '../libs/features';
33
import {getUsername} from '../libs/utils';
44

5-
function init(): FeatureInit {
5+
function init(): boolean | void {
66
const menuItem = select(`#user-links a.dropdown-item[href="/${getUsername()}"]`);
77

88
if (menuItem) {

source/features/quick-review-buttons.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import React from 'dom-chef';
22
import select from 'select-dom';
3-
import features, {FeatureInit} from '../libs/features';
3+
import features from '../libs/features';
44

55
const btnClassMap = {
66
approve: 'btn-primary',
77
reject: 'btn-danger'
88
};
99

10-
function init(): FeatureInit {
10+
function init(): boolean | void {
1111
const form = select('[action$="/reviews"]')!;
1212
const radios = select.all<HTMLInputElement>('[type="radio"][name="pull_request_review[event]"]', form);
1313

source/features/releases-tab.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ The tab isn’t shown if there are no releases.
77

88
import React from 'dom-chef';
99
import select from 'select-dom';
10-
import features, {AsyncFeatureInit} from '../libs/features';
10+
import features from '../libs/features';
1111
import * as icons from '../libs/icons';
1212
import * as cache from '../libs/cache';
1313
import {getRepoURL} from '../libs/utils';
@@ -31,7 +31,7 @@ function updateReleasesCount() {
3131
return cached;
3232
}
3333

34-
async function init(): AsyncFeatureInit {
34+
async function init(): Promise<boolean | void> {
3535
await safeElementReady('.pagehead + *'); // Wait for the tab bar to be loaded
3636
const count = await updateReleasesCount();
3737
if (count === 0) {

source/features/remove-projects-tab.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ New projects can still be created via the [`Create new…` menu](https://user-im
77
import React from 'dom-chef';
88
import select from 'select-dom';
99
import onetime from 'onetime';
10-
import features, {AsyncFeatureInit} from '../libs/features';
10+
import features from '../libs/features';
1111
import {safeElementReady} from '../libs/dom-utils';
1212
import {isUserProfile, isOwnOrganizationProfile, isOrganizationProfile} from '../libs/page-detect';
1313

@@ -38,7 +38,7 @@ const addNewProjectLink = onetime(() => {
3838
);
3939
});
4040

41-
async function init(): AsyncFeatureInit {
41+
async function init(): Promise<boolean | void> {
4242
await safeElementReady(`
4343
.orghead + *,
4444
.repohead + *,

source/features/remove-upload-files-button.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import select from 'select-dom';
2-
import features, {FeatureInit} from '../libs/features';
2+
import features from '../libs/features';
33
import {getRepoURL} from '../libs/utils';
44

5-
function init(): FeatureInit {
5+
function init(): boolean | void {
66
const uploadFilesButton = select(`.file-navigation a[href^="/${getRepoURL()}/upload"]`);
77
if (!uploadFilesButton) {
88
return false;

source/features/show-followers-you-know.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React from 'dom-chef';
22
import domify from 'doma';
33
import select from 'select-dom';
44
import {getCleanPathname} from '../libs/utils';
5-
import features, {AsyncFeatureInit} from '../libs/features';
5+
import features from '../libs/features';
66

77
const fetchStargazers = async () => {
88
const url = `${location.origin}/${getCleanPathname()}/followers/you_know`;
@@ -30,7 +30,7 @@ const renderAvatar = (image: HTMLImageElement) => {
3030
);
3131
};
3232

33-
async function init(): AsyncFeatureInit {
33+
async function init(): Promise<boolean | void> {
3434
const container = select('[itemtype="http://schema.org/Person"]');
3535
if (!container) {
3636
return false;

source/features/show-names.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import React from 'dom-chef';
22
import select from 'select-dom';
33
import * as api from '../libs/api';
4-
import features, {AsyncFeatureInit} from '../libs/features';
4+
import features from '../libs/features';
55
import {getUsername} from '../libs/utils';
66

7-
async function init(): AsyncFeatureInit {
7+
async function init(): Promise<boolean | void> {
88
const usernameElements = select.all('.js-discussion .author:not(.rgh-fullname):not([href*="/apps/"])');
99

1010
const usernames = new Set();

source/features/show-recently-pushed-branches-on-more-pages.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ This feature also adds this widget to the Issues List, Issue page and PR page
88

99
import React from 'dom-chef';
1010
import select from 'select-dom';
11-
import features, {AsyncFeatureInit} from '../libs/features';
11+
import features from '../libs/features';
1212
import {getRepoURL} from '../libs/utils';
1313

1414
const repoUrl = getRepoURL();
1515

16-
async function init(): AsyncFeatureInit {
16+
async function init(): Promise<boolean | void> {
1717
const fragmentURL = `/${repoUrl}/show_partial?partial=tree%2Frecently_touched_branches_list`;
1818
if (select.exists(`[data-url='${fragmentURL}'], [src='${fragmentURL}']`)) {
1919
return false;

source/features/show-user-top-repositories.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ https://user-images.githubusercontent.com/1402241/48474026-43e3ae80-e82c-11e8-93
55

66
import React from 'dom-chef';
77
import select from 'select-dom';
8-
import features, {FeatureInit} from '../libs/features';
8+
import features from '../libs/features';
99
import {getCleanPathname} from '../libs/utils';
1010

1111
function buildUrl(queryField: string) {
@@ -17,7 +17,7 @@ function buildUrl(queryField: string) {
1717
return url;
1818
}
1919

20-
function init(): FeatureInit {
20+
function init(): boolean | void {
2121
const showcaseTitle = select('.js-pinned-items-reorder-container .text-normal')!;
2222
if (!showcaseTitle) {
2323
return false;

source/features/trending-menu-item.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import React from 'dom-chef';
2-
import features, {AsyncFeatureInit} from '../libs/features';
2+
import features from '../libs/features';
33
import {safeElementReady} from '../libs/dom-utils';
44

5-
async function init(): AsyncFeatureInit {
5+
async function init(): Promise<boolean | void> {
66
const exploreLink = await safeElementReady('.HeaderNavlink[href="/explore"]');
77
if (!exploreLink) {
88
return false;

source/features/useful-not-found-page.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ This feature adds more useful 404 (not found) page.
66

77
import React from 'dom-chef';
88
import select from 'select-dom';
9-
import features, {FeatureInit} from '../libs/features';
9+
import features from '../libs/features';
1010
import {getCleanPathname} from '../libs/utils';
1111
import getDefaultBranch from '../libs/get-default-branch';
1212

@@ -76,7 +76,7 @@ async function addDefaultBranchLink(bar: Element) {
7676
);
7777
}
7878

79-
function init(): FeatureInit {
79+
function init(): boolean | void {
8080
const parts = parseCurrentURL();
8181
if (parts.length <= 1 || !select.exists('[alt*="This is not the web page you are looking for"]')) {
8282
return false;

source/features/warn-pr-from-master.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ https://blog.jasonmeridth.com/posts/do-not-issue-pull-requests-from-your-master-
88

99
import React from 'dom-chef';
1010
import select from 'select-dom';
11-
import features, {AsyncFeatureInit} from '../libs/features';
11+
import features from '../libs/features';
1212
import getDefaultBranch from '../libs/get-default-branch';
1313

14-
async function init(): AsyncFeatureInit {
14+
async function init(): Promise<boolean | void> {
1515
const defaultBranch = await getDefaultBranch();
1616
// Expected: /user/repo/compare/master...user:master
1717
if (!location.pathname.endsWith(':' + defaultBranch)) {

0 commit comments

Comments
 (0)