import React from 'dom-chef'; import select from 'select-dom'; import * as pageDetect from 'github-url-detection'; import features from '.'; import getDefaultBranch from '../github-helpers/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 default branch is an anti-pattern.
); } void features.add({ id: __filebasename, 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: [ pageDetect.isCompare ], init });