@lobehub/lint 1.18.1 → 1.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,7 @@
1
+ import { remarkGfmHighlight } from './remarkGfmHighlight';
1
2
  declare const _default: {
2
3
  $schema: string;
3
- plugins: (string | (string | boolean)[] | (string | {
4
+ plugins: (string | typeof remarkGfmHighlight | (string | boolean)[] | (string | {
4
5
  plugins: ((str: string) => string)[];
5
6
  })[] | (string | {
6
7
  heading: string;
@@ -10,9 +11,11 @@ declare const _default: {
10
11
  })[])[];
11
12
  settings: {
12
13
  bullet: string;
14
+ emphasis: string;
13
15
  fences: boolean;
14
16
  listItemIndent: number;
15
17
  rule: string;
18
+ strong: string;
16
19
  tightDefinitions: boolean;
17
20
  };
18
21
  };
@@ -22,16 +22,16 @@ __export(remarklint_exports, {
22
22
  default: () => remarklint_default
23
23
  });
24
24
  module.exports = __toCommonJS(remarklint_exports);
25
- var replaceNBSP = (str) => {
26
- return str.replaceAll(" ", " ");
27
- };
25
+ var import_remarkGfmHighlight = require("./remarkGfmHighlight");
26
+ var import_remarkTextrPlugins = require("./remarkTextrPlugins");
28
27
  var remarklint_default = {
29
28
  $schema: "https://json.schemastore.org/remarkrc",
30
29
  plugins: [
31
30
  "remark-gfm",
32
31
  "remark-frontmatter",
33
32
  "remark-pangu",
34
- ["remark-textr", { plugins: [replaceNBSP] }],
33
+ ["remark-textr", { plugins: [import_remarkTextrPlugins.replaceNBSP] }],
34
+ import_remarkGfmHighlight.remarkGfmHighlight,
35
35
  // ----- Plugin -----------------------------------------------------------
36
36
  "remark-sort-definitions",
37
37
  ["remark-toc", { heading: "TOC", maxDepth: 3 }],
@@ -68,9 +68,11 @@ var remarklint_default = {
68
68
  ],
69
69
  settings: {
70
70
  bullet: "-",
71
+ emphasis: "*",
71
72
  fences: true,
72
73
  listItemIndent: 1,
73
74
  rule: "-",
75
+ strong: "*",
74
76
  tightDefinitions: true
75
77
  }
76
78
  };
@@ -0,0 +1 @@
1
+ export declare function remarkGfmHighlight(): (tree: any) => Promise<void>;
@@ -0,0 +1,68 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // src/remarklint/remarkGfmHighlight.ts
30
+ var remarkGfmHighlight_exports = {};
31
+ __export(remarkGfmHighlight_exports, {
32
+ remarkGfmHighlight: () => remarkGfmHighlight
33
+ });
34
+ module.exports = __toCommonJS(remarkGfmHighlight_exports);
35
+ var gfmHighlight = [
36
+ { from: "Note", to: "[!NOTE]" },
37
+ { from: "Tip", to: "[!TIP]" },
38
+ { from: "Important", to: "[!IMPORTANT]" },
39
+ { from: "Warning", to: "[!WARNING]" },
40
+ { from: "Caution", to: "[!CAUTION]" }
41
+ ];
42
+ function remarkGfmHighlight() {
43
+ return async (tree) => {
44
+ const { visit } = await import("unist-util-visit");
45
+ visit(tree, "blockquote", (node) => {
46
+ visit(node, "strong", (subnode) => {
47
+ let value = "";
48
+ visit(subnode, "text", (textnode) => {
49
+ if (["Note", "Tip", "Important", "Warning", "Caution"].includes(textnode.value)) {
50
+ for (const item of gfmHighlight) {
51
+ if (item.from === textnode.value) {
52
+ value = item.to;
53
+ }
54
+ }
55
+ }
56
+ if (value) {
57
+ subnode.type = "text";
58
+ subnode.value = value;
59
+ }
60
+ });
61
+ });
62
+ });
63
+ };
64
+ }
65
+ // Annotate the CommonJS export names for ESM import in node:
66
+ 0 && (module.exports = {
67
+ remarkGfmHighlight
68
+ });
@@ -0,0 +1 @@
1
+ export declare const replaceNBSP: (str: string) => string;
@@ -0,0 +1,31 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/remarklint/remarkTextrPlugins.ts
20
+ var remarkTextrPlugins_exports = {};
21
+ __export(remarkTextrPlugins_exports, {
22
+ replaceNBSP: () => replaceNBSP
23
+ });
24
+ module.exports = __toCommonJS(remarkTextrPlugins_exports);
25
+ var replaceNBSP = (str) => {
26
+ return str.replaceAll(" ", " ");
27
+ };
28
+ // Annotate the CommonJS export names for ESM import in node:
29
+ 0 && (module.exports = {
30
+ replaceNBSP
31
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/lint",
3
- "version": "1.18.1",
3
+ "version": "1.19.0",
4
4
  "homepage": "https://github.com/lobehub/lobe-lint",
5
5
  "bugs": {
6
6
  "url": "https://github.com/lobehub/lobe-lint/issues/new"
@@ -34,8 +34,9 @@
34
34
  "eslint-plugin-simple-import-sort": "^10",
35
35
  "eslint-plugin-sort-keys-fix": "^1",
36
36
  "eslint-plugin-typescript-sort-keys": "^3",
37
- "eslint-plugin-unicorn": "^48",
37
+ "eslint-plugin-unicorn": "^49",
38
38
  "eslint-plugin-unused-imports": "^3",
39
+ "gatsby-remark-find-replace": "^0.3.0",
39
40
  "postcss-less": "^6",
40
41
  "postcss-styled-syntax": "^0.5",
41
42
  "prettier-plugin-organize-imports": "^3",
@@ -77,7 +78,8 @@
77
78
  "stylelint-config-clean-order": "^5",
78
79
  "stylelint-config-recommended": "^13",
79
80
  "stylelint-less": "^2",
80
- "stylelint-order": "^6"
81
+ "stylelint-order": "^6",
82
+ "unist-util-visit": "^5.0.0"
81
83
  },
82
84
  "peerDependencies": {
83
85
  "eslint": ">=8.42",