Skip to content

Commit 7b8be70

Browse files
committed
chore: update default branch references from "master" to "main"
1 parent 362a78d commit 7b8be70

11 files changed

+24
-22
lines changed

.changeset/config.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
33
"changelog": ["@changesets/changelog-github", { "repo": "okonet/lint-staged" }],
44
"access": "public",
5-
"baseBranch": "master"
5+
"baseBranch": "main"
66
}

.changeset/sour-taxis-buy.md

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
---

.github/workflows/codeql.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ name: Security Analysis
33
on:
44
push:
55
branches:
6-
- master
6+
- main
77
schedule:
88
- cron: '0 0 * * 1' # 00:00 on Monday.
99
workflow_call:
1010
pull_request:
1111
branches:
12-
- master
12+
- main
1313

1414
jobs:
1515
CodeQL:

.github/workflows/default-branch-push.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Default Branch Push
33
on:
44
push:
55
branches:
6-
- master
6+
- main
77
# Do not run on tags
88
tags-ignore:
99
- '*'

.github/workflows/pull-requests.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Pull Requests
33
on:
44
pull_request:
55
branches:
6-
- master
6+
- main
77

88
permissions:
99
contents: read

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -909,15 +909,15 @@ all changed files between two different branches. If you want to run _lint-stage
909909
Try out the `git diff` command until you are satisfied with the result, for example:
910910

911911
```
912-
git diff --diff-filter=ACMR --name-only master...my-branch
912+
git diff --diff-filter=ACMR --name-only main...my-branch
913913
```
914914

915-
This will print a list of _added_, _changed_, _modified_, and _renamed_ files between `master` and `my-branch`.
915+
This will print a list of _added_, _changed_, _modified_, and _renamed_ files between `main` and `my-branch`.
916916

917917
You can then run lint-staged against the same files with:
918918

919919
```
920-
npx lint-staged --diff="master...my-branch"
920+
npx lint-staged --diff="main...my-branch"
921921
```
922922

923923
</details>

test/e2e/no-stash.test.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,16 @@ describe('lint-staged', () => {
3131
expect(res.stdout).toMatch('No staged files found.')
3232
expect(res.stderr).toMatch('Skipping backup because `--no-stash` was used.')
3333

34-
res = await lintStaged('--diff=master...my-branch')
34+
res = await lintStaged('--diff=main...my-branch')
3535
expect(res.stderr).toMatch('Skipping backup because `--diff` was used.')
3636

37-
await expect(lintStaged('--diff=master...my-branch --stash')).rejects.toThrow(
37+
await expect(lintStaged('--diff=main...my-branch --stash')).rejects.toThrow(
3838
expect.objectContaining({
3939
stderr: expect.stringContaining('lint-staged failed due to a git error.'),
4040
})
4141
)
4242

43-
res = await lintStaged('--diff=master...my-branch --no-stash')
43+
res = await lintStaged('--diff=main...my-branch --no-stash')
4444
expect(res.stderr).toMatch('Skipping backup because `--diff` was used.')
4545
})
4646
)

test/integration/__utils__/withGitIntegration.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ export const withGitIntegration =
105105
const utils = getGitUtils(cwd)
106106

107107
// Init repository with initial commit
108-
await utils.execGit(['init', '--initial-branch', 'master'])
108+
await utils.execGit(['init', '--initial-branch', 'main'])
109109

