Skip to content

Commit

Permalink
Merge branch 'main' into code-language/enforce
Browse files Browse the repository at this point in the history
  • Loading branch information
queengooborg authored Aug 2, 2023
2 parents 35b4a82 + 8d0cbea commit df544d6
Show file tree
Hide file tree
Showing 600 changed files with 2,716 additions and 1,706 deletions.
19 changes: 15 additions & 4 deletions .github/workflows/pr-check_redirects.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ on:
pull_request:
branches:
- main
paths:
- .nvmrc
- files/**
- .github/workflows/pr-check_redirects.yml

jobs:
check-redirects:
Expand All @@ -22,11 +18,26 @@ jobs:
node-version-file: ".nvmrc"
cache: yarn

# This is a "required" workflow so path filtering can not be used:
# https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/collaborating-on-repositories-with-code-quality-features/troubleshooting-required-status-checks#handling-skipped-but-required-checks
# We have to rely on a custom filtering mechanism to run the checks only if required files are modified.
- uses: dorny/paths-filter@v2
name: See if any file needs checking
id: filter
with:
filters: |
required_files :
- ".nvmrc"
- "files/**"
- ".github/workflows/pr-check_redirects_file.yml"
- name: Install all yarn packages
if: steps.filter.outputs.required_files == 'true'
run: yarn --frozen-lockfile
env:
# https://github.com/microsoft/vscode-ripgrep#github-api-limit-note
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Check redirects file(s)
if: steps.filter.outputs.required_files == 'true'
run: yarn content validate-redirects en-us --strict
21 changes: 16 additions & 5 deletions .github/workflows/pr-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ on:
pull_request:
branches:
- main
paths:
- .nvmrc
- ".github/workflows/pr-test.yml"
- "files/en-us/**"

jobs:
tests:
Expand All @@ -31,16 +27,31 @@ jobs:
node-version-file: ".nvmrc"
cache: yarn

# This is a "required" workflow so path filtering can not be used:
# https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/collaborating-on-repositories-with-code-quality-features/troubleshooting-required-status-checks#handling-skipped-but-required-checks
# We have to rely on a custom filtering mechanism to run the checks only if required files are modified.
- uses: dorny/paths-filter@v2
name: See if any file needs checking
id: filter
with:
filters: |
required_files :
- ".nvmrc"
- ".github/workflows/pr-test.yml"
- "files/en-us/**"
- name: Install all yarn packages
if: steps.filter.outputs.required_files == 'true'
run: yarn --frozen-lockfile
env:
# https://github.com/microsoft/vscode-ripgrep#github-api-limit-note
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Get changed files
if: steps.filter.outputs.required_files == 'true'
run: |
# Use the GitHub API to get the list of changed files
# documenation: https://docs.github.com/rest/commits/commits#compare-two-commits
# documentation: https://docs.github.com/rest/commits/commits#compare-two-commits
DIFF_DOCUMENTS=$(gh api repos/{owner}/{repo}/compare/${{ env.BASE_SHA }}...${{ env.HEAD_SHA }} \
--jq '.files | .[] | select(.status|IN("added", "modified", "renamed", "copied", "changed")) | .filename')
Expand Down
7 changes: 4 additions & 3 deletions .lintstagedrc.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"*": "prettier --ignore-unknown --write",
"!*.md": "prettier --ignore-unknown --write",
"*.md": [
"markdownlint-cli2-fix",
"node scripts/front-matter_linter.js --fix true"
"markdownlint-cli2 --fix",
"node scripts/front-matter_linter.js --fix true",
"prettier --write"
],
"tests/**/*.*": "yarn test:front-matter-linter",
"*.{svg,png,jpeg,jpg,gif}": "yarn filecheck"
Expand Down
53 changes: 33 additions & 20 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,22 +147,29 @@ To fork and clone the repository:
The previous sections describe how to get started using the GitHub UI to make small changes to a single file and how to create a fork and clone the repository to prepare for making larger changes.
This section describes how to build the project locally and how to prepare your changes for submission.

### Installing and running the project
### Preparing the project

