import React from 'dom-chef'; import select from 'select-dom'; import features from '../libs/features'; import getDefaultBranch from '../libs/get-default-branch'; async function init(): Promise { const defaultBranch = await getDefaultBranch(); // Expected: /user/repo/compare/master...user:master if (!location.pathname.endsWith(':' + defaultBranch)) { return false; } select('.gh-header-new-pr')!.append(
Note: Creating a PR from the the default branch is an anti-pattern.
); } features.add({ id: __featureName__, description: 'Warns you when creating a pull request from the default branch, as it’s an anti-pattern.', screenshot: 'https://user-images.githubusercontent.com/1402241/52543516-3ca94e00-2de5-11e9-9f80-ff8f9fe8bdc4.png', include: [ features.isCompare ], load: features.onAjaxedPages, init });