Skip to content

Commit b4a5968

Browse files
committed
feat!: use mdx v2 comment syntax
1 parent c341e27 commit b4a5968

File tree

9 files changed

+230
-32
lines changed

9 files changed

+230
-32
lines changed

.eslintrc

+11-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
11
{
22
"root": true,
3-
"extends": "@1stg"
3+
"extends": "@1stg",
4+
"overrides": [
5+
{
6+
"files": [
7+
"syntaxes/*.json"
8+
],
9+
"rules": {
10+
"unicorn/filename-case": "off"
11+
}
12+
}
13+
]
414
}

.github/FUNDING.yml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
github:
2+
- JounQin
3+
- 1stG
4+
- rxts
5+
- unts
6+
patreon: 1stG
7+
open_collective: unified
8+
custom:
9+
- https://opencollective.com/1stG
10+
- https://opencollective.com/rxts
11+
- https://opencollective.com/unts
12+
- https://afdian.net/@JounQin

.github/workflows/ci.yml

+13-18
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,28 @@
11
name: CI
22

3-
on: [push, pull_request]
3+
on:
4+
- push
5+
- pull_request
46

57
jobs:
6-
default:
8+
ci:
79
name: Lint on ${{ matrix.os }} with Node.js ${{ matrix.node }}
810
strategy:
911
matrix:
10-
os: [ubuntu-latest]
11-
node: [12, 14, 16]
12+
os:
13+
- ubuntu-latest
14+
node:
15+
- 14
16+
- 16
17+
- 18
1218
runs-on: ${{ matrix.os }}
1319
steps:
14-
- uses: actions/checkout@v2
20+
- uses: actions/checkout@v3
1521

16-
- uses: actions/setup-node@v2
22+
- uses: actions/setup-node@v3
1723
with:
1824
node-version: ${{ matrix.node }}
19-
20-
- name: Get yarn cache directory path
21-
id: yarn-cache-dir-path
22-
run: echo "::set-output name=dir::$(yarn cache dir)"
23-
24-
- uses: actions/cache@v2
25-
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
26-
with:
27-
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
28-
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
29-
restore-keys: |
30-
${{ runner.os }}-yarn-
25+
cache: yarn
3126

3227
- name: Install Dependencies
3328
run: yarn --frozen-lockfile

.github/workflows/pkg-size.yml

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Package Size Report
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- master
7+
8+
jobs:
9+
pkg-size-report:
10+
name: Package Size Report
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v3
16+
17+
- name: Setup Node.js
18+
uses: actions/setup-node@v3
19+
with:
20+
node-version: 16
21+
cache: yarn
22+
23+
- name: Package Size Report
24+
uses: pkg-size/action@v1
25+
env:
26+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

language-configuration.json renamed to language-configuration.jsonc

+10-6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
{
22
"comments": {
3-
"blockComment": ["<!--", "-->"]
3+
"blockComment": ["{/*", "*/}"]
44
},
55
// symbols used as brackets
6-
"brackets": [["{", "}"], ["[", "]"], ["(", ")"]],
6+
"brackets": [
7+
["{", "}"],
8+
["[", "]"],
9+
["(", ")"]
10+
],
711
// symbols that are auto closed when typing
812
"autoClosingPairs": [
913
["{", "}"],
@@ -31,8 +35,8 @@
3135
"notIn": ["string"]
3236
},
3337
{
34-
"open": "<!--",
35-
"close": "-->",
38+
"open": "{/*",
39+
"close": "*/}",
3640
"notIn": ["string", "comment"]
3741
}
3842
],
@@ -51,8 +55,8 @@
5155
"folding": {
5256
"offSide": true,
5357
"markers": {
54-
"start": "^\\s*<!--\\s*#?region\\b.*-->",
55-
"end": "^\\s*<!--\\s*#?endregion\\b.*-->"
58+
"start": "^\\s*{/*\\s*#?region\\b.**/}",
59+
"end": "^\\s*{/*\\s*#?endregion\\b.**/}"
5660
}
5761
}
5862
}

package.json

+38-2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,41 @@
99
"repository": "https://github.com/mdx-js/vscode-mdx.git",
1010
"author": "JounQin",
1111
"publisher": "JounQin",
12+
"donate": {
13+
"recipients": [
14+
{
15+
"name": "unts",
16+
"platform": "opencollective",
17+
"address": "https://opencollective.com/unts",
18+
"weight": 60
19+
},
20+
{
21+
"name": "rxts",
22+
"platform": "opencollective",
23+
"address": "https://opencollective.com/rxts",
24+
"weight": 20
25+
},
26+
{
27+
"name": "1stG",
28+
"email": "[email protected]",
29+
"weight": 20,
30+
"platforms": [
31+
{
32+
"platform": "opencollective",
33+
"address": "https://opencollective.com/1stG"
34+
},
35+
{
36+
"platform": "patreon",
37+
"address": "https://www.patreon.com/1stG"
38+
}
39+
]
40+
}
41+
]
42+
},
43+
"funding": {
44+
"type": "opencollective",
45+
"url": "https://opencollective.com/unified"
46+
},
1247
"license": "MIT",
1348
"private": true,
1449
"engines": {
@@ -21,11 +56,12 @@
2156
],
2257
"scripts": {
2358
"lint": "eslint . --cache -f friendly",
24-
"prepare": "simple-git-hooks && yarn-deduplicate --strategy fewer || exit 0",
59+
"prepare": "patch-package && simple-git-hooks && yarn-deduplicate --strategy fewer || exit 0",
2560
"release": "sh release.sh"
2661
},
2762
"devDependencies": {
2863
"@1stg/common-config": "^5.2.6",
64+
"patch-package": "^6.4.7",
2965
"standard-version": "^9.5.0",
3066
"typescript": "^4.7.4",
3167
"yarn-deduplicate": "^5.0.0"
@@ -45,7 +81,7 @@
4581
"extensions": [
4682
".mdx"
4783
],
48-
"configuration": "./language-configuration.json"
84+
"configuration": "./language-configuration.jsonc"
4985
}
5086
],
5187
"grammars": [

patches/eslint-mdx+2.0.1.patch

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
diff --git a/node_modules/eslint-mdx/lib/parser.js b/node_modules/eslint-mdx/lib/parser.js
2+
index 1b5bcaf..4fdb4fb 100644
3+
--- a/node_modules/eslint-mdx/lib/parser.js
4+
+++ b/node_modules/eslint-mdx/lib/parser.js
5+
@@ -23,7 +23,11 @@ class Parser {
6+
...(0, helpers_1.arrayify)(markdownExtensions),
7+
].includes(extname);
8+
if (!isMdx && !isMarkdown) {
9+
- throw new Error('Unsupported file extension, make sure setting the `extensions` or `markdownExtensions` option correctly.');
10+
+ return require('@babel/eslint-parser').parseForESLint(code, {
11+
+ filePath,
12+
+ sourceType,
13+
+ requireConfigFile: false,
14+
+ })
15+
}
16+
const physicalFilename = (0, helpers_1.getPhysicalFilename)(filePath);
17+
let result;

test/fixture.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export const meta = {
88

99
Lorem ipsum dolor sit amet, consectetur adipiscing **elit**. Ut ac lobortis <b>velit</b>.
1010

11-
<!-- This is a comment -->
11+
{/* This is a comment */}
1212

1313
```css
1414
@media (min-width: 400px) {

0 commit comments

Comments
 (0)