110110
if (isWindowsActions()) {
111111
await utils.execGit(['config', 'core.autocrlf', 'input'])

test/integration/merge-conflict.test.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ describe('lint-staged', () => {
2828

2929
expect(await readFile('test.js')).toEqual(fileInBranchA)
3030

31-
await execGit(['checkout', 'master'])
31+
await execGit(['checkout', 'main'])
3232

3333
// Create another branch
3434
await execGit(['checkout', '-b', 'branch-b'])
@@ -39,7 +39,7 @@ describe('lint-staged', () => {
3939
expect(await readFile('test.js')).toEqual(fileInBranchBFixed)
4040

4141
// Merge first branch
42-
await execGit(['checkout', 'master'])
42+
await execGit(['checkout', 'main'])
4343
await execGit(['merge', 'branch-a'])
4444
expect(await readFile('test.js')).toEqual(fileInBranchA)
4545
expect(await execGit(['log', '-1', '--pretty=%B'])).toMatch('commit a')
@@ -90,7 +90,7 @@ describe('lint-staged', () => {
9090

9191
expect(await readFile('test.js')).toEqual(fileInBranchA)
9292

93-
await execGit(['checkout', 'master'])
93+
await execGit(['checkout', 'main'])
9494

9595
// Create another branch
9696
await execGit(['checkout', '-b', 'branch-b'])
@@ -103,7 +103,7 @@ describe('lint-staged', () => {
103103
expect(await readFile('test.js')).toEqual(fileInBranchBFixed)
104104

105105
// Merge first branch
106-
await execGit(['checkout', 'master'])
106+
await execGit(['checkout', 'main'])
107107
await execGit(['merge', 'branch-a'])
108108
expect(await readFile('test.js')).toEqual(fileInBranchA)
109109
expect(await execGit(['log', '-1', '--pretty=%B'])).toMatch('commit a')
@@ -220,7 +220,7 @@ describe('lint-staged', () => {
220220
await execGit(['commit', '-m', 'Local changes'])
221221

222222
// Initiate merge with conflict
223-
await expect(execGit(['merge', 'master'])).rejects.toThrow('Merge conflict')
223+
await expect(execGit(['merge', 'main'])).rejects.toThrow('Merge conflict')
224224

225225
expect(await execGit(['status', '--porcelain'])).toMatchInlineSnapshot(`
226226
"UU modifiedFileConflictDiscardLocal.js

test/integration/no-initial-commit.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ describe('lint-staged', () => {
1818
await execGit(['add', 'test.js'], { cwd })
1919

2020
await expect(execGit(['log', '-1'], { cwd })).rejects.toThrowErrorMatchingInlineSnapshot(
21-
`"fatal: your current branch 'master' does not have any commits yet"`
21+
`"fatal: your current branch 'main' does not have any commits yet"`
2222
)
2323

2424
expect(await gitCommit({})).toMatch('Skipping backup because there’s no initial commit yet')

test/unit/getStagedFiles.spec.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -46,24 +46,24 @@ describe('getStagedFiles', () => {
4646

4747
it('should support overriding diff trees with ...', async () => {
4848
execGit.mockImplementationOnce(async () => 'foo.js\u0000bar.js\u0000')
49-
const staged = await getStagedFiles({ cwd: '/', diff: 'master...my-branch' })
49+
const staged = await getStagedFiles({ cwd: '/', diff: 'main...my-branch' })
5050
// Windows filepaths
5151
expect(staged).toEqual([normalizeWindowsPath('/foo.js'), normalizeWindowsPath('/bar.js')])
5252

5353
expect(execGit).toHaveBeenCalledWith(
54-
['diff', '--name-only', '-z', '--diff-filter=ACMR', 'master...my-branch'],
54+
['diff', '--name-only', '-z', '--diff-filter=ACMR', 'main...my-branch'],
5555
{ cwd: '/' }
5656
)
5757
})
5858

5959
it('should support overriding diff trees with multiple args', async () => {
6060
execGit.mockImplementationOnce(async () => 'foo.js\u0000bar.js\u0000')
61-
const staged = await getStagedFiles({ cwd: '/', diff: 'master my-branch' })
61+
const staged = await getStagedFiles({ cwd: '/', diff: 'main my-branch' })
6262
// Windows filepaths
6363
expect(staged).toEqual([normalizeWindowsPath('/foo.js'), normalizeWindowsPath('/bar.js')])
6464

6565
expect(execGit).toHaveBeenCalledWith(
66-
['diff', '--name-only', '-z', '--diff-filter=ACMR', 'master', 'my-branch'],
66+
['diff', '--name-only', '-z', '--diff-filter=ACMR', 'main', 'my-branch'],
6767
{ cwd: '/' }
6868
)
6969
})

0 commit comments

Comments
 (0)