Skip to content

Commit 8352569

Browse files
authored
Docs: Update CONTRIBUTING.md
Migrate the jQuery Core CONTRIBUTING.md, applying Migrate-specific changes. Fixes jquerygh-486 Fixes jquerygh-492 Closes jquerygh-541 Ref jquery/jquery#5564
1 parent 9ebcb61 commit 8352569

File tree

1 file changed

+73
-99
lines changed

1 file changed

+73
-99
lines changed

CONTRIBUTING.md

+73-99
Original file line numberDiff line numberDiff line change
@@ -1,87 +1,72 @@
1-
# Contributing to jQuery
1+
# Contributing to jQuery Migrate
22

33
1. [Getting Involved](#getting-involved)
4-
2. [Discussion](#discussion)
4+
2. [Questions and Discussion](#questions-and-discussion)
55
3. [How To Report Bugs](#how-to-report-bugs)
6-
4. [Core Style Guide](#jquery-core-style-guide)
7-
5. [Tips For Bug Patching](#tips-for-jquery-bug-patching)
8-
6+
4. [Tips for Bug Patching](#tips-for-bug-patching)
97

108

119
## Getting Involved
1210

13-
There are a number of ways to get involved with the development of jQuery core. Even if you've never contributed code to an Open Source project before, we're always looking for help identifying bugs, writing and reducing test cases and documentation.
14-
15-
This is the best way to contribute to jQuery core. Please read through the full guide detailing [How to Report Bugs](#How-to-Report-Bugs).
11+
[API design principles](https://github.com/jquery/jquery/wiki/API-design-guidelines)
1612

17-
## Discussion
13+
We're always looking for help [identifying bugs](#how-to-report-bugs), writing and reducing test cases, and improving documentation. And although new features are rare, anything passing our [guidelines](https://github.com/jquery/jquery/wiki/Adding-new-features) will be considered.
1814

19-
### Forum and IRC
15+
More information on how to contribute to this and other jQuery organization projects is at [contribute.jquery.org](https://contribute.jquery.org), including a short guide with tips, tricks, and ideas on [getting started with open source](https://contribute.jquery.org/open-source/). Please review our [commit & pull request guide](https://contribute.jquery.org/commits-and-pull-requests/) and [style guides](https://contribute.jquery.org/style-guide/) for instructions on how to maintain a fork and submit patches.
2016

21-
The jQuery core development team frequently tracks posts on the [jQuery Development Forum](http://forum.jquery.com/developing-jquery-core). If you have longer posts or questions please feel free to post them there. If you think you've found a bug please [file it in the bug tracker](#How-to-Report-Bugs).
17+
When opening a pull request, you'll be asked to sign our Contributor License Agreement. Both the Corporate and Individual agreements can be [previewed on GitHub](https://github.com/openjs-foundation/easycla).
2218

23-
Additionally most of the jQuery core development team can be found in the [#jquery-dev](http://webchat.freenode.net/?channels=jquery-dev) IRC channel on irc.freenode.net.
19+
If you're looking for some good issues to start with, [here are some issues labeled "help wanted" or "patch welcome"](https://github.com/jquery/jquery-migrate/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22%2C%22Patch+Welcome%22).
2420

25-
### Weekly Status Meetings
21+
## Questions and Discussion
2622

27-
Every week (unless otherwise noted) the jQuery core dev team has a meeting to discuss the progress of current work and to bring forward possible new blocker bugs for discussion.
23+
### Looking for help?
2824

29-
The meeting is held in the [#jquery-meeting](http://webchat.freenode.net/?channels=jquery-meeting) IRC channel on irc.freenode.net at [Noon EST](http://www.timeanddate.com/worldclock/fixedtime.html?month=1&day=17&year=2011&hour=12&min=0&sec=0&p1=43) on Mondays.
25+
jQuery is so popular that many developers have knowledge of its capabilities and limitations. Most questions about using jQuery can be answered on popular forums such as [Stack Overflow](https://stackoverflow.com). Please start there when you have questions, even if you think you've found a bug.
3026

31-
[Past Meeting Notes](https://docs.google.com/document/d/1MrLFvoxW7GMlH9KK-bwypn77cC98jUnz7sMW1rg_TP4/edit?hl=en)
27+
The jQuery Core team watches [jQuery GitHub Discussions](https://github.com/jquery/jquery/discussions). If you have longer posts or questions that can't be answered in places such as Stack Overflow, please feel free to post them there. If you think you've found a bug, please [file it in the bug tracker](#how-to-report-bugs). The Core team can be found in the [#jquery/dev](https://matrix.to/#/#jquery_dev:gitter.im) Matrix channel on gitter.im.
3228

29+
### Weekly Status Meetings
3330

34-
## How to Report Bugs
31+
The jQuery Core team has a weekly meeting to discuss the progress of current work. The meeting is held in the [#jquery/meeting](hhttps://matrix.to/#/#jquery_meeting:gitter.im) Matrix channel on gitter.im at [Noon EST](https://www.timeanddate.com/worldclock/fixedtime.html?month=10&day=7&year=2024&hour=12&min=0&sec=0&p1=43) on Mondays.
3532

36-
### Make sure it is a jQuery bug
33+
[jQuery Core Meeting Notes](https://meetings.jquery.org/category/core/)
3734

38-
Many bugs reported to our bug tracker are actually bugs in user code, not in jQuery code. Keep in mind that just because your code throws an error and the console points to a line number inside of jQuery, this does *not* mean the bug is a jQuery bug; more often than not, these errors result from providing incorrect arguments when calling a jQuery function.
3935

40-
If you are new to jQuery, it is usually a much better idea to ask for help first in the [Using jQuery Forum](http://forum.jquery.com/using-jquery) or the [jQuery IRC channel](http://webchat.freenode.net/?channels=%23jquery). You will get much quicker support, and you will help avoid tying up the jQuery team with invalid bug reports. These same resources can also be useful if you want to confirm that your bug is indeed a bug in jQuery before filing any tickets.
36+
## How to Report Bugs
4137

38+
### Make sure it is a jQuery Migrate bug
4239

43-
### Disable any browser extensions
40+
Most bugs reported to our bug tracker are actually bugs in user code, not in jQuery Migrate code. Keep in mind that just because your code throws an error inside of jQuery Migrate, this does *not* mean the bug is a jQuery Migrate bug.
4441

45-
Make sure you have reproduced the bug with all browser extensions and add-ons disabled, as these can sometimes cause things to break in interesting and unpredictable ways. Try using incognito, stealth or anonymous browsing modes.
42+
Ask for help first on a discussion forum like [Stack Overflow](https://stackoverflow.com/). You will get much quicker support, and you will help avoid tying up the jQuery team with invalid bug reports.
4643

44+
### Disable browser extensions
4745

48-
### Try the latest version of jQuery
46+
Make sure you have reproduced the bug with all browser extensions and add-ons disabled, as these can sometimes cause things to break in interesting and unpredictable ways. Try using incognito, stealth or anonymous browsing modes.
4947

50-
Bugs in old versions of jQuery may have already been fixed. In order to avoid reporting known issues, make sure you are always testing against the [latest jQuery version](https://releases.jquery.com/jquery/).
48+
### Try the latest version of jQuery Migrate
5149

52-
### Try an older version of jQuery
50+
Bugs in old versions of jQuery Migrate may have already been fixed. In order to avoid reporting known issues, make sure you are always testing against the [latest build](https://releases.jquery.com/git/jquery-migrate-git.js). We cannot fix bugs in older released files, if a bug has been fixed in a subsequent version of jQuery Migrate the site should upgrade.
5351

54-
Sometimes, bugs are introduced in newer versions of jQuery that do not exist in previous versions. When possible, it can be useful to try testing with an older release.
52+
### Simplify the test case
5553

56-
### Reduce, reduce, reduce!
54+
When experiencing a problem, [reduce your code](https://webkit.org/test-case-reduction/) to the bare minimum required to reproduce the issue. This makes it *much* easier to isolate and fix the offending code. Bugs reported without reduced test cases take on average 9001% longer to fix than bugs that are submitted with them, so you really should try to do this if at all possible.
5755

58-
When you are experiencing a problem, the most useful thing you can possibly do is to [reduce your code](https://webkit.org/test-case-reduction/) to the bare minimum required to reproduce the issue. This makes it *much* easier to isolate and fix the offending code. Bugs that are reported without reduced test cases take on average 9001% longer to fix than bugs that are submitted with them, so you really should try to do this if at all possible.
56+
### Search for related or duplicate issues
5957

60-
## jQuery Core Style Guide
58+
Go to the [jQuery Migrate issue tracker](https://github.com/jquery/jquery-migrate/issues) and make sure the problem hasn't already been reported. If not, create a new issue there and include your test case.
6159

62-
See: [jQuery Core Style Guide](http://docs.jquery.com/JQuery_Core_Style_Guidelines)
6360

6461
## Tips For Bug Patching
6562

63+
We *love* when people contribute back to the project by patching the bugs they find. Since jQuery is used by so many people, we are cautious about the patches we accept and want to be sure they don't have a negative impact on the millions of people using jQuery each day. For that reason it can take a while for any suggested patch to work its way through the review and release process. The reward for you is knowing that the problem you fixed will improve things for millions of sites and billions of visits per day.
6664

67-
### Environment: localhost
68-
69-
To test the plugin you will need:
70-
71-
* Node.js
72-
* NPM (comes with the latest version of Node.js)
65+
### Build a Local Copy of jQuery Migrate
7366

74-
### Build a Local Copy of the plugin
67+
Create a fork of the jQuery Migrate repo on GitHub at https://github.com/jquery/jquery-migrate
7568

76-
Create a fork of the plugin repo on github at http://github.com/jquery/jquery-migrate
77-
78-
Change directory to your web root directory, whatever that might be:
79-
80-
```bash
81-
$ cd /path/to/your/www/root/
82-
```
83-
84-
Clone your plugin fork to work locally:
69+
Clone your jQuery fork to work locally:
8570

8671
```bash
8772
$ git clone git@github.com:username/jquery-migrate.git
@@ -93,111 +78,100 @@ Change directory to the newly created dir `jquery-migrate/`:
9378
$ cd jquery-migrate
9479
```
9580

96-
Add the jquery-migrate repository as a remote; I label mine "upstream":
81+
Add the jQuery Migrate `main` as a remote (e.g. `upstream`):
9782

9883
```bash
99-
$ git remote add upstream git://github.com/jquery/jquery-migrate.git
84+
$ git remote add upstream git@github.com:jquery/jquery-migrate.git
10085
```
10186

102-
Get in the habit of pulling in the "upstream" `main` branch to stay up to date as jQuery Migrate receives new commits:
87+
Get in the habit of pulling in the "upstream" main to stay up to date as jQuery Migrate receives new commits:
10388

10489
```bash
10590
$ git pull upstream main
10691
```
10792

108-
Run the build and rebuild when source files change:
93+
Install the necessary dependencies:
10994

11095
```bash
111-
$ npm start
96+
$ npm install
11297
```
11398

114-
In another terminal, run the test server:
99+
Build all jQuery Migrate files:
115100

116101
```bash
117-
$ npm run test:server
102+
$ npm run build
118103
```
119104

120-
Now open the jQuery test suite in a browser at http://localhost:3000/test/.
121-
122-
Success! You just built and tested jQuery!
123-
124-
125-
### Fix a bug from a ticket filed at bugs.jquery.com:
126-
127-
**NEVER write your patches to the `main` branch**
128-
129-
**ALWAYS USE A "TOPIC" BRANCH!** Like so (#### = the ticket #)...
130-
131-
Make sure you start with your up-to-date `main` branch:
105+
Start a test server:
132106

133107
```bash
134-
$ git checkout main
108+
$ npm run test:server
135109
```
136110

137-
Create and checkout a new branch that includes the ticket #
111+
Now open the jQuery test suite in a browser at http://localhost:3000/test/.
138112

139-
```bash
140-
$ git checkout -b bug_####
113+
Success! You just built and tested jQuery Migrate!
141114

142-
# ( Explanation: this useful command will:
143-
# "checkout" a "-b" (branch) by the name of "bug_####"
144-
# or create it if it doesn't exist )
145-
```
115+
### Test Suite Tips...
146116

147-
Now you're on branch: bug_####
117+
During the process of writing your patch, you will run the test suite MANY times. You can speed up the process by narrowing the running test suite down to the module you are testing by either double-clicking the title of the test or appending it to the url. The following examples assume you're working on a local repo, hosted on your localhost server.
148118

149-
Determine the module/file you'll be working in...
119+
Example:
150120

151-
Open up the corresponding /test/unit/?????.js and add the initial failing unit tests. This may seem awkward at first, but in the long run it will make sense. To truly and efficiently patch a bug, you need to be working against that bug.
121+
http://localhost:3000/test/?module=css
152122

153-
Next, open the module files and make your changes
123+
This will only run the "css" module tests. This will significantly speed up your development and debugging.
154124

155-
Run http://localhost/test --> **ALL TESTS MUST PASS**
125+
**ALWAYS RUN THE FULL SUITE BEFORE COMMITTING AND PUSHING A PATCH!**
156126

157-
Once you're satisfied with your patch...
127+
#### Change the test server port
158128

159-
Stage the files to be tracked:
129+
The default port for the test server is 3000. You can change the port by setting the `PORT` environment variable.
160130

161131
```bash
162-
$ git add filename
163-
# (you can use "git status" to list the files you've changed)
132+
$ PORT=3001 npm run test:server
164133
```
165134

135+
#### Loading changes on the test page
166136

167-
( I recommend NEVER, EVER using "git add . " )
168-
169-
Once you've staged all of your changed files, go ahead and commit them
137+
Rather than rebuilding jQuery Migrate with `npm run build` every time you make a change, you can use the included watch task to rebuild distribution files whenever a file is saved.
170138

171139
```bash
172-
$ git commit -m "Brief description of fix. Fixes #0000"
140+
$ npm start
173141
```
174142

175-
For a multiple line commit message, leave off the `-m "description"`.
143+
Alternatively, you can **load tests as ECMAScript modules** to avoid the need for rebuilding altogether.
144+
145+
Set the `jquery-migrate:` field to `esmodules` after loading the test page.
176146

177-
You will then be led into vi (or the text editor that you have set up) to complete your commit message.
147+
#### Running the test suite from the command line
178148

179-
Then, push your branch with the bug fix commits to your github fork
149+
You can also run the test suite from the command line.
150+
151+
First, prepare the tests:
180152

181153
```bash
182-
$ git push origin -u bug_####
154+
$ npm run pretest
183155
```
184156

185-
Before you tackle your next bug patch, return to the `main` branch:
157+
Make sure jQuery Migrate is built (`npm run build`) and run the tests:
186158

187159
```bash
188-
$ git checkout main
160+
$ npm run test:unit
189161
```
190162

163+
This will run each module in its own browser instance and report the results in the terminal.
191164

192-
### Test Suite Tips...
165+
View the full help for the test suite for more info on running the tests from the command line:
193166

194-
By default the plugin runs against the current (jquery-3.x-git WIP) version of jQuery. You can select a different version by specifying it in the URL. Files are always retrieved from code.jquery.com or releases.jquery.com (the latter for development versions).
195-
196-
Example:
167+
```bash
168+
$ npm run test:unit -- --help
169+
```
197170

198-
http://localhost/jquery-migrate/test/?jquery=1.7.2
171+
### Repo organization
199172

200-
This will run the plugin with version 1.7.2 of jQuery, taken from http://code.jquery.com/jquery-1.7.2.js.
173+
The jQuery Migrate source is organized with ECMAScript modules and then compiled into one file at build time.
201174

202-
**ALWAYS RUN THE FULL TEST SUITE BEFORE COMMITTING AND PUSHING A PATCH!**
175+
### Browser support
203176

177+
Remember that jQuery Migrate supports multiple browsers and their versions; any contributed code must work in all of them. You can refer to the ["Version compatibility" section in Migrate README](https://github.com/jquery/jquery-migrate/blob/main/README.md#version-compatibility) for the current list of supported browsers.

0 commit comments

Comments
 (0)