Skip to content

Commit b22c340

Browse files
committed
Update dev-dependencies
1 parent f181868 commit b22c340

5 files changed

Lines changed: 75 additions & 72 deletions

File tree

package.json

Lines changed: 2 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"type-coverage": "^2.0.0",
2929
"typescript": "^5.0.0",
3030
"unist-builder": "^4.0.0",
31-
"xo": "^0.60.0",
31+
"xo": "^1.0.0",
3232
"yaml": "^2.0.0"
3333
},
3434
"exports": {
@@ -129,54 +129,5 @@
129129
"strict": true
130130
},
131131
"type": "module",
132-
"version": "3.7.0",
133-
"xo": {
134-
"ignores": [
135-
"gems/",
136-
"lang/"
137-
],
138-
"overrides": [
139-
{
140-
"files": [
141-
"**/*.d.ts"
142-
],
143-
"rules": {
144-
"@typescript-eslint/array-type": [
145-
"error",
146-
{
147-
"default": "generic"
148-
}
149-
],
150-
"@typescript-eslint/ban-types": [
151-
"error",
152-
{
153-
"extendDefaults": true
154-
}
155-
],
156-
"@typescript-eslint/consistent-type-definitions": [
157-
"error",
158-
"interface"
159-
]
160-
}
161-
},
162-
{
163-
"files": [
164-
"script/**/*.js"
165-
],
166-
"rules": {
167-
"no-await-in-loop": "off"
168-
}
169-
}
170-
],
171-
"prettier": true,
172-
"rules": {
173-
"max-depth": "off",
174-
"n/file-extension-in-import": "off",
175-
"no-bitwise": "off",
176-
"no-template-curly-in-string": "off",
177-
"unicorn/prefer-at": "off",
178-
"unicorn/prefer-string-replace-all": "off",
179-
"unicorn/prefer-top-level-await": "off"
180-
}
181-
}
132+
"version": "3.7.0"
182133
}

script/build.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ if (!linguistBasename) {
8383
}
8484

8585
const version = linguistBasename.slice(prefix.length)
86-
assert(version, 'expected version to be found for `linguist`')
86+
assert.ok(version, 'expected version to be found for `linguist`')
8787

8888
console.log('generating from linguist %s', version)
8989

