From 4c564145804ff90de643244fcf8f2b71ea1dff9b Mon Sep 17 00:00:00 2001 From: Bartosz Kaszubowski Date: Mon, 12 Jan 2026 22:48:07 +0100 Subject: [PATCH 1/6] plugins: fix TS setup and tests --- .../package.json | 3 +- .../tsconfig.json | 15 +- .../remark-lint-no-dead-urls/jest.config.cjs | 16 ++ plugins/remark-lint-no-dead-urls/package.json | 9 +- .../src/__tests__/{index.js => index.ts} | 90 +++++----- plugins/remark-lint-no-dead-urls/src/index.ts | 2 +- .../remark-lint-no-dead-urls/tsconfig.json | 15 +- plugins/remark-snackplayer/package.json | 7 +- plugins/remark-snackplayer/src/index.ts | 5 +- plugins/remark-snackplayer/tests/index.ts | 2 +- .../tests/output/output1.html | 1 + .../tests/output/output2.html | 2 + plugins/remark-snackplayer/tsconfig.json | 13 +- yarn.lock | 154 ++++++++++++++---- 14 files changed, 237 insertions(+), 97 deletions(-) create mode 100644 plugins/remark-lint-no-dead-urls/jest.config.cjs rename plugins/remark-lint-no-dead-urls/src/__tests__/{index.js => index.ts} (59%) diff --git a/plugins/remark-codeblock-language-as-title/package.json b/plugins/remark-codeblock-language-as-title/package.json index 9260aacc553..77e1d24e83c 100644 --- a/plugins/remark-codeblock-language-as-title/package.json +++ b/plugins/remark-codeblock-language-as-title/package.json @@ -21,6 +21,7 @@ }, "devDependencies": { "@types/mdast": "^4.0.4", - "remark": "^15.0.1" + "remark": "^15.0.1", + "typescript": "^5.9.3" } } diff --git a/plugins/remark-codeblock-language-as-title/tsconfig.json b/plugins/remark-codeblock-language-as-title/tsconfig.json index 2f8f8b925cb..3ca87f731c2 100644 --- a/plugins/remark-codeblock-language-as-title/tsconfig.json +++ b/plugins/remark-codeblock-language-as-title/tsconfig.json @@ -1,4 +1,13 @@ { - "extends": "@react-native/typescript-config/tsconfig.json", - "include": ["./src"], -} + "compilerOptions": { + "types": ["react", "node"], + "lib": ["ES2022", "DOM"], + "target": "es2022", + "module": "NodeNext", + "moduleResolution": "NodeNext", + "allowSyntheticDefaultImports": true, + "allowImportingTsExtensions": true, + "isolatedModules": true + }, + "include": ["./src"] +} \ No newline at end of file diff --git a/plugins/remark-lint-no-dead-urls/jest.config.cjs b/plugins/remark-lint-no-dead-urls/jest.config.cjs new file mode 100644 index 00000000000..2163e389307 --- /dev/null +++ b/plugins/remark-lint-no-dead-urls/jest.config.cjs @@ -0,0 +1,16 @@ +module.exports = { + preset: 'ts-jest/presets/default-esm', + testEnvironment: 'node', + extensionsToTreatAsEsm: ['.ts'], + moduleFileExtensions: ['js', 'ts'], + testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.ts$', + transform: { + '^.+\\.ts$': [ + 'ts-jest', + { + useESM: true, + tsconfig: 'tsconfig.json', + }, + ], + }, +}; diff --git a/plugins/remark-lint-no-dead-urls/package.json b/plugins/remark-lint-no-dead-urls/package.json index 8d082298fe4..df953229928 100644 --- a/plugins/remark-lint-no-dead-urls/package.json +++ b/plugins/remark-lint-no-dead-urls/package.json @@ -18,15 +18,18 @@ "test": "yarn node --experimental-vm-modules $(yarn bin jest)" }, "dependencies": { - "got": "^14.6.4", + "got": "^14.6.6", "unified-lint-rule": "^3.0.1", "unist-util-visit": "^5.0.0", "vfile": "^6.0.3" }, "devDependencies": { + "@types/jest": "^29.5.14", "@types/mdast": "^4.0.4", - "dedent": "^1.7.0", + "dedent": "^1.7.1", "jest": "^29.7.0", - "remark": "^15.0.1" + "remark": "^15.0.1", + "ts-jest": "^29.4.6", + "typescript": "^5.9.3" } } diff --git a/plugins/remark-lint-no-dead-urls/src/__tests__/index.js b/plugins/remark-lint-no-dead-urls/src/__tests__/index.ts similarity index 59% rename from plugins/remark-lint-no-dead-urls/src/__tests__/index.js rename to plugins/remark-lint-no-dead-urls/src/__tests__/index.ts index 5d1ddcb6fc1..dc7c8d96d32 100644 --- a/plugins/remark-lint-no-dead-urls/src/__tests__/index.js +++ b/plugins/remark-lint-no-dead-urls/src/__tests__/index.ts @@ -5,39 +5,41 @@ * LICENSE file in the root directory of this source tree. */ -import remark from 'remark'; +import {remark} from 'remark'; import dedent from 'dedent'; -import {jest} from '@jest/globals'; +import {jest, describe, beforeEach, test, expect} from '@jest/globals'; -jest.unstable_mockModule('../lib.js', () => ({ - fetch: jest.fn(), +const mockFetch = jest.fn() as jest.MockedFunction< + (url: string, method: unknown, options?: object) => Promise +>; + +jest.unstable_mockModule('../lib.ts', () => ({ + fetch: mockFetch, })); -const {fetch} = await import('../lib.js'); -const plugin = (await import('../')).default; +const plugin = (await import('../index.ts')).default; -const processMarkdown = (md, opts) => { +function processMarkdown(md: string, opts = {}) { return remark().use(plugin, opts).process(md); -}; +} describe('remark-lint-no-dead-urls', () => { - beforeEach(() => fetch.mockReset()); + beforeEach(() => mockFetch.mockReset()); - test('works with no URLs', () => { + test('works with no URLs', async () => { const lint = processMarkdown(dedent` # Title No URLs in here. `); - return lint.then(vFile => { - expect(fetch).toHaveBeenCalledTimes(0); - expect(vFile.messages.length).toBe(0); - }); + const vFile = await lint; + expect(mockFetch).toHaveBeenCalledTimes(0); + expect(vFile.messages.length).toBe(0); }); - test('works a good, bad a local link', () => { - fetch.mockReturnValueOnce(200).mockReturnValueOnce(404); + test('works a good, bad a local link', async () => { + mockFetch.mockResolvedValueOnce(200).mockResolvedValueOnce(404); const lint = processMarkdown( dedent` @@ -51,17 +53,16 @@ describe('remark-lint-no-dead-urls', () => { ` ); - return lint.then(vFile => { - expect(fetch).toHaveBeenCalledTimes(2); - expect(vFile.messages.length).toBe(1); - expect(vFile.messages[0].reason).toBe( - 'Link to https://github.com/unified/oops is broken' - ); - }); + const vFile = await lint; + expect(mockFetch).toHaveBeenCalledTimes(2); + expect(vFile.messages.length).toBe(1); + expect(vFile.messages[0].reason).toBe( + 'Link to https://github.com/unified/oops is broken' + ); }, 15000); - test('works with definitions and images', () => { - fetch.mockReturnValueOnce(200).mockReturnValueOnce(404); + test('works with definitions and images', async () => { + mockFetch.mockResolvedValueOnce(200).mockResolvedValueOnce(404); const lint = processMarkdown( dedent` @@ -80,27 +81,25 @@ describe('remark-lint-no-dead-urls', () => { } ); - return lint.then(vFile => { - expect(fetch).toHaveBeenCalledTimes(2); - expect(vFile.messages.length).toBe(1); - expect(vFile.messages[0].reason).toBe('Link to /oops/broken is broken'); - }); + const vFile = await lint; + expect(mockFetch).toHaveBeenCalledTimes(2); + expect(vFile.messages.length).toBe(1); + expect(vFile.messages[0].reason).toBe('Link to /oops/broken is broken'); }); - test('skips URLs with unsupported protocols', () => { + test('skips URLs with unsupported protocols', async () => { const lint = processMarkdown(dedent` [Send me an email.](mailto:me@me.com) [Look at this file.](ftp://path/to/file.txt) [Special schema.](flopper://a/b/c) `); - return lint.then(vFile => { - expect(fetch).toHaveBeenCalledTimes(0); - expect(vFile.messages.length).toBe(0); - }); + const vFile = await lint; + expect(mockFetch).toHaveBeenCalledTimes(0); + expect(vFile.messages.length).toBe(0); }); - test('localhost', () => { + test('localhost', async () => { const lint = processMarkdown( dedent` - [http://localhost](http://localhost) @@ -114,12 +113,11 @@ describe('remark-lint-no-dead-urls', () => { ` ); - return lint.then(vFile => { - expect(vFile.messages.length).toBe(0); - }); + const vFile = await lint; + expect(vFile.messages.length).toBe(0); }); - test('local IP 127.0.0.1', () => { + test('local IP 127.0.0.1', async () => { const lint = processMarkdown( dedent` - [http://127.0.0.1](http://127.0.0.1) @@ -133,9 +131,8 @@ describe('remark-lint-no-dead-urls', () => { ` ); - return lint.then(vFile => { - expect(vFile.messages.length).toBe(0); - }); + const vFile = await lint; + expect(vFile.messages.length).toBe(0); }); test.each([ @@ -143,13 +140,12 @@ describe('remark-lint-no-dead-urls', () => { '[Ignore this](http://www.url-to-ignore.com/somePath)', '[Ignore this](http://www.url-to-ignore.com/somePath?withQuery=wow)', '[its complicated](http://url-to-ignore.com/somePath/maybe)', - ])('skipUrlPatterns for content: %s', markdownContent => { + ])('skipUrlPatterns for content: %s', async markdownContent => { const lint = processMarkdown(markdownContent, { skipUrlPatterns: [/^http:\/\/(.*)url-to-ignore\.com/], }); - return lint.then(vFile => { - expect(vFile.messages.length).toBe(0); - }); + const vFile = await lint; + expect(vFile.messages.length).toBe(0); }); }); diff --git a/plugins/remark-lint-no-dead-urls/src/index.ts b/plugins/remark-lint-no-dead-urls/src/index.ts index 40ca10305d6..a1f898fc4fc 100644 --- a/plugins/remark-lint-no-dead-urls/src/index.ts +++ b/plugins/remark-lint-no-dead-urls/src/index.ts @@ -14,7 +14,7 @@ import {lintRule} from 'unified-lint-rule'; import {visit} from 'unist-util-visit'; import type {VFile} from 'vfile'; -import {fetch} from './lib.js'; +import {fetch} from './lib.ts'; const linkCache = new Map(); diff --git a/plugins/remark-lint-no-dead-urls/tsconfig.json b/plugins/remark-lint-no-dead-urls/tsconfig.json index 2f8f8b925cb..3ca87f731c2 100644 --- a/plugins/remark-lint-no-dead-urls/tsconfig.json +++ b/plugins/remark-lint-no-dead-urls/tsconfig.json @@ -1,4 +1,13 @@ { - "extends": "@react-native/typescript-config/tsconfig.json", - "include": ["./src"], -} + "compilerOptions": { + "types": ["react", "node"], + "lib": ["ES2022", "DOM"], + "target": "es2022", + "module": "NodeNext", + "moduleResolution": "NodeNext", + "allowSyntheticDefaultImports": true, + "allowImportingTsExtensions": true, + "isolatedModules": true + }, + "include": ["./src"] +} \ No newline at end of file diff --git a/plugins/remark-snackplayer/package.json b/plugins/remark-snackplayer/package.json index a6b38dc1762..0b3e47642f1 100644 --- a/plugins/remark-snackplayer/package.json +++ b/plugins/remark-snackplayer/package.json @@ -20,16 +20,15 @@ "test": "yarn tape tests/index.ts" }, "dependencies": { - "dedent": "^1.7.0", - "object.fromentries": "^2.0.8", + "dedent": "^1.7.1", "unist-util-visit-parents": "^3.1.1" }, "devDependencies": { "@types/mdast": "^4.0.4", - "@types/object.fromentries": "^2.0.4", "@types/tape": "^5.8.1", "remark": "^15.0.1", "remark-mdx": "^3.1.1", - "tape": "^5.9.0" + "tape": "^5.9.0", + "typescript": "^5.9.3" } } diff --git a/plugins/remark-snackplayer/src/index.ts b/plugins/remark-snackplayer/src/index.ts index 9578105365b..ac404875cf5 100644 --- a/plugins/remark-snackplayer/src/index.ts +++ b/plugins/remark-snackplayer/src/index.ts @@ -8,12 +8,11 @@ 'use strict'; import visit from 'unist-util-visit-parents'; -import fromEntries from 'object.fromentries'; import type {Code} from 'mdast'; import type {Node} from 'unist'; function parseParams(paramString = '') { - const params = fromEntries(new URLSearchParams(paramString)); + const params = Object.fromEntries(new URLSearchParams(paramString).entries()); if (!params.platform) { params.platform = 'web'; @@ -90,7 +89,7 @@ export default function SnackPlayer() { const nodesToProcess: Promise[] = []; visit(tree, 'code', (node: Node) => { if ('lang' in node && node.lang === 'SnackPlayer') { - nodesToProcess.push(toJsxNode(node as Code)); + nodesToProcess.push(toJsxNode(node as unknown as Code)); } }); await Promise.all(nodesToProcess); diff --git a/plugins/remark-snackplayer/tests/index.ts b/plugins/remark-snackplayer/tests/index.ts index 2d6825eab1a..b0d0ca879d3 100644 --- a/plugins/remark-snackplayer/tests/index.ts +++ b/plugins/remark-snackplayer/tests/index.ts @@ -11,7 +11,7 @@ import {remark} from 'remark'; import remarkMdx from 'remark-mdx'; import test from 'tape'; -import SnackPlayer from '../src/index'; +import SnackPlayer from '../src/index.ts'; function read(name: string) { return fs.readFileSync(path.join(import.meta.dirname, name), 'utf8'); diff --git a/plugins/remark-snackplayer/tests/output/output1.html b/plugins/remark-snackplayer/tests/output/output1.html index 35faf9ece21..3080ebb7414 100644 --- a/plugins/remark-snackplayer/tests/output/output1.html +++ b/plugins/remark-snackplayer/tests/output/output1.html @@ -9,5 +9,6 @@ data-snack-theme="light" data-snack-preview="true" data-snack-loading="lazy" + data-snack-device-appearance="light" data-snack-device-frame="false" /> diff --git a/plugins/remark-snackplayer/tests/output/output2.html b/plugins/remark-snackplayer/tests/output/output2.html index b0c485b813d..bc678bf4b7f 100644 --- a/plugins/remark-snackplayer/tests/output/output2.html +++ b/plugins/remark-snackplayer/tests/output/output2.html @@ -9,6 +9,7 @@ data-snack-theme="light" data-snack-preview="true" data-snack-loading="lazy" + data-snack-device-appearance="light" data-snack-device-frame="false" />
diff --git a/plugins/remark-snackplayer/tsconfig.json b/plugins/remark-snackplayer/tsconfig.json index c357a2c304f..0d5ce289a4e 100644 --- a/plugins/remark-snackplayer/tsconfig.json +++ b/plugins/remark-snackplayer/tsconfig.json @@ -1,4 +1,13 @@ { - "extends": "@react-native/typescript-config/tsconfig.json", - "include": ["./src", "./tests"], + "compilerOptions": { + "types": ["react", "node"], + "lib": ["ES2022", "DOM"], + "target": "es2022", + "module": "NodeNext", + "moduleResolution": "NodeNext", + "allowSyntheticDefaultImports": true, + "allowImportingTsExtensions": true, + "isolatedModules": true + }, + "include": ["./src", "./tests"] } diff --git a/yarn.lock b/yarn.lock index 918e9bfcbe4..54237ae18ba 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4334,6 +4334,7 @@ __metadata: dependencies: "@types/mdast": "npm:^4.0.4" remark: "npm:^15.0.1" + typescript: "npm:^5.9.3" unist-util-visit: "npm:^5.0.0" languageName: unknown linkType: soft @@ -4342,11 +4343,14 @@ __metadata: version: 0.0.0-use.local resolution: "@react-native-website/remark-lint-no-broken-external-links@workspace:plugins/remark-lint-no-dead-urls" dependencies: + "@types/jest": "npm:^29.5.14" "@types/mdast": "npm:^4.0.4" - dedent: "npm:^1.7.0" - got: "npm:^14.6.4" + dedent: "npm:^1.7.1" + got: "npm:^14.6.6" jest: "npm:^29.7.0" remark: "npm:^15.0.1" + ts-jest: "npm:^29.4.6" + typescript: "npm:^5.9.3" unified-lint-rule: "npm:^3.0.1" unist-util-visit: "npm:^5.0.0" vfile: "npm:^6.0.3" @@ -4358,13 +4362,12 @@ __metadata: resolution: "@react-native-website/remark-snackplayer@workspace:plugins/remark-snackplayer" dependencies: "@types/mdast": "npm:^4.0.4" - "@types/object.fromentries": "npm:^2.0.4" "@types/tape": "npm:^5.8.1" - dedent: "npm:^1.7.0" - object.fromentries: "npm:^2.0.8" + dedent: "npm:^1.7.1" remark: "npm:^15.0.1" remark-mdx: "npm:^3.1.1" tape: "npm:^5.9.0" + typescript: "npm:^5.9.3" unist-util-visit-parents: "npm:^3.1.1" languageName: unknown linkType: soft @@ -5677,6 +5680,16 @@ __metadata: languageName: node linkType: hard +"@types/jest@npm:^29.5.14": + version: 29.5.14 + resolution: "@types/jest@npm:29.5.14" + dependencies: + expect: "npm:^29.0.0" + pretty-format: "npm:^29.0.0" + checksum: 10c0/18e0712d818890db8a8dab3d91e9ea9f7f19e3f83c2e50b312f557017dc81466207a71f3ed79cf4428e813ba939954fa26ffa0a9a7f153181ba174581b1c2aed + languageName: node + linkType: hard + "@types/json-schema@npm:*, @types/json-schema@npm:^7.0.15, @types/json-schema@npm:^7.0.8, @types/json-schema@npm:^7.0.9": version: 7.0.15 resolution: "@types/json-schema@npm:7.0.15" @@ -5780,13 +5793,6 @@ __metadata: languageName: node linkType: hard -"@types/object.fromentries@npm:^2.0.4": - version: 2.0.4 - resolution: "@types/object.fromentries@npm:2.0.4" - checksum: 10c0/356399be5e80e75cb00b0746a04ce4ec642de8aee375aa7d445d71c3c6db0a9ea811c825f2b202eb232dd7b744f8a67fead865b325505b6186f77c0fc19aaa4e - languageName: node - linkType: hard - "@types/prismjs@npm:^1.26.0": version: 1.26.5 resolution: "@types/prismjs@npm:1.26.5" @@ -7149,6 +7155,15 @@ __metadata: languageName: node linkType: hard +"bs-logger@npm:^0.2.6": + version: 0.2.6 + resolution: "bs-logger@npm:0.2.6" + dependencies: + fast-json-stable-stringify: "npm:2.x" + checksum: 10c0/80e89aaaed4b68e3374ce936f2eb097456a0dddbf11f75238dbd53140b1e39259f0d248a5089ed456f1158984f22191c3658d54a713982f676709fbe1a6fa5a0 + languageName: node + linkType: hard + "bser@npm:2.1.1": version: 2.1.1 resolution: "bser@npm:2.1.1" @@ -8378,15 +8393,15 @@ __metadata: languageName: node linkType: hard -"dedent@npm:^1.0.0, dedent@npm:^1.7.0": - version: 1.7.0 - resolution: "dedent@npm:1.7.0" +"dedent@npm:^1.0.0, dedent@npm:^1.7.1": + version: 1.7.1 + resolution: "dedent@npm:1.7.1" peerDependencies: babel-plugin-macros: ^3.1.0 peerDependenciesMeta: babel-plugin-macros: optional: true - checksum: 10c0/c5e8a8beb5072bd5e520cb64b27a82d7ec3c2a63ee5ce47dbc2a05d5b7700cefd77a992a752cd0a8b1d979c1db06b14fb9486e805f3ad6088eda6e07cd9bf2d5 + checksum: 10c0/ae29ec1c5bd5216c698c9f23acaa5b720260fd4cef3c8b5af887eb5f8c9e6fdd5fed8668767437b4efea35e2991bd798987717633411a1734807c28255769b78 languageName: node linkType: hard @@ -9777,7 +9792,7 @@ __metadata: languageName: node linkType: hard -"expect@npm:^29.7.0": +"expect@npm:^29.0.0, expect@npm:^29.7.0": version: 29.7.0 resolution: "expect@npm:29.7.0" dependencies: @@ -9879,7 +9894,7 @@ __metadata: languageName: node linkType: hard -"fast-json-stable-stringify@npm:^2.0.0, fast-json-stable-stringify@npm:^2.1.0": +"fast-json-stable-stringify@npm:2.x, fast-json-stable-stringify@npm:^2.0.0, fast-json-stable-stringify@npm:^2.1.0": version: 2.1.0 resolution: "fast-json-stable-stringify@npm:2.1.0" checksum: 10c0/7f081eb0b8a64e0057b3bb03f974b3ef00135fbf36c1c710895cd9300f13c94ba809bb3a81cf4e1b03f6e5285610a61abbd7602d0652de423144dfee5a389c9b @@ -10582,9 +10597,9 @@ __metadata: languageName: node linkType: hard -"got@npm:^14.6.4": - version: 14.6.4 - resolution: "got@npm:14.6.4" +"got@npm:^14.6.6": + version: 14.6.6 + resolution: "got@npm:14.6.6" dependencies: "@sindresorhus/is": "npm:^7.0.1" byte-counter: "npm:^0.1.0" @@ -10598,7 +10613,7 @@ __metadata: p-cancelable: "npm:^4.0.1" responselike: "npm:^4.0.2" type-fest: "npm:^4.26.1" - checksum: 10c0/ee8980feb842db876cffa42fa27da6d90cc1a9cfe2a38942f4b319cbb37c000e34919a7e5dea017a0fa53b0535c02d00426abbbf528d6a4e89c6eb07b2bde977 + checksum: 10c0/dab4dbd35deac5634450cd745187ba68cfb9fd8d9236bec4861b633c7dc54f6383fde04cf504b16148625c307a229ff8cccf35d6622824ab13243c9d0af0fcc1 languageName: node linkType: hard @@ -10644,6 +10659,24 @@ __metadata: languageName: node linkType: hard +"handlebars@npm:^4.7.8": + version: 4.7.8 + resolution: "handlebars@npm:4.7.8" + dependencies: + minimist: "npm:^1.2.5" + neo-async: "npm:^2.6.2" + source-map: "npm:^0.6.1" + uglify-js: "npm:^3.1.4" + wordwrap: "npm:^1.0.0" + dependenciesMeta: + uglify-js: + optional: true + bin: + handlebars: bin/handlebars + checksum: 10c0/7aff423ea38a14bb379316f3857fe0df3c5d66119270944247f155ba1f08e07a92b340c58edaa00cfe985c21508870ee5183e0634dcb53dd405f35c93ef7f10d + languageName: node + linkType: hard + "hard-rejection@npm:^2.1.0": version: 2.1.0 resolution: "hard-rejection@npm:2.1.0" @@ -13447,6 +13480,13 @@ __metadata: languageName: node linkType: hard +"make-error@npm:^1.3.6": + version: 1.3.6 + resolution: "make-error@npm:1.3.6" + checksum: 10c0/171e458d86854c6b3fc46610cfacf0b45149ba043782558c6875d9f42f222124384ad0b468c92e996d815a8a2003817a710c0a160e49c1c394626f76fa45396f + languageName: node + linkType: hard + "make-fetch-happen@npm:^14.0.3": version: 14.0.3 resolution: "make-fetch-happen@npm:14.0.3" @@ -15426,7 +15466,7 @@ __metadata: languageName: node linkType: hard -"minimist@npm:^1.0.0, minimist@npm:^1.2.0, minimist@npm:^1.2.8": +"minimist@npm:^1.0.0, minimist@npm:^1.2.0, minimist@npm:^1.2.5, minimist@npm:^1.2.8": version: 1.2.8 resolution: "minimist@npm:1.2.8" checksum: 10c0/19d3fcdca050087b84c2029841a093691a91259a47def2f18222f41e7645a0b7c44ef4b40e88a1e58a40c84d2ef0ee6047c55594d298146d0eb3f6b737c20ce6 @@ -17522,7 +17562,7 @@ __metadata: languageName: node linkType: hard -"pretty-format@npm:^29.7.0": +"pretty-format@npm:^29.0.0, pretty-format@npm:^29.7.0": version: 29.7.0 resolution: "pretty-format@npm:29.7.0" dependencies: @@ -19159,12 +19199,12 @@ __metadata: languageName: node linkType: hard -"semver@npm:^7.1.1, semver@npm:^7.1.3, semver@npm:^7.3.4, semver@npm:^7.3.5, semver@npm:^7.3.7, semver@npm:^7.5.3, semver@npm:^7.5.4, semver@npm:^7.6.0, semver@npm:^7.7.1": - version: 7.7.2 - resolution: "semver@npm:7.7.2" +"semver@npm:^7.1.1, semver@npm:^7.1.3, semver@npm:^7.3.4, semver@npm:^7.3.5, semver@npm:^7.3.7, semver@npm:^7.5.3, semver@npm:^7.5.4, semver@npm:^7.6.0, semver@npm:^7.7.1, semver@npm:^7.7.3": + version: 7.7.3 + resolution: "semver@npm:7.7.3" bin: semver: bin/semver.js - checksum: 10c0/aca305edfbf2383c22571cb7714f48cadc7ac95371b4b52362fb8eeffdfbc0de0669368b82b2b15978f8848f01d7114da65697e56cd8c37b0dab8c58e543f9ea + checksum: 10c0/4afe5c986567db82f44c8c6faef8fe9df2a9b1d98098fc1721f57c696c4c21cebd572f297fc21002f81889492345b8470473bc6f4aff5fb032a6ea59ea2bc45e languageName: node linkType: hard @@ -20476,6 +20516,46 @@ __metadata: languageName: node linkType: hard +"ts-jest@npm:^29.4.6": + version: 29.4.6 + resolution: "ts-jest@npm:29.4.6" + dependencies: + bs-logger: "npm:^0.2.6" + fast-json-stable-stringify: "npm:^2.1.0" + handlebars: "npm:^4.7.8" + json5: "npm:^2.2.3" + lodash.memoize: "npm:^4.1.2" + make-error: "npm:^1.3.6" + semver: "npm:^7.7.3" + type-fest: "npm:^4.41.0" + yargs-parser: "npm:^21.1.1" + peerDependencies: + "@babel/core": ">=7.0.0-beta.0 <8" + "@jest/transform": ^29.0.0 || ^30.0.0 + "@jest/types": ^29.0.0 || ^30.0.0 + babel-jest: ^29.0.0 || ^30.0.0 + jest: ^29.0.0 || ^30.0.0 + jest-util: ^29.0.0 || ^30.0.0 + typescript: ">=4.3 <6" + peerDependenciesMeta: + "@babel/core": + optional: true + "@jest/transform": + optional: true + "@jest/types": + optional: true + babel-jest: + optional: true + esbuild: + optional: true + jest-util: + optional: true + bin: + ts-jest: cli.js + checksum: 10c0/013dda99ac938cd4b94bae9323ed1b633cd295976c256d596d01776866188078fe7b82b8b3ebd05deb401b27b5618d9d76208eded2568661240ecf9694a5c933 + languageName: node + linkType: hard + "tslib@npm:^2.0.0, tslib@npm:^2.0.3, tslib@npm:^2.4.0, tslib@npm:^2.6.0, tslib@npm:^2.8.1": version: 2.8.1 resolution: "tslib@npm:2.8.1" @@ -20541,7 +20621,7 @@ __metadata: languageName: node linkType: hard -"type-fest@npm:^4.26.1": +"type-fest@npm:^4.26.1, type-fest@npm:^4.41.0": version: 4.41.0 resolution: "type-fest@npm:4.41.0" checksum: 10c0/f5ca697797ed5e88d33ac8f1fec21921839871f808dc59345c9cf67345bfb958ce41bd821165dbf3ae591cedec2bf6fe8882098dfdd8dc54320b859711a2c1e4 @@ -20662,6 +20742,15 @@ __metadata: languageName: node linkType: hard +"uglify-js@npm:^3.1.4": + version: 3.19.3 + resolution: "uglify-js@npm:3.19.3" + bin: + uglifyjs: bin/uglifyjs + checksum: 10c0/83b0a90eca35f778e07cad9622b80c448b6aad457c9ff8e568afed978212b42930a95f9e1be943a1ffa4258a3340fbb899f41461131c05bb1d0a9c303aed8479 + languageName: node + linkType: hard + "unbox-primitive@npm:^1.1.0": version: 1.1.0 resolution: "unbox-primitive@npm:1.1.0" @@ -21849,6 +21938,13 @@ __metadata: languageName: node linkType: hard +"wordwrap@npm:^1.0.0": + version: 1.0.0 + resolution: "wordwrap@npm:1.0.0" + checksum: 10c0/7ed2e44f3c33c5c3e3771134d2b0aee4314c9e49c749e37f464bf69f2bcdf0cbf9419ca638098e2717cff4875c47f56a007532f6111c3319f557a2ca91278e92 + languageName: node + linkType: hard + "workbox-background-sync@npm:7.3.0": version: 7.3.0 resolution: "workbox-background-sync@npm:7.3.0" From 09c93053b8ad745fd895556b5b37a02d61a5553b Mon Sep 17 00:00:00 2001 From: Simek Date: Mon, 12 Jan 2026 23:12:57 +0100 Subject: [PATCH 2/6] sanitize tape input/output, run plugins checks on CI --- .github/workflows/pre-merge.yml | 12 ++++++++++++ plugins/remark-snackplayer/tests/index.ts | 16 ++++++++++++++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pre-merge.yml b/.github/workflows/pre-merge.yml index 64bd70fbb99..f0af7b44ebf 100644 --- a/.github/workflows/pre-merge.yml +++ b/.github/workflows/pre-merge.yml @@ -37,6 +37,18 @@ jobs: working-directory: website run: yarn ci:lint + - name: Run remark-codeblock-language-as-title plugin checks + working-directory: plugins/remark-codeblock-language-as-title + run: yarn lint + + - name: Run remark-lint-no-dead-urls plugin checks + working-directory: plugins/remark-lint-no-dead-urls + run: yarn lint && yarn test + + - name: Run remark-snackplayer plugin checks + working-directory: plugins/remark-snackplayer + run: yarn lint && yarn test + build: runs-on: ubuntu-latest steps: diff --git a/plugins/remark-snackplayer/tests/index.ts b/plugins/remark-snackplayer/tests/index.ts index b0d0ca879d3..5522c3f2726 100644 --- a/plugins/remark-snackplayer/tests/index.ts +++ b/plugins/remark-snackplayer/tests/index.ts @@ -17,18 +17,30 @@ function read(name: string) { return fs.readFileSync(path.join(import.meta.dirname, name), 'utf8'); } +function cleanupStringContent(content: string) { + return content.replaceAll('\r\n', '\n').trim().replace(/\s+/g, ''); +} + test('remark-snackplayer', async t => { const processor = remark().use(remarkMdx).use(SnackPlayer); const in1 = read('markdown/test1.md'); const out1 = read('output/output1.html'); const file1 = await processor.process(in1); - t.equal(String(file1), out1, 'With 1 Code Block'); + t.equal( + cleanupStringContent(String(file1)), + cleanupStringContent(out1), + 'With 1 Code Block' + ); const in2 = read('markdown/test2.md'); const out2 = read('output/output2.html'); const file2 = await processor.process(in2); - t.equal(String(file2), out2, 'With 2 Code Blocks'); + t.equal( + cleanupStringContent(String(file2)), + cleanupStringContent(out2), + 'With 2 Code Blocks' + ); t.end(); }); From 398a213ff9b1ed0d54d34ee5a9703cc5ac9efd08 Mon Sep 17 00:00:00 2001 From: Simek Date: Mon, 12 Jan 2026 23:22:00 +0100 Subject: [PATCH 3/6] split up checks to workspace and website, use root commands --- .github/workflows/pre-merge.yml | 39 +++++++++++++++++++++++++-------- 1 file changed, 30 insertions(+), 9 deletions(-) diff --git a/.github/workflows/pre-merge.yml b/.github/workflows/pre-merge.yml index f0af7b44ebf..1c7faf50c65 100644 --- a/.github/workflows/pre-merge.yml +++ b/.github/workflows/pre-merge.yml @@ -6,7 +6,7 @@ on: - main jobs: - lint: + lint-workspace: runs-on: ubuntu-latest steps: - name: Checkout repository @@ -30,24 +30,45 @@ jobs: - name: Check dependencies alignment run: yarn check-dependencies - - name: Run Workspace Lint - run: yarn lint + - name: Run packages lint + run: yarn lint:packages - - name: Run Website Specific Lints - working-directory: website - run: yarn ci:lint + - name: Run plugins lint + run: yarn lint:plugins - name: Run remark-codeblock-language-as-title plugin checks working-directory: plugins/remark-codeblock-language-as-title - run: yarn lint + run: yarn tsc - name: Run remark-lint-no-dead-urls plugin checks working-directory: plugins/remark-lint-no-dead-urls - run: yarn lint && yarn test + run: yarn tsc && yarn test - name: Run remark-snackplayer plugin checks working-directory: plugins/remark-snackplayer - run: yarn lint && yarn test + run: yarn tsc && yarn test + + lint-website: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v6 + + - name: Enable Corepack + run: corepack enable + + - name: Set up Node.js + uses: actions/setup-node@v6 + with: + node-version: "22" + cache: yarn + + - name: Install dependencies + run: yarn install --immutable + + - name: Run Website Specific Lints + working-directory: website + run: yarn ci:lint build: runs-on: ubuntu-latest From c963f49fbcffebebf63686a3a2b02b4fe5137924 Mon Sep 17 00:00:00 2001 From: Simek Date: Mon, 12 Jan 2026 23:24:22 +0100 Subject: [PATCH 4/6] add `noEmit` compiler option --- plugins/remark-codeblock-language-as-title/tsconfig.json | 5 +++-- plugins/remark-lint-no-dead-urls/tsconfig.json | 5 +++-- plugins/remark-snackplayer/tsconfig.json | 3 ++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/plugins/remark-codeblock-language-as-title/tsconfig.json b/plugins/remark-codeblock-language-as-title/tsconfig.json index 3ca87f731c2..8b1734cb7a2 100644 --- a/plugins/remark-codeblock-language-as-title/tsconfig.json +++ b/plugins/remark-codeblock-language-as-title/tsconfig.json @@ -7,7 +7,8 @@ "moduleResolution": "NodeNext", "allowSyntheticDefaultImports": true, "allowImportingTsExtensions": true, - "isolatedModules": true + "isolatedModules": true, + "noEmit": true }, "include": ["./src"] -} \ No newline at end of file +} diff --git a/plugins/remark-lint-no-dead-urls/tsconfig.json b/plugins/remark-lint-no-dead-urls/tsconfig.json index 3ca87f731c2..8b1734cb7a2 100644 --- a/plugins/remark-lint-no-dead-urls/tsconfig.json +++ b/plugins/remark-lint-no-dead-urls/tsconfig.json @@ -7,7 +7,8 @@ "moduleResolution": "NodeNext", "allowSyntheticDefaultImports": true, "allowImportingTsExtensions": true, - "isolatedModules": true + "isolatedModules": true, + "noEmit": true }, "include": ["./src"] -} \ No newline at end of file +} diff --git a/plugins/remark-snackplayer/tsconfig.json b/plugins/remark-snackplayer/tsconfig.json index 0d5ce289a4e..8a4fbdb8168 100644 --- a/plugins/remark-snackplayer/tsconfig.json +++ b/plugins/remark-snackplayer/tsconfig.json @@ -7,7 +7,8 @@ "moduleResolution": "NodeNext", "allowSyntheticDefaultImports": true, "allowImportingTsExtensions": true, - "isolatedModules": true + "isolatedModules": true, + "noEmit": true }, "include": ["./src", "./tests"] } From a8e50166cf8c4c9f3ff1ba33180faae49fb92ea5 Mon Sep 17 00:00:00 2001 From: Simek Date: Mon, 12 Jan 2026 23:28:59 +0100 Subject: [PATCH 5/6] website: add regular lint to CI command --- website/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/package.json b/website/package.json index 20d297e6707..59ea93d5a8b 100644 --- a/website/package.json +++ b/website/package.json @@ -28,7 +28,7 @@ "lint:examples": "eslint-examples-jsx && eslint-examples-tsx && tsc-examples", "lint:markdown:images": "node ../scripts/src/image-check.ts", "lint:markdown:links": "remark ../docs --quiet -r .remarkrc.withBrokenLinks.mjs", - "ci:lint": "yarn lint:examples && yarn lint:markdown:images && prettier --check src/**/*.scss", + "ci:lint": "yarn lint && yarn lint:examples && yarn lint:markdown:images && prettier --check src/**/*.scss", "pwa:generate": "npx pwa-asset-generator ./static/img/header_logo.svg ./static/img/pwa --padding '40px' --background 'rgb(32, 35, 42)' --icon-only --opaque true", "update-redirects": "node ../scripts/src/update-redirects.ts" }, From 40b40043bffa25bc9e889ca4e6f0172eb51179d0 Mon Sep 17 00:00:00 2001 From: Bartosz Kaszubowski Date: Tue, 13 Jan 2026 13:49:01 +0100 Subject: [PATCH 6/6] rename job to unblock CI --- .github/workflows/pre-merge.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pre-merge.yml b/.github/workflows/pre-merge.yml index 1c7faf50c65..a5c5ffe74cb 100644 --- a/.github/workflows/pre-merge.yml +++ b/.github/workflows/pre-merge.yml @@ -6,7 +6,7 @@ on: - main jobs: - lint-workspace: + lint: runs-on: ubuntu-latest steps: - name: Checkout repository