Skip to content

Commit 97b0e84

Browse files
committed
Merge branch 'master' into translation/web-html-constraint_validation
2 parents 3d8634a + 5b95d40 commit 97b0e84

File tree

164 files changed

+5624
-3902
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

164 files changed

+5624
-3902
lines changed

.eslintrc.cjs

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ module.exports = {
99
"plugin:promise/recommended",
1010
"plugin:array-func/all",
1111
"plugin:node/recommended",
12-
"plugin:security/recommended",
1312
"plugin:unicorn/all",
1413
"plugin:prettier/recommended",
1514
"plugin:jest/all",
@@ -46,6 +45,7 @@ module.exports = {
4645
"no-magic-numbers": "off",
4746
"node/no-extraneous-import": "off",
4847
"jest/require-hook": "error",
48+
"node/no-unpublished-import": "off",
4949
},
5050
},
5151
{
@@ -64,9 +64,15 @@ module.exports = {
6464
"import/extensions": ["error", "ignorePackages"],
6565
},
6666
},
67+
{
68+
files: ["**/front-matter-*.test.js"],
69+
rules: {
70+
"import/extensions": ["error", "never"],
71+
},
72+
},
6773
],
6874
parserOptions: {
69-
ecmaVersion: 2021,
75+
ecmaVersion: 2024,
7076
},
7177
plugins: [
7278
"prettier",
@@ -77,7 +83,6 @@ module.exports = {
7783
"jest",
7884
"simple-import-sort",
7985
"editorconfig",
80-
"security",
8186
],
8287
root: true,
8388
rules: {
@@ -88,15 +93,7 @@ module.exports = {
8893
// 'import/prefer-await-to-then': 'off',
8994
// 'no-underscore-dangle': 'off',
9095
"unicorn/no-null": "off",
91-
"import/extensions": [
92-
"error",
93-
"ignorePackages",
94-
{
95-
js: "never",
96-
ts: "never",
97-
tsx: "never",
98-
},
99-
],
96+
"import/extensions": ["error", "ignorePackages"],
10097
"no-void": ["error", { allowAsStatement: true }],
10198
"no-magic-numbers": [
10299
"error",
@@ -117,15 +114,19 @@ module.exports = {
117114
groups: [
118115
// Node.js builtins.
119116
// eslint-disable-next-line global-require
120-
[`^(${require("module").builtinModules.join("|")})(/|$)`],
117+
[`^(?:node:)?(${require("module").builtinModules.join("|")})(/|$)`],
121118
// Packages.
122-
["^@?(\\w|.)[^./]"],
119+
[String.raw`^@?(\w|.)[^./]`],
123120
// Side effect imports.
124-
["^\\u0000"],
121+
[String.raw`^\u0000`],
125122
// Parent imports. Put `..` last.
126-
["^\\.\\.(?!/?$)", "^\\.\\./?$"],
123+
[String.raw`^\.\.(?!/?$)`, String.raw`^\.\./?$`],
127124
// Other relative imports. Put same-folder imports and `.` last.
128-
["^\\./(?=.*/)(?!/?$)", "^\\.(?!/?$)", "^\\./?$"],
125+
[
126+
String.raw`^\./(?=.*/)(?!/?$)`,
127+
String.raw`^\.(?!/?$)`,
128+
String.raw`^\./?$`,
129+
],
129130
],
130131
},
131132
],

.github/workflows/size-label.yml

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: size-label
2-
on: pull_request
2+
on: pull_request_target
33
jobs:
44
size-label:
55
permissions:
@@ -11,3 +11,33 @@ jobs:
1111
uses: "webdoky/size-label-action@main"
1212
env:
1313
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
14+
# assign-reviewers:
15+
# needs: [size-label]
16+
# runs-on: ubuntu-latest
17+
# steps:
18+
# - name: Checkout code
19+
# uses: actions/checkout@v4
20+
21+
# - name: Assign/Remove reviewers based on size label
22+
# run: |
23+
# PR_NUMBER=${{ github.event.pull_request.number }}
24+
# LABELS=$(gh pr view $PR_NUMBER --json labels --jq '.labels[].name')
25+
# REVIEWER="${{ github.repository_owner }}/translators"
26+
27+
# if [[ $LABELS == *"size/XS"* ]] || [[ $LABELS != *"size/"* ]]; then
28+
# gh api \
29+
# --method DELETE \
30+
# -H "Accept: application/vnd.github+json" \
31+
# -H "X-GitHub-Api-Version: 2022-11-28" \
32+
# /repos/${{ github.repository }}/pulls/$PR_NUMBER/requested_reviewers \
33+
# -f "team_reviewers[]=$REVIEWER"
34+
# else
35+
# gh api \
36+
# --method POST \
37+
# -H "Accept: application/vnd.github+json" \
38+
# -H "X-GitHub-Api-Version: 2022-11-28" \
39+
# /repos/${{ github.repository }}/pulls/$PR_NUMBER/requested_reviewers \
40+
# -f "team_reviewers[]=$REVIEWER"
41+
# fi
42+
# env:
43+
# GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}"

.github/workflows/translation.yml

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: spellcheck
2-
on: [pull_request]
2+
on: [pull_request_target]
33
jobs:
44
prepare:
55
outputs:
@@ -10,8 +10,10 @@ jobs:
1010
- uses: actions/checkout@v4
1111
with:
1212
fetch-depth: 0
13+
ref: ${{ github.head_ref }}
14+
repository: ${{ github.event.pull_request.head.repo.full_name }}
1315
- id: changed-files
14-
run: git diff --diff-filter=d --name-only ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} > ./changed_files.txt
16+
run: git diff --diff-filter=d --name-only origin/${{ github.base_ref }}...${{ github.event.pull_request.head.sha }} > ./changed_files.txt
1517
- name: Check translation
1618
# Check there is only one translation change
1719
# If there are more than one, the workflow will fail
@@ -55,6 +57,9 @@ jobs:
5557
runs-on: ubuntu-latest
5658
steps:
5759
- uses: actions/checkout@v4
60+
with:
61+
ref: ${{ github.head_ref }}
62+
repository: ${{ github.event.pull_request.head.repo.full_name }}
5863
- name: Remove code blocks
5964
run: |
6065
file=${{ needs.prepare.outputs.translation }}
@@ -130,13 +135,16 @@ jobs:
130135
runs-on: ubuntu-latest
131136
steps:
132137
- uses: actions/checkout@v4
138+
with:
139+
ref: ${{ github.head_ref }}
140+
repository: ${{ github.event.pull_request.head.repo.full_name }}
133141
- uses: actions/download-artifact@v3
134142
with:
135143
name: result
136144
path: .
137145
- uses: actions/setup-node@v4
138146
with:
139-
node-version: "16"
147+
node-version: "20"
140148
- uses: actions/download-artifact@v3
141149
with:
142150
name: text
@@ -156,9 +164,15 @@ jobs:
156164
if: ${{ needs.prepare.outputs.translation != '' }}
157165
name: Set title
158166
needs: [prepare]
167+
permissions:
168+
contents: read
169+
pull-requests: write
159170
runs-on: ubuntu-latest
160171
steps:
161172
- uses: actions/checkout@v4
173+
with:
174+
ref: ${{ github.head_ref }}
175+
repository: ${{ github.event.pull_request.head.repo.full_name }}
162176
- id: determine
163177
run: |
164178
translation=${{ needs.prepare.outputs.translation }}
@@ -185,20 +199,28 @@ jobs:
185199
- env:
186200
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
187201
run: |
188-
gh pr edit ${{ github.event.pull_request.number }} --title "${{ needs.prepare.outputs.status }}(${{ steps.determine.outputs.section }}): ${{ steps.determine.outputs.slug }}"
202+
gh pr edit ${{ github.event.pull_request.number }} --repo webdoky/content --title "${{ needs.prepare.outputs.status }}(${{ steps.determine.outputs.section }}): ${{ steps.determine.outputs.slug }}"
189203
set-translation-body:
190204
if: ${{ needs.prepare.outputs.translation != '' && needs.prepare.outputs.status == 'translation' }}
191205
name: Set translation body
192206
needs: [prepare]
207+
permissions:
208+
contents: read
209+
pull-requests: write
193210
runs-on: ubuntu-latest
194211
steps:
195212
- uses: actions/checkout@v4
213+
with:
214+
ref: ${{ github.head_ref }}
215+
repository: ${{ github.event.pull_request.head.repo.full_name }}
196216
# set the last section of slug as name
197217
- id: create-body
198218
run: |
199219
translation=${{ needs.prepare.outputs.translation }}
220+
echo $translation
200221
# get "slug" frontmatter value
201222
slug=$(cat $translation | grep -E "^slug: " | sed 's/slug: //')
223+
echo $slug
202224
# get "title" frontmatter value
203225
title=$(cat $translation | grep -E "^title: " | sed 's/title: //')
204226
# escape HTML entities from title
@@ -212,11 +234,14 @@ jobs:
212234
- env:
213235
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
214236
run: |
215-
gh pr edit ${{ github.event.pull_request.number }} --body "$(cat ./body.md)"
237+
gh pr edit ${{ github.event.pull_request.number }} --body "$(cat ./body.md)" --repo webdoky/content
216238
set-update-body:
217239
if: ${{ needs.prepare.outputs.translation != '' && needs.prepare.outputs.status == 'update' }}
218240
name: Set update body
219241
needs: [prepare]
242+
permissions:
243+
contents: read
244+
pull-requests: write
220245
runs-on: ubuntu-latest
221246
steps:
222247
- uses: actions/checkout@v4
@@ -275,4 +300,4 @@ jobs:
275300
- env:
276301
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
277302
run: |
278-
gh pr edit ${{ github.event.pull_request.number }} --body "$(cat ./body.md)"
303+
gh pr edit ${{ github.event.pull_request.number }} --body "$(cat ./body.md)" --repo webdoky/content

.husky/pre-commit

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
1-
#!/usr/bin/env sh
2-
. "$(dirname -- "$0")/_/husky.sh"
3-
4-
npx lint-staged
1+
# Ignore merge commits, for others run lint-staged
2+
git rev-parse -q --no-revs --verify MERGE_HEAD || npx lint-staged

.lintstagedrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"*.js": ["eslint --quiet --fix"],
3-
"*.md": [
3+
"files/**/*.md": [
44
"node scripts/markdownlint.js",
55
"node scripts/front-matter-linter.js --fix true",
66
"prettier --write --ignore-unknown"

.markdownlint.jsonc

Lines changed: 45 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
1-
// This file defines our configuration for Markdownlint. See
2-
// https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md
3-
// for more details on each rule.
4-
51
{
62
"default": true,
7-
// Disabled, as some callouts include headings.
83
"heading-increment": false,
94
"ul-style": {
105
"style": "dash"
@@ -17,17 +12,15 @@
1712
},
1813
"line-length": false,
1914
"no-duplicate-heading": {
20-
"allow_different_nesting": true
15+
"siblings_only": true
2116
},
2217
"single-title": {
2318
"front_matter_title": "^\\s*title\\s*[:=]"
2419
},
2520
"no-trailing-punctuation": {
2621
"punctuation": ".,;:"
2722
},
28-
// Consecutive Notes/Callouts currently don't conform with this rule
2923
"no-blanks-blockquote": false,
30-
// Force ordered numbering to catch accidental list ending from indenting
3124
"ol-prefix": {
3225
"style": "ordered"
3326
},
@@ -103,10 +96,8 @@
10396
]
10497
},
10598
"no-bare-urls": false,
106-
// Produces too many false positives
10799
"no-space-in-emphasis": false,
108100
"fenced-code-language": true,
109-
// See https://github.com/mdn/content/pull/20026, as macros currently break this
110101
"no-empty-links": false,
111102
"code-block-style": {
112103
"style": "fenced"
@@ -117,10 +108,8 @@
117108
"strong-style": {
118109
"style": "asterisk"
119110
},
120-
// Disabled, as yari generates link fragments by replacing spaces with underscores, not dashes.
121111
"link-fragments": false,
122112

123-
// https://github.com/OnkarRuikar/markdownlint-rule-search-replace
124113
"search-replace": {
125114
"rules": [
126115
{
@@ -250,7 +239,7 @@
250239
},
251240
{
252241
"name": "un-closed-md-link",
253-
"message": "Missng closing bracket ')'",
242+
"message": "Missing closing bracket ')'",
254243
"searchPattern": "/(\\[[^\\]]*?\\]\\(([^\\)\\n]|\\([^\\)\\n]\\)|\\s[\"'])+?)(\\n|\\s|[,:][\\s\\n])/gm",
255244
"searchScope": "text"
256245
},
@@ -259,6 +248,49 @@
259248
"name": "backticks-wrapped-macro",
260249
"replace": "$1",
261250
"searchPattern": "/`({{[^{}]+?}})`/gm"
251+
},
252+
{
253+
"message": "Use notecard note marker",
254+
"name": "notecard-note",
255+
"replace": "$1> [!NOTE]\n$1> ",
256+
"searchPattern": "/( *)> \\*\\*Примітка:\\*\\* /gm"
257+
},
258+
{
259+
"message": "Use notecard warning marker",
260+
"name": "notecard-warning",
261+
"replace": "$1> [!WARNING]\n$1> ",
262+
"searchPattern": "/( *)> \\*\\*Застереження:\\*\\* /gm"
263+
},
264+
{
265+
"message": "Remove English markers",
266+
"name": "no-english-marker",
267+
"replace": "$1",
268+
"searchPattern": "/ \\(англ\\.\\)(]|>)/g"
269+
},
270+
{
271+
"message": "Use notecard callout marker",
272+
"name": "notecard-callout",
273+
"replace": "$1> [!CALLOUT]",
274+
"searchPattern": "/( *)> \\*\\*Callout:\\*\\*/gm"
275+
},
276+
{
277+
"message": "Use notecard note marker",
278+
"name": "notecard-note-2",
279+
"replace": "$1> [!NOTE]\n$1> ",
280+
"searchPattern": "/( *)> \\*\\*Зауваження:\\*\\* /gm"
281+
},
282+
{
283+
"message": "Use Ukrainian Learn Microsoft",
284+
"name": "learn-microsoft",
285+
"replace": "https://learn.microsoft.com/uk-ua/",
286+
"search": "https://learn.microsoft.com/en-us/"
287+
},
288+
{
289+
"message": "Use em dash between different words, not hyphen",
290+
"name": "emdash-not-hyphen",
291+
"replace": "$1 – ",
292+
"searchPattern": "/([^ ]) - /gm",
293+
"searchScope": "text"
262294
}
263295
]
264296
}

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
16
1+
20

.prettierignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# This .prettierignore file uses .gitignore syntax
2+
# see https://prettier.io/docs/en/ignore.html#ignoring-files-prettierignore
3+
4+
build/
5+
/files/uk/_githistory.json
6+
/tests/front-matter_test_files
7+
.markdownlint*
8+
9+
# XXX Ignored until https://github.com/prettier/prettier/issues/15032 is fixed
10+
/files/uk/web/javascript/reference/operators/exponentiation/index.md
11+
/files/uk/web/javascript/reference/operators/exponentiation_assignment/index.md

0 commit comments

Comments
 (0)