From b6473974c03a3b8c3b070b9e69138466ce227e14 Mon Sep 17 00:00:00 2001 From: vanyauhalin Date: Fri, 6 Dec 2024 16:55:06 +0400 Subject: [PATCH] temp: add remark-lint package --- packages/remark-lint/lib/main.ts | 31 ++++++++++++++++++++++++++++++ packages/remark-lint/package.json | 17 ++++++++++++++++ packages/remark-lint/tsconfig.json | 4 ++++ pnpm-lock.yaml | 15 +++++++++++++++ 4 files changed, 67 insertions(+) create mode 100644 packages/remark-lint/lib/main.ts create mode 100644 packages/remark-lint/package.json create mode 100644 packages/remark-lint/tsconfig.json diff --git a/packages/remark-lint/lib/main.ts b/packages/remark-lint/lib/main.ts new file mode 100644 index 000000000..1a2721152 --- /dev/null +++ b/packages/remark-lint/lib/main.ts @@ -0,0 +1,31 @@ +import {type TransformCallback} from "unified" +import {type Label, type Severity} from "unified-lint-rule" +import {type Node} from "unist" +import {type VFile} from "vfile" + +export interface RemarkLintRule< + Tree extends Node = Node, + Option = unknown, +> { + ( + config?: + string[] | + Label | + Severity | + [ + level: Label | Severity, + option?: Option | undefined, + ] | + undefined + ): + ( + ( + tree: Tree, + file: VFile, + next: TransformCallback, + ) => undefined + ) | + undefined + + readonly name: string +} diff --git a/packages/remark-lint/package.json b/packages/remark-lint/package.json new file mode 100644 index 000000000..8fb85d555 --- /dev/null +++ b/packages/remark-lint/package.json @@ -0,0 +1,17 @@ +{ + "name": "@onlyoffice/remark-lint", + "type": "module", + "private": true, + "main": "lib/main.ts", + "scripts": { + "clean": "rimraf node_modules", + "test:types": "tsc", + "test": "pnpm test:types" + }, + "dependencies": { + "@types/unist": "3.0.3", + "unified": "11.0.5", + "unified-lint-rule": "3.0.0", + "vfile": "6.0.1" + } +} diff --git a/packages/remark-lint/tsconfig.json b/packages/remark-lint/tsconfig.json new file mode 100644 index 000000000..f0d8cf437 --- /dev/null +++ b/packages/remark-lint/tsconfig.json @@ -0,0 +1,4 @@ +{ + "extends": "../../tsconfig.base.json", + "include": ["lib"] +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0efb18e71..3cb66e86f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -2366,6 +2366,21 @@ importers: specifier: 0.5.6 version: 0.5.6 + packages/remark-lint: + dependencies: + '@types/unist': + specifier: 3.0.3 + version: 3.0.3 + unified: + specifier: 11.0.5 + version: 11.0.5 + unified-lint-rule: + specifier: 3.0.0 + version: 3.0.0 + vfile: + specifier: 6.0.1 + version: 6.0.1 + packages/remark-lint-eslint: dependencies: '@onlyoffice/eslint-config':