Skip to content

Commit

Permalink
Merge pull request #2473 from decaffeinate/fix/main-master
Browse files Browse the repository at this point in the history
fix: update references to `master` branch to `main`
  • Loading branch information
eventualbuddha committed Jun 18, 2022
2 parents dabbb7b + 84a3b86 commit 1c417ca
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 41 deletions.
6 changes: 3 additions & 3 deletions README.md
Expand Up @@ -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
18 changes: 11 additions & 7 deletions docs/contribution-guide.md
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand All @@ -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,
Expand Down Expand Up @@ -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

Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions script/update-website.ts
Expand Up @@ -72,8 +72,8 @@ async function updateWebsite(): Promise<void> {
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;
Expand All @@ -94,7 +94,7 @@ async function updateWebsite(): Promise<void> {
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);
Expand Down
2 changes: 1 addition & 1 deletion src/suggestions.ts
Expand Up @@ -91,7 +91,7 @@ export function prependSuggestionComment(code: string, suggestions: Array<Sugges
'/*',
' * decaffeinate suggestions:',
...suggestions.map(({ suggestionCode, message }) => ` * ${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',
' */',
];

Expand Down
8 changes: 4 additions & 4 deletions test/cli_test.ts
Expand Up @@ -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;
`
Expand Down Expand Up @@ -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() {
Expand All @@ -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() {
Expand Down Expand Up @@ -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;
`
Expand Down
46 changes: 23 additions & 23 deletions test/suggestions_test.ts
Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
`,
Expand All @@ -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());
`,
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
Expand All @@ -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);
Expand Down Expand Up @@ -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];
`,
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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));
Expand All @@ -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);
`,
Expand All @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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;
Expand All @@ -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);
Expand All @@ -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;
`,
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit 1c417ca

Please sign in to comment.