To set up the site locally, you need to have [Node.js](https://nodejs.org/) and [Yarn](https://yarnpkg.com/) installed.
To serve the site locally, you need to have [Node.js](https://nodejs.org/) and [Yarn 1 (Classic)](https://classic.yarnpkg.com/) installed.
You can check if these are installed by running the following commands:

```bash
node -v
yarn -v
```

After you have installed Node.js and Yarn, you can install the dependencies using `yarn` and start the local preview:
After you have installed Node.js and Yarn, you can install the dependencies using `yarn`:

```bash
# Assuming your fork is in ~/repos/content
cd ~/repos/content
yarn
```

### Running the project

After you have installed all dependencies, you can start the local preview using `yarn start`:

```bash
yarn start
```

Expand All @@ -184,9 +191,7 @@ To edit files and track your changes, you should use feature branches.
Feature branches are created from the `main` branch and should be named after the feature you're working on.
This will make it easier to submit a pull request for your changes.
> **Note**
> Open a discussion if your changes will contain large, complex or structural changes.
> Ask for feedback before embarking on large tasks.
> **Note:** Open a discussion if your changes will contain large, complex or structural changes. Ask for feedback before embarking on large tasks.
1. When the server is running, make the changes you would like to make to one or more `index.md` files.
Expand All @@ -196,13 +201,13 @@ This will make it easier to submit a pull request for your changes.
3. Check for errors by clicking `Show flaws` on each previewed page.
You may be able to fix flaws by running:

```sh
```bash
yarn content flaws <page_slug>
```

4. Commit your changes to the branch (our example is using the `fix-typo` branch) and push the changes to your fork's remote:
```sh
```bash
# Adding all files to the commit
git add .
# Making a commit with a message describing the changes
Expand All @@ -212,6 +217,14 @@ This will make it easier to submit a pull request for your changes.
# or "git push --set-upstream origin fix-typo" if you haven't pushed this branch before
```
#### Linting edited files
To ensure that all MDN documents follow the same formatting, we use both [Prettier](https://www.prettier.io) and [Markdownlint](https://github.com/DavidAnson/markdownlint) to format and lint Markdown files. This helps us enforce uniform styling across all documents with minimal reviewer intervention.
If you have a [local checkout](#forking-and-cloning-the-repository) of the repository and have [installed the dependencies](#preparing-the-project), or you are using [github.dev](https://github.dev), a pre-commit hook will be installed which automatically runs while making a commit. To save some headache and improve your work flow while authoring, you may wish to [configure your editor to automatically run Prettier](https://prettier.io/docs/en/editors.html). Alternatively, you may run `yarn fix:md` in the command line to manually format all Markdown files.
> **Note:** Automatically formatting changes does not work for pull requests opened using the GitHub Web UI as described in the ["Simple changes" section](#simple-changes). This may result in failed status checks on pull requests. If you're not sure about how to fix this, [get in touch with us](/en-US/docs/MDN/Community/Communication_channels) for help.
### Adding a new document
Adding a new document is relatively straightforward, especially if you can start by copying the `index.md` of a similar document.
Expand All @@ -228,7 +241,7 @@ There are a few things to keep in mind:
Moving one or more documents (or an entire tree of documents) is made easier with the `yarn content move` command.
This command moves the file and fixes up redirects automatically. You can use this command as shown below:
```sh
```bash
yarn content move <from-slug> <to-slug> [locale]
```
Expand All @@ -244,7 +257,7 @@ Let's say you want to move the entire `/en-US/Learn/Accessibility` tree to `/en-
1. Starting from a fresh branch:
```sh
```bash
cd ~/repos/content
# Fetch the latest changes from the main branch on mdn/content
git fetch upstream
Expand All @@ -257,13 +270,13 @@ Let's say you want to move the entire `/en-US/Learn/Accessibility` tree to `/en-
2. Move files with `yarn content move`.
This will delete and modify existing files, as well as create new files.
```sh
```bash
yarn content move Learn/Accessibility Learn/A11y
```
3. Commit all of the changes and push your branch to the remote:
```sh
```bash
git add .
git commit -m "Move Learn/Accessibility to Learn/A11y"
git push
Expand All @@ -279,14 +292,14 @@ Similar to moving files, you can delete documents or a tree of documents easily
You can use this command as shown below:
```sh
```bash
yarn content delete <document-slug> [locale] --redirect <redirect-slug-or-url>
```
To use `yarn content delete`, provide the slug of the document you'd like to delete (e.g., `Learn/Accessibility`), and the locale as an optional second argument (this defaults to `en-US`).
If the slug of the page you wish to delete contains special characters, include it in quotes. For example:
```sh
```bash
yarn content delete "Glossary/Round_Trip_Time_(RTT)" --redirect Glossary/Latency
```
Expand All @@ -295,7 +308,7 @@ Say you want to delete the entire `/en-US/Learn/Accessibility` tree and redirect
1. Start from a fresh branch.
```sh
```bash
cd ~/repos/content
# Fetch the latest changes from the main branch on mdn/content
git fetch upstream
Expand All @@ -307,7 +320,7 @@ Say you want to delete the entire `/en-US/Learn/Accessibility` tree and redirect
2. Run the `yarn content delete` command and redirect all deleted documents.
```sh
```bash
yarn content delete Learn/Accessibility --recursive --redirect Web/Accessibility
```
Expand All @@ -317,7 +330,7 @@ Say you want to delete the entire `/en-US/Learn/Accessibility` tree and redirect
3. Commit all of the changes and push your branch to the remote.
```sh
```bash
git add .
git commit -m "Delete Learn/Accessibility pages"
git push
Expand All @@ -333,7 +346,7 @@ You may do this by using the `yarn content add-redirect` command.
1. Start a fresh branch to work in:
```sh
```bash
cd ~/repos/content
# Fetch the latest changes from the main branch on mdn/content
git fetch upstream
Expand All @@ -345,13 +358,13 @@ You may do this by using the `yarn content add-redirect` command.
2. Add a redirect with `yarn content add-redirect`. The target page can be a page on MDN or an external URL:
```sh
```bash
yarn content add-redirect /en-US/path/of/deleted/page /en-US/path/of/target/page
```
3. Commit all of the changed files and pushing your branch to your fork:
```sh
```bash
git add .
git commit -m "Adding redirect after deleting Learn/Accessibility pages"
git push
Expand Down
10 changes: 5 additions & 5 deletions LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ All prose content is available under

### Text of CC-BY-SA-2.5 license

```
```plain
Creative Commons Attribution-ShareAlike 2.5
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE LEGAL SERVICES. DISTRIBUTION OF THIS LICENSE DOES NOT CREATE AN ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES REGARDING THE INFORMATION PROVIDED, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM ITS USE.
Expand Down Expand Up @@ -75,13 +75,13 @@ Code examples and snippets added on or after August 20, 2010 are in the public d
([CC0](https://creativecommons.org/publicdomain/zero/1.0/legalcode)). No licensing notice
is necessary, but if you need one, you can use:

```
```plain
Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/
```

#### Text of CC0 license

```
```plain
Creative Commons Legal Code
CC0 1.0 Universal
Expand Down Expand Up @@ -211,13 +211,13 @@ Code examples and snippets added before August 20, 2010 are available under
the [MIT license](https://opensource.org/licenses/MIT). You should insert
the following attribution information into the MIT license template:

```
```plain
© <date of last page revision> <name of person who created it>
```

#### Text of MIT license template

```
```plain
Copyright <YEAR> <COPYRIGHT HOLDER>
Permission is hereby granted, free of charge, to any person obtaining a copy of this
Expand Down
7 changes: 4 additions & 3 deletions files/en-us/_redirects.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3458,7 +3458,7 @@
/en-US/docs/Event.initEvent /en-US/docs/Web/API/Event/initEvent
/en-US/docs/Extension_Library/Extensions /en-US/docs/Mozilla/Add-ons
/en-US/docs/Extension_Library/Extensions/Firefox /en-US/docs/Mozilla/Add-ons
/en-US/docs/File_System_Access_API /en-US/docs/Web/API/File_System_Access_API
/en-US/docs/File_System_Access_API /en-US/docs/Web/API/File_System_API
/en-US/docs/Firefox 11 for developers /en-US/docs/Mozilla/Firefox/Releases/11
/en-US/docs/Firefox_1.5 /en-US/docs/Mozilla/Firefox/Releases/1.5
/en-US/docs/Firefox_1.5_Beta_for_Developers /en-US/docs/Mozilla/Firefox/Releases/1.5
Expand Down Expand Up @@ -8198,8 +8198,9 @@
/en-US/docs/Web/API/FileSystemFlags/create /en-US/docs/Web/API/FileSystemDirectoryEntry/getFile
/en-US/docs/Web/API/FileSystemFlags/exclusive /en-US/docs/Web/API/FileSystemDirectoryEntry/getFile
/en-US/docs/Web/API/File_Handle_API /en-US/docs/Web/API/File_and_Directory_Entries_API
/en-US/docs/Web/API/File_System_API /en-US/docs/Web/API/File_and_Directory_Entries_API
/en-US/docs/Web/API/File_System_API/Introduction /en-US/docs/Web/API/File_and_Directory_Entries_API/Introduction
/en-US/docs/Web/API/File_System_Access_API /en-US/docs/Web/API/File_System_API
/en-US/docs/Web/API/File_System_Access_API/Origin_private_file_system /en-US/docs/Web/API/File_System_API/Origin_private_file_system
/en-US/docs/Web/API/Float32Array /en-US/docs/Web/JavaScript/Reference/Global_Objects/Float32Array
/en-US/docs/Web/API/Float64Array /en-US/docs/Web/JavaScript/Reference/Global_Objects/Float64Array
/en-US/docs/Web/API/FocusEvent.FocusEvent /en-US/docs/Web/API/FocusEvent/FocusEvent
Expand Down Expand Up @@ -9616,7 +9617,7 @@
/en-US/docs/Web/API/Screen.unlockOrientation /en-US/docs/Web/API/Screen/unlockOrientation
/en-US/docs/Web/API/Screen.width /en-US/docs/Web/API/Screen/width
/en-US/docs/Web/API/Screen/onorientationchange /en-US/docs/Web/API/Screen/orientationchange_event
/en-US/docs/Web/API/ScreenOrientation/onchange /en-US/docs/Web/API/ScreenOrientation
/en-US/docs/Web/API/ScreenOrientation/onchange /en-US/docs/Web/API/ScreenOrientation/change_event
/en-US/docs/Web/API/ScriptProcessorNode.bufferSize /en-US/docs/Web/API/ScriptProcessorNode/bufferSize
/en-US/docs/Web/API/ScriptProcessorNode.onaudioprocess /en-US/docs/Web/API/ScriptProcessorNode/audioprocess_event
/en-US/docs/Web/API/ScriptProcessorNode/audioprocess /en-US/docs/Web/API/ScriptProcessorNode/audioprocess_event
Expand Down
2 changes: 1 addition & 1 deletion files/en-us/_wikihistory.json
Original file line number Diff line number Diff line change
Expand Up @@ -36002,7 +36002,7 @@
"sicking"
]
},
"Web/API/File_System_Access_API": {
"Web/API/File_System_API": {
"modified": "2020-12-12T15:46:27.214Z",
"contributors": ["Rumyra"]
},
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ There are two main differences between rendering scrolling maps vs. static maps:

- **Partial tiles might be shown**. In static maps, usually the rendering starts in the top left corner of a tile situated in the top left corner of a viewport. While rendering scrolling tilemaps, the first tile will often be clipped.

TODO: show a diagram here explaining this.

- **Only a section of the map will be rendered**. If the map is bigger than the viewport, we can obviously only display a part of it at a time, whereas non-scrolling maps are usually rendered wholly.

To handle these issues, we need to slightly modify the rendering algorithm. Let's imagine that we have the camera pointing at `(5,10)`. That means that the first tile would be `0x0`. In the demo code, the starting point is stored at `startCol` and `startRow`. It's convenient to also pre-calculate the last tile to be rendered.
Expand Down
Binary file modified files/en-us/games/tutorials/touch_event_horizon/touch-to-start.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion files/en-us/glossary/base64/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ page-type: glossary-definition

When the term "Base64" is used on its own to refer to a specific algorithm, it typically refers to the version of Base64 outlined in [RFC 4648](https://datatracker.ietf.org/doc/html/rfc4648), section 4, which uses the following alphabet to represent the radix-64 digits, alongside `=` as a padding character:

```
```plain
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/
```

Expand Down
2 changes: 1 addition & 1 deletion files/en-us/glossary/dns/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ page-type: glossary-definition

**DNS** (Domain Name System) is a hierarchical and decentralized naming system for Internet connected resources. DNS maintains a list of {{Glossary("domain name","domain names")}} along with the resources, such as IP addresses, that are associated with them.

The most prominent function of DNS is the translation of human-friendly domain names (such as mozilla.org) to a numeric {{Glossary("IP address")}} (such as 151.106.5.172); this process of mapping a domain name to the appropriate IP address is known as a **DNS lookup**. By contrast, a **reverse DNS lookup** (rDNS) is used to determine the domain name associated with an IP address.
The most prominent function of DNS is the translation of human-friendly domain names (such as mozilla.org) to a numeric {{Glossary("IP address")}} (such as 192.0.2.172); this process of mapping a domain name to the appropriate IP address is known as a **DNS lookup**. By contrast, a **reverse DNS lookup** (rDNS) is used to determine the domain name associated with an IP address.

## See also

Expand Down
4 changes: 2 additions & 2 deletions files/en-us/glossary/etld/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ For example, all the following are eTLD+1 domains:

This means that all domains under each of these domains belong to the same organization. For example:

```
```plain
film.theguardian.com
music.theguardian.com
```

```
```plain
news.sussex.ac.uk
blog.sussex.ac.uk
admissions.sussex.ac.uk
Expand Down
Loading

0 comments on commit df544d6

Please sign in to comment.