Skip to content

Commit 644bc26

Browse files
committed
Update to xo 1
This required some small refactors to adhere to the new style rules.
1 parent aedc42c commit 644bc26

File tree

15 files changed

+32
-30
lines changed

15 files changed

+32
-30
lines changed

fixtures/debug/loader.mjs

Lines changed: 0 additions & 4 deletions
This file was deleted.

fixtures/debug/run.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {register} from 'node:module'
33
import {renderToStaticMarkup} from 'react-dom/server'
44
import React from 'react'
55

6-
register('./loader.mjs', import.meta.url)
6+
register('@mdx-js/node-loader', import.meta.url)
77

88
const module = await import('./example.mdx')
99

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"remark-frontmatter": "^5.0.0",
2626
"remark-preset-wooorm": "^11.0.0",
2727
"typescript": "^5.0.0",
28-
"xo": "^0.60.0"
28+
"xo": "^1.0.0"
2929
},
3030
"prettier": {
3131
"tabWidth": 2,
@@ -50,8 +50,10 @@
5050
]
5151
},
5252
"xo": {
53-
"prettier": true,
53+
"prettier": "compat",
5454
"rules": {
55+
"complexity": "off",
56+
"max-lines": "off",
5557
"max-params": "off",
5658
"@typescript-eslint/consistent-type-definitions": "off",
5759
"@typescript-eslint/naming-convention": "off",

packages/language-server/lib/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ let tsEnabled = false
3737
connection.onInitialize(async (parameters) => {
3838
const tsdk = parameters.initializationOptions?.typescript?.tsdk
3939
tsEnabled = Boolean(parameters.initializationOptions?.typescript?.enabled)
40-
assert(
40+
assert.ok(
4141
typeof tsdk === 'string',
4242
'Missing initialization option typescript.tsdk'
4343
)

packages/language-server/test/utils.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
import {createRequire} from 'node:module'
22
import path from 'node:path'
33
import {URI, Utils} from 'vscode-uri'
4-
// eslint-disable-next-line import/order
54
import {startLanguageServer} from '@volar/test-utils'
5+
import pkg from '../package.json' with {type: 'json'}
66

77
const require = createRequire(import.meta.url)
88
const pkgPath = new URL('../package.json', import.meta.url)
99
const pkgRequire = createRequire(pkgPath)
10-
const pkg = require('../package.json')
1110

1211
const bin = pkgRequire.resolve(pkg.bin['mdx-language-server'])
1312

packages/language-service/lib/commands.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export async function toggleSyntax(
4242
return
4343
}
4444

45-
const ast = root.ast
45+
const {ast} = root
4646

4747
if (!ast) {
4848
return

packages/language-service/lib/plugins/plugin.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,5 @@
1515
* @typedef {() => VirtualCodePluginObject} VirtualCodePlugin
1616
* An internal plugin for MDX analyzer that represents an MDX plugin.
1717
*/
18+
19+
export {}

packages/language-service/lib/plugins/recma-export-filepath.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,13 @@ export function recmaExportFilepath(options) {
1010
const opts = typeof options === 'object' && options !== null ? options : {}
1111
const name = 'name' in opts ? String(opts.name) : 'filepath'
1212

13-
return () => {
14-
return {
13+
return () => ({
1514
finalize() {
1615
return (
1716
'/** Generated by [recma-export-filepath](https://github.com/remcohaszing/recma-export-filepath) */\nexport const ' +
1817
name +
1918
" = /** @type {string} */ ('')"
2019
)
2120
}
22-
}
23-
}
21+
})
2422
}

packages/language-service/lib/service-plugin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ export function createMdxServicePlugin(options) {
227227
return
228228
}
229229

230-
const error = virtualCode.error
230+
const {error} = virtualCode
231231

232232
if (error) {
233233
return [

packages/language-service/lib/tsconfig.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,24 @@ export function resolvePlugins(mdxConfig, resolvePlugin) {
5656
}
5757

5858
switch (name) {
59-
case 'recma-export-filepath':
59+
case 'recma-export-filepath': {
6060
virtualCodePlugins.push(recmaExportFilepath(options[0]))
6161
break
62-
case 'rehype-mdx-title':
62+
}
63+
64+
case 'rehype-mdx-title': {
6365
virtualCodePlugins.push(rehypeMdxTitle(options[0]))
6466
break
65-
case 'remark-mdx-frontmatter':
67+
}
68+
69+
case 'remark-mdx-frontmatter': {
6670
virtualCodePlugins.push(remarkMdxFrontmatter(options[0]))
6771
break
68-
default:
72+
}
73+
74+
default: {
6975
remarkPlugins.push([resolvePlugin(name), ...options])
76+
}
7077
}
7178
}
7279

0 commit comments

Comments
 (0)