Skip to content

Commit b20de68

Browse files
authored
Refactor various small stylistic things
* Change to `fileMatch` an array for JSON validation * Add remark rule `lint-no-emphasis-as-heading`, as it’s no longer violated * Use ESM for test script * Add XO rule `unicorn/prefer-node-protocol` * Refactor to combine build script into single `esbuild` call * Refactor to tiny `.vscodeignore` Closes GH-111. Reviewed-by: Christian Murphy <christian.murphy.42@gmail.com> Reviewed-by: Titus Wormer <tituswormer@gmail.com>
1 parent f0002b8 commit b20de68

File tree

6 files changed

+19
-43
lines changed

6 files changed

+19
-43
lines changed

.vscodeignore

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
.*
22
.*/
3-
node_modules/
43
src/
54
test/
6-
test.js
7-
renovate.json
8-
package-lock.json
5+
test.mjs
96
tsconfig.json

package.json

+7-16
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,10 @@
3737
"contributes": {
3838
"jsonValidation": [
3939
{
40-
"fileMatch": ".remarkrc",
41-
"url": "https://json.schemastore.org/remarkrc"
42-
},
43-
{
44-
"fileMatch": ".remarkrc.json",
40+
"fileMatch": [
41+
".remarkrc",
42+
".remarkrc.json"
43+
],
4544
"url": "https://json.schemastore.org/remarkrc"
4645
},
4746
{
@@ -67,10 +66,6 @@
6766
"remarkConfig": {
6867
"plugins": [
6968
"preset-wooorm",
70-
[
71-
"lint-no-emphasis-as-heading",
72-
false
73-
],
7469
[
7570
"lint-no-html",
7671
false
@@ -88,8 +83,7 @@
8883
"xo": {
8984
"prettier": true,
9085
"rules": {
91-
"unicorn/prefer-module": "off",
92-
"unicorn/prefer-node-protocol": "off"
86+
"unicorn/prefer-module": "off"
9387
}
9488
},
9589
"devDependencies": {
@@ -100,19 +94,16 @@
10094
"remark-cli": "^11.0.0",
10195
"remark-language-server": "^2.0.0",
10296
"remark-preset-wooorm": "^9.0.0",
103-
"rimraf": "^3.0.0",
10497
"typescript": "^4.0.0",
10598
"vsce": "^2.0.0",
10699
"vscode-languageclient": "^8.0.0",
107100
"xo": "^0.50.0"
108101
},
109102
"scripts": {
110-
"build:language-server": "esbuild node_modules/remark-language-server/index.js --bundle --platform=node --target=node16 --format=cjs --outfile=out/remark-language-server.js",
111-
"build:extension": "esbuild src/extension.js --bundle --platform=node --target=node16 --format=cjs --external:vscode --external:./remark-language-server --outfile=out/extension.js",
112103
"lint": "xo",
113-
"build": "rimraf out && npm run build:language-server && npm run build:extension",
104+
"build": "esbuild extension=src/extension.js remark-language-server --bundle --platform=node --target=node16 --format=cjs --external:vscode --outdir=out --minify",
114105
"pretest": "npm run build && npm run lint",
115-
"test": "node test.js",
106+
"test": "node test.mjs",
116107
"vscode:prepublish": "npm run build"
117108
}
118109
}

readme.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ your `settings.json` (which you can open with <kbd>Ctrl</kbd> + <kbd>,</kbd>):
8585
```json
8686
{
8787
"[markdown]": {
88-
"editor.defaultFormatter": "unifiedjs.vscode-remark",
88+
"editor.defaultFormatter": "unifiedjs.vscode-remark"
8989
}
9090
}
9191
```

test.js

-19
This file was deleted.

test.mjs

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/env node
2+
import {runTests} from '@vscode/test-electron'
3+
4+
await runTests({
5+
extensionDevelopmentPath: new URL('.', import.meta.url).pathname,
6+
extensionTestsPath: new URL('test/index.test.js', import.meta.url).pathname
7+
})

test/index.test.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
const assert = require('assert')
2-
const fs = require('fs/promises')
3-
const path = require('path')
1+
const assert = require('node:assert')
2+
const fs = require('node:fs/promises')
3+
const path = require('node:path')
44

55
const {commands, extensions, Uri, window, workspace} = require('vscode')
66

0 commit comments

Comments
 (0)