When creating a Pull Request for mediasoup, ensure that you run the following commands to verify that the code in your PR conforms to the code syntax of the project and does not break existing funtionality:
*`npm run lint`: Check JavaScript and C++ linting rules.
*`npm run typescript:build`: Compile TypeScript code (under `src/` folder) into JavaScript code (under `lib/` folder).
*`npm run test`: Run JavaScript and C++ test units.
The full list of `npm` scripts (and `make` tasks) is available in the [docs/Building.md](/docs/Building.md) file.
Once all these commands succeed, wait for the Travis CI checks to complete and verify they run successfully (otherwise the PR won't be accepted).
## Coding Style
In adition to automatic checks performed by commands above, we also enforce other minor things related to coding style:
### Comments in JavaScript and C++
We use `//` for inline comments in both JavaScript and C++ source files.
* Comments must start with upercase letter.
* Comments must not exceed 80 columns (split into different lines if necessary).
* Comments must end with a dot.
Example (good):
```js
// Calculate foo based on bar value.
constfoo=bar/2;
```
Example (bad):
```js
// calculate foo based on bar value
constfoo=bar/2;
```
When adding inline documentation for methods or functions, we use `/** */` syntax. Example:
@@ -10,12 +10,12 @@ The `package.json` file in the main folder includes the following scripts:
### `npm run typescript:build`
Compiles mediasoup TypeScript code (`lib` folder) into es2020 JavaScript and places it into the `lib` directory.
Compiles mediasoup TypeScript code (`lib` folder) JavaScript and places it into the `lib` directory.
### `npm run typescript:watch`
Compiles mediasoup TypeScript code (`lib` folder) into es2020 JavaScript, places it into the `lib` directory an watches for changes in the TypeScript files.
Compiles mediasoup TypeScript code (`lib` folder) JavaScript, places it into the `lib` directory an watches for changes in the TypeScript files.