From 84a3b86b4ac11667ecc51a1f97192fc3547036f5 Mon Sep 17 00:00:00 2001 From: Brian Donovan <1938+eventualbuddha@users.noreply.github.com> Date: Sat, 18 Jun 2022 14:05:10 -0700 Subject: [PATCH] fix: update references to `master` branch to `main` --- README.md | 6 ++--- docs/contribution-guide.md | 18 +++++++++------ script/update-website.ts | 6 ++--- src/suggestions.ts | 2 +- test/cli_test.ts | 8 +++---- test/suggestions_test.ts | 46 +++++++++++++++++++------------------- 6 files changed, 45 insertions(+), 41 deletions(-) diff --git a/README.md b/README.md index c73be0334..dd90a14dc 100644 --- a/README.md +++ b/README.md @@ -191,6 +191,6 @@ For more usage details, see the output of `decaffeinate --help`. [crash-issue]: https://github.com/decaffeinate/decaffeinate/issues/new?template=crash.md [wrong-issue]: https://github.com/decaffeinate/decaffeinate/issues/new?template=wrong.md [feature-issue]: https://github.com/decaffeinate/decaffeinate/issues/new?template=feature.md -[conversion-guide]: https://github.com/decaffeinate/decaffeinate/blob/master/docs/conversion-guide.md -[suggestions]: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md -[correctness-issues]: https://github.com/decaffeinate/decaffeinate/blob/master/docs/correctness-issues.md +[conversion-guide]: https://github.com/decaffeinate/decaffeinate/blob/main/docs/conversion-guide.md +[suggestions]: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md +[correctness-issues]: https://github.com/decaffeinate/decaffeinate/blob/main/docs/correctness-issues.md diff --git a/docs/contribution-guide.md b/docs/contribution-guide.md index a0344da7a..5e736fd07 100644 --- a/docs/contribution-guide.md +++ b/docs/contribution-guide.md @@ -188,7 +188,7 @@ export default class BoolPatcher extends NodePatcher { Now we've got a patcher that rewrites boolean aliases to `true` and `false`! You can [the real `BoolPatcher` here][BoolPatcher]. -[BoolPatcher]: https://github.com/decaffeinate/decaffeinate/blob/master/src/stages/main/patchers/BoolPatcher.js +[BoolPatcher]: https://github.com/decaffeinate/decaffeinate/blob/main/src/stages/main/patchers/BoolPatcher.js In addition to `overwrite`, there's `insert` and `remove` which patchers can use to @@ -338,7 +338,7 @@ the `right` patcher knows to patch using `patchAsExpression` instead of `patchAsStatement`. In reality, `PlusOp` and several other binary operators are all handled by [`BinaryOpPatcher`][BinaryOpPatcher]. -[BinaryOpPatcher]: https://github.com/decaffeinate/decaffeinate/blob/master/src/stages/main/patchers/BinaryOpPatcher.js +[BinaryOpPatcher]: https://github.com/decaffeinate/decaffeinate/blob/main/src/stages/main/patchers/BinaryOpPatcher.js Finally, we can omit `patchAsStatement` in this case because all it does is delegate to `patchAsExpression`, which is the default behavior. @@ -395,7 +395,7 @@ actually edits `a().b ||= c` to become: (base = a()).b = base.b || c ``` -[locaop]: https://github.com/decaffeinate/decaffeinate/blob/master/src/stages/main/patchers/LogicalOpCompoundAssignOpPatcher.js +[locaop]: https://github.com/decaffeinate/decaffeinate/blob/main/src/stages/main/patchers/LogicalOpCompoundAssignOpPatcher.js How does this work? This is accomplished by the `patchRepeatable` method on patchers. It is responsible for editing its node to store the side-effecty parts @@ -407,7 +407,7 @@ to repeat the source as-is. The `patchAsRepeatableExpression` method can be overridden to provide a custom behavior for making the expression repeatable. See [`MemberAccessOpPatcher`][maop] for an example. -[maop]: https://github.com/decaffeinate/decaffeinate/blob/master/src/stages/main/patchers/MemberAccessOpPatcher.js +[maop]: https://github.com/decaffeinate/decaffeinate/blob/main/src/stages/main/patchers/MemberAccessOpPatcher.js Temporary variables may also be introduced as loop counters or similar. To claim a temporary variable, just use the patchers' `claimFreeBinding` method, @@ -435,10 +435,10 @@ appropriate in a post-processing step. If you have found a bug or have a feature you'd like to add, it is probably worth creating an issue to document the bug or discuss the feature before doing significant work. Once you've decided on an approach, get the code and check -that the tests all pass as shown above, create a branch based on `master` with +that the tests all pass as shown above, create a branch based on `main` with a descriptive name such as `fix-binary-operator-statements` or `add-support-for-soaked-member-access`. Make changes to fix your bug or add your feature, ensuring that you write tests -covering the changes. The tests you add or change *should fail* on `master`. +covering the changes. The tests you add or change *should fail* on `main`. ### Commit messages @@ -454,7 +454,11 @@ We use [semantic-release](https://github.com/semantic-release/semantic-release) * use lowercase on the first line of the commit message without a period * if backward-incompatible changes are in a commit, add `BREAKING CHANGE:` to the footer of the commit with a description -Why do we use this commit message style? To automate releases. Whenever a build passes on `master`, semantic-release will look at the commits since the last release and adjust the version appropriately. Commits with `fix:` bump the patch version, `feat:` bumps the minor version, and `BREAKING CHANGE:` bumps the major version (only one of the three will be bumped per release). +Why do we use this commit message style? To automate releases. Whenever a build +passes on `main`, semantic-release will look at the commits since the last +release and adjust the version appropriately. Commits with `fix:` bump the patch +version, `feat:` bumps the minor version, and `BREAKING CHANGE:` bumps the major +version (only one of the three will be bumped per release). Once you're satisfied with your changes, create a pull request on your own fork. Please provide a description of *why* you're issuing the pull request, and diff --git a/script/update-website.ts b/script/update-website.ts index 298aefc4e..17f7228fa 100644 --- a/script/update-website.ts +++ b/script/update-website.ts @@ -72,8 +72,8 @@ async function updateWebsite(): Promise { const decaffeinateRegistry = decaffeinatePackage['publishConfig']['registry']; console.log('Setting up website repo…'); - await run('git', ['fetch', '-f', 'website', 'master:website-master']); - await run('git', ['reset', '--hard', 'website-master']); + await run('git', ['fetch', '-f', 'website', 'main:website-main']); + await run('git', ['reset', '--hard', 'website-main']); const websitePackage = await pkg(); const currentVersion = websitePackage['devDependencies']['decaffeinate'] as string; @@ -94,7 +94,7 @@ async function updateWebsite(): Promise { if (commit) { console.log('Pushing changes to website repo…'); await run('git', ['commit', '-av', '-m', `chore: update to decaffeinate ${latestVersion}`]); - await run('git', ['push', 'website', 'HEAD:master']); + await run('git', ['push', 'website', 'HEAD:main']); } else { console.log('Not committing because --no-commit was given:'); console.log((await run('git', ['diff'])).stdout); diff --git a/src/suggestions.ts b/src/suggestions.ts index a5c1b7716..cec5d3dba 100644 --- a/src/suggestions.ts +++ b/src/suggestions.ts @@ -91,7 +91,7 @@ export function prependSuggestionComment(code: string, suggestions: Array ` * ${suggestionCode}: ${message}`), - ' * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md', + ' * Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md', ' */', ]; diff --git a/test/cli_test.ts b/test/cli_test.ts index 6f723033d..fcd78cf7b 100644 --- a/test/cli_test.ts +++ b/test/cli_test.ts @@ -296,7 +296,7 @@ describe('decaffeinate CLI', () => { /* * decaffeinate suggestions: * DS102: Remove unnecessary code created because of implicit returns - * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md + * Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md */ const f = (x = 1) => 2; ` @@ -370,7 +370,7 @@ describe('decaffeinate CLI', () => { /* * decaffeinate suggestions: * DS002: Fix invalid constructor - * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md + * Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md */ class A extends B { constructor() { @@ -396,7 +396,7 @@ describe('decaffeinate CLI', () => { /* * decaffeinate suggestions: * DS002: Fix invalid constructor - * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md + * Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md */ class A extends B { constructor() { @@ -448,7 +448,7 @@ describe('decaffeinate CLI', () => { /* * decaffeinate suggestions: * DS207: Consider shorter variations of null checks - * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md + * Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md */ typeof a !== 'undefined' && a !== null; ` diff --git a/test/suggestions_test.ts b/test/suggestions_test.ts index b127efafd..6a77b0038 100644 --- a/test/suggestions_test.ts +++ b/test/suggestions_test.ts @@ -13,7 +13,7 @@ describe('suggestions', () => { * decaffeinate suggestions: * DS002: Fix invalid constructor * DS102: Remove unnecessary code created because of implicit returns - * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md + * Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md */ class A extends B { constructor(...args) { @@ -42,7 +42,7 @@ describe('suggestions', () => { /* * decaffeinate suggestions: * DS102: Remove unnecessary code created because of implicit returns - * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md + * Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md */ class A extends B { constructor(...args) { @@ -93,7 +93,7 @@ describe('suggestions', () => { /* * decaffeinate suggestions: * DS002: Fix invalid constructor - * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md + * Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md */ class A extends B { constructor(c) { @@ -126,7 +126,7 @@ describe('suggestions', () => { /* * decaffeinate suggestions: * DS101: Remove unnecessary use of Array.from - * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md + * Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md */ for (let a of Array.from(b)) { c; @@ -168,7 +168,7 @@ describe('suggestions', () => { /* * decaffeinate suggestions: * DS101: Remove unnecessary use of Array.from - * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md + * Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md */ Array.from(b).includes(a); `, @@ -190,7 +190,7 @@ describe('suggestions', () => { /* * decaffeinate suggestions: * DS102: Remove unnecessary code created because of implicit returns - * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md + * Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md */ (() => f()); `, @@ -249,7 +249,7 @@ describe('suggestions', () => { /* * decaffeinate suggestions: * DS103: Rewrite code to no longer use __guard__, or convert again using --optional-chaining - * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md + * Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md */ __guard__(a(), x => x.b); function __guard__(value, transform) { @@ -290,7 +290,7 @@ describe('suggestions', () => { /* * decaffeinate suggestions: * DS207: Consider shorter variations of null checks - * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md + * Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md */ if (typeof a !== 'undefined' && a !== null) { a.b; @@ -313,7 +313,7 @@ describe('suggestions', () => { /* * decaffeinate suggestions: * DS104: Avoid inline assignments - * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md + * Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md */ let name; accounts[name = getAccountId()] = Math.floor(accounts[name] / splitFactor); @@ -351,7 +351,7 @@ describe('suggestions', () => { /* * decaffeinate suggestions: * DS201: Simplify complex destructure assignments - * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md + * Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md */ const array = d.a, b = array[0], c = array[array.length - 1]; `, @@ -389,7 +389,7 @@ describe('suggestions', () => { /* * decaffeinate suggestions: * DS202: Simplify dynamic range loops - * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md + * Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md */ for (let a = b, end = c, asc = b <= end; asc ? a <= end : a >= end; asc ? a++ : a--) { d; @@ -432,7 +432,7 @@ describe('suggestions', () => { /* * decaffeinate suggestions: * DS203: Remove \`|| {}\` from converted for-own loops - * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md + * Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md */ for (let a of Object.keys(b || {})) { c; @@ -457,7 +457,7 @@ describe('suggestions', () => { * DS101: Remove unnecessary use of Array.from * DS104: Avoid inline assignments * DS204: Change includes calls to have a more natural evaluation order - * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md + * Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md */ let needle; (needle = a(), Array.from(b()).includes(needle)); @@ -479,7 +479,7 @@ describe('suggestions', () => { /* * decaffeinate suggestions: * DS101: Remove unnecessary use of Array.from - * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md + * Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md */ Array.from(b).includes(a); `, @@ -503,7 +503,7 @@ describe('suggestions', () => { /* * decaffeinate suggestions: * DS205: Consider reworking code to avoid use of IIFEs - * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md + * Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md */ const x = (() => { try { return a; @@ -532,7 +532,7 @@ describe('suggestions', () => { /* * decaffeinate suggestions: * DS102: Remove unnecessary code created because of implicit returns - * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md + * Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md */ (function() { if (a) { @@ -560,7 +560,7 @@ describe('suggestions', () => { /* * decaffeinate suggestions: * DS206: Consider reworking classes to avoid initClass - * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md + * Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md */ class A { static initClass() { @@ -606,7 +606,7 @@ describe('suggestions', () => { /* * decaffeinate suggestions: * DS207: Consider shorter variations of null checks - * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md + * Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md */ const a = 1; const x = a != null ? a : b; @@ -629,7 +629,7 @@ describe('suggestions', () => { /* * decaffeinate suggestions: * DS207: Consider shorter variations of null checks - * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md + * Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md */ const a = 1; const b = (a != null); @@ -651,7 +651,7 @@ describe('suggestions', () => { /* * decaffeinate suggestions: * DS208: Avoid top-level this - * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md + * Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md */ this; `, @@ -673,7 +673,7 @@ describe('suggestions', () => { /* * decaffeinate suggestions: * DS208: Avoid top-level this - * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md + * Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md */ () => { return this; @@ -735,7 +735,7 @@ describe('suggestions', () => { /* * decaffeinate suggestions: * DS209: Avoid top-level return - * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md + * Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md */ if (foo) { return; @@ -760,7 +760,7 @@ describe('suggestions', () => { /* * decaffeinate suggestions: * DS207: Consider shorter variations of null checks - * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md + * Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md */ if (typeof a !== 'undefined' && a !== null) { a.b;