@@ -125,7 +125,7 @@ for (const [name, language] of Object.entries(languages)) {
125125
const existing = uniqueIdentifiers.get(alias)
126126

127127
if (existing) {
128-
assert(
128+
assert.ok(
129129
existing === scope,
130130
'expected duplicate names to refer to same language'
131131
)
@@ -169,7 +169,7 @@ for (name in languages) {
169169
const rawInfo = languages[name]
170170
const scope = rawInfo.tm_scope
171171

172-
assert(
172+
assert.ok(
173173
// This one actually turns into two classes on GH, which must be a bug.
174174
scope === 'source.pov-ray sdl' ||
175175
// https://github.com/github-linguist/linguist/pull/6862#issuecomment-2157822516
@@ -239,7 +239,7 @@ const scopes = grammarBasenames.flatMap(function (d) {
239239
return path.basename(d, extension)
240240
}
241241

242-
assert(d === 'version', d)
242+
assert.ok(d === 'version', d)
243243
return []
244244
})
245245

@@ -257,7 +257,7 @@ await Promise.all(
257257
(JSON.parse(String(await fs.readFile(inputUrl)))),
258258
scope
259259
)
260-
assert(grammar.scopeName === scope, 'expected scopes to match')
260+
assert.ok(grammar.scopeName === scope, 'expected scopes to match')
261261

262262
const result = analyze(grammar)
263263
dependencyInfo.set(scope, result)
@@ -266,8 +266,8 @@ await Promise.all(
266266

267267
for (const name of info.names) {
268268
const mappedScope = uniqueIdentifiers.get(name)
269-
assert(mappedScope, 'expected mapping')
270-
assert(mappedScope === scope, 'expected names to be unique')
269+
assert.ok(mappedScope, 'expected mapping')
270+
assert.ok(mappedScope === scope, 'expected names to be unique')
271271
}
272272

273273
/**
@@ -292,7 +292,7 @@ await Promise.all(
292292
for (const name of info.extensions) {
293293
const mappedScopeDot = uniqueIdentifiers.get(name)
294294
const short = name.slice(1)
295-
assert(mappedScopeDot, 'expected mapping')
295+
assert.ok(mappedScopeDot, 'expected mapping')
296296
const mappedScopeDotless = uniqueIdentifiers.get(short) || mappedScopeDot
297297

298298
if (mappedScopeDot === scope) {
@@ -306,7 +306,7 @@ await Promise.all(
306306
// something else (`.html` weirdly maps to `ecmarkup`).
307307
// That means, the short form must be in names.
308308
// It might not currently be though, because we’re still looping!
309-
assert(
309+
assert.ok(
310310
info.names.includes(short),
311311
'expected extension (w/o dot) in names'
312312
)
@@ -436,7 +436,7 @@ function add(scope) {
436436
if (used.has(scope)) return
437437
used.add(scope)
438438
const deps = dependencies.get(scope)
439-
assert(deps, scope)
439+
assert.ok(deps, scope)
440440
for (const dep of deps) {
441441
add(dep)
442442
}
@@ -458,7 +458,7 @@ const usedScopes = [...used].sort()
458458

459459
for (const scope of usedScopes) {
460460
const deps = dependencies.get(scope)
461-
assert(deps, scope)
461+
assert.ok(deps, scope)
462462

463463
if (deps.size > 0) {
464464
const manifest = Object.hasOwn(graph, scope) ? graph[scope] : undefined
@@ -757,14 +757,14 @@ function clean(value, schema, path) {
757757
const allAllowed = new Set([...allow, ...need])
758758

759759
for (const d of need) {
760-
assert(
760+
assert.ok(
761761
keys.includes(d),
762762
'expected field `' + d + '` in `' + value + '` at `' + path + '`'
763763
)
764764
}
765765

766766
for (const d of keys) {
767-
assert(
767+
assert.ok(
768768
allAllowed.has(d),
769769
'unexpected field `' + d + '` in `' + value + '` at `' + path + '`'
770770
)
@@ -893,7 +893,7 @@ function scopeToId(value) {
893893
.replace(/[. -_]([a-z\d])/g, function (_, /** @type {string} */ $1) {
894894
return $1.toUpperCase()
895895
})
896-
assert(/^[A-Za-z\d.]+$/.test(id), value)
896+
assert.ok(/^[A-Za-z\d.]+$/.test(id), value)
897897
return id
898898
}
899899

@@ -912,7 +912,7 @@ function normalizeLinguistName(d) {
912912
// For example `DNS zone` can be used as `dns-zone`, not as `dns`, `dns_zone`,
913913
// or `dnszone`.
914914
const normal = d.toLowerCase().replace(/ /g, '-')
915-
assert(/^[-_a-z\d.#+'*()/]+$/.test(normal), normal)
915+
assert.ok(/^[-_a-z\d.#+'*()/]+$/.test(normal), normal)
916916
return normal
917917
}
918918

@@ -926,6 +926,6 @@ function normalizeLinguistExtension(d) {
926926
// Extensions are case-insensitive (example: for `.OutJob`, `.outjob` also works).
927927
// They can also contain dots, dashes, plusses, etc.
928928
const normal = d.toLowerCase()
929-
assert(/^\.[\w+.-]+$/.test(normal), normal)
929+
assert.ok(/^\.[\w+.-]+$/.test(normal), normal)
930930
return normal
931931
}

script/css.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ async function generate(light, dark) {
176176
const scopePrefix = '.markdown-body '
177177
const prefix = '.pl-'
178178

179-
assert(tree.stylesheet, 'expected `stylesheet` to be set')
179+
assert.ok(tree.stylesheet, 'expected `stylesheet` to be set')
180180

181181
// Get themes.
182182
// Note: types don’t put media as children, force any node.
@@ -233,7 +233,7 @@ async function generate(light, dark) {
233233
* CSS.
234234
*/
235235
function generateMedia(media, mode) {
236-
assert(
236+
assert.ok(
237237
media &&
238238
media.type === 'media' &&
239239
'media' in media &&
@@ -243,7 +243,7 @@ function generateMedia(media, mode) {
243243
'expected `' + mode + '` head'
244244
)
245245
const rule = media.rules[0]
246-
assert(
246+
assert.ok(
247247
rule && 'declarations' in rule && rule.declarations,
248248
'expected `' + mode + '` rule'
249249
)

script/list.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ async function list() {
6969
'https://raw.githubusercontent.com/github-linguist/linguist/master/grammars.yml'
7070
)
7171
)
72-
assert(grammarsBody, 'expected grammars')
72+
assert.ok(grammarsBody, 'expected grammars')
7373
/** @type {Record<string, ReadonlyArray<string>>} */
7474
const grammars = parseYaml(grammarsBody)
7575
await fs.mkdir(infoFolder, {recursive: true})
@@ -153,7 +153,7 @@ The following files/folders contain third party software:`
153153
const vendor = vendors[index]
154154
const scopes = vendorToScope.get(vendor)
155155
const infoBody = rawInfo[index]
156-
assert(scopes)
156+
assert.ok(scopes)
157157

158158
if (!infoBody) {
159159
console.log('No info for `%s`', vendor)

xo.config.js

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/** @type {import('xo').FlatXoConfig} */
2+
const xoConfig = [
3+
{
4+
ignores: ['gems/', 'lang/'],
5+
name: 'default',
6+
prettier: true,
7+
rules: {
8+
'max-depth': 'off',
9+
'no-bitwise': 'off',
10+
'no-template-curly-in-string': 'off',
11+
'unicorn/prefer-at': 'off',
12+
'unicorn/prefer-string-raw': 'off',
13+
'unicorn/prefer-string-replace-all': 'off'
14+
},
15+
space: true
16+
},
17+
{
18+
files: ['lang/*.js'],
19+
rules: {
20+
camelcase: 'off',
21+
'unicorn/no-thenable': 'off'
22+
}
23+
},
24+
{
25+
files: ['lang/*.js', 'script/info.js'],
26+
rules: {
27+
'max-lines': 'off'
28+
}
29+
},
30+
{
31+
files: ['**/*.d.ts'],
32+
rules: {
33+
'@typescript-eslint/array-type': [
34+
'error',
35+
{
36+
default: 'generic'
37+
}
38+
],
39+
'@typescript-eslint/no-restricted-types': 'off',
40+
'@typescript-eslint/consistent-type-definitions': ['error', 'interface']
41+
}
42+
},
43+
{
44+
files: ['script/**/*.js'],
45+
rules: {
46+
'no-await-in-loop': 'off',
47+
'unicorn/prefer-top-level-await': 'off'
48+
}
49+
}
50+
]
51+
52+
export default xoConfig

0 commit comments

Comments
 (0)