@qualcomm-ui/eslint-config-mdx 3.0.1 → 3.0.3
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.
- package/dist/index.d.ts +2 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -29
- package/dist/index.js.map +1 -7
- package/dist/oxfmt-utils-CCT1qOHc.js +2 -0
- package/dist/oxfmt-utils-CCT1qOHc.js.map +1 -0
- package/dist/recommended.d.ts +2 -1
- package/dist/recommended.d.ts.map +1 -1
- package/dist/remark-lint-code-format.js +3 -230
- package/dist/remark-lint-code-format.js.map +1 -7
- package/dist/remark-lint-mdx-jsx-format.js +5 -223
- package/dist/remark-lint-mdx-jsx-format.js.map +1 -7
- package/dist/remark-preserve-alert-markers.js +2 -32
- package/dist/remark-preserve-alert-markers.js.map +1 -7
- package/dist/remarkrc.d.ts +1 -10
- package/dist/remarkrc.d.ts.map +1 -1
- package/dist/remarkrc.js +2 -385
- package/dist/remarkrc.js.map +1 -7
- package/package.json +12 -9
package/dist/remarkrc.js
CHANGED
|
@@ -1,385 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { dirname, isAbsolute, join, parse, resolve } from "node:path";
|
|
4
|
-
import { pathToFileURL } from "node:url";
|
|
5
|
-
import { format as formatCode } from "oxfmt";
|
|
6
|
-
import { parseConfigFileTextToJson } from "typescript";
|
|
7
|
-
var CONFIG_FILENAMES = [".oxfmtrc.json", ".oxfmtrc.jsonc", "oxfmt.config.ts"];
|
|
8
|
-
var configCache = /* @__PURE__ */ new Map();
|
|
9
|
-
async function loadOxfmtConfig(filePath) {
|
|
10
|
-
const basePath = getAbsolutePath(filePath);
|
|
11
|
-
const startDir = parse(basePath).ext ? dirname(basePath) : basePath;
|
|
12
|
-
const cachedConfig = configCache.get(startDir);
|
|
13
|
-
if (cachedConfig) {
|
|
14
|
-
return cachedConfig;
|
|
15
|
-
}
|
|
16
|
-
const configPromise = findOxfmtConfig(startDir).catch((error) => {
|
|
17
|
-
configCache.delete(startDir);
|
|
18
|
-
throw error;
|
|
19
|
-
});
|
|
20
|
-
configCache.set(startDir, configPromise);
|
|
21
|
-
return configPromise;
|
|
22
|
-
}
|
|
23
|
-
async function formatOxfmt(filePath, value, config) {
|
|
24
|
-
try {
|
|
25
|
-
const result = await formatCode(filePath, value, config);
|
|
26
|
-
if (result.errors.length > 0) {
|
|
27
|
-
return null;
|
|
28
|
-
}
|
|
29
|
-
return removeFinalEol(result.code);
|
|
30
|
-
} catch {
|
|
31
|
-
return null;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
function getAbsolutePath(filePath) {
|
|
35
|
-
if (!filePath) {
|
|
36
|
-
return process.cwd();
|
|
37
|
-
}
|
|
38
|
-
return isAbsolute(filePath) ? filePath : resolve(process.cwd(), filePath);
|
|
39
|
-
}
|
|
40
|
-
function getErrorMessage(error) {
|
|
41
|
-
if (error instanceof Error) {
|
|
42
|
-
return error.message;
|
|
43
|
-
}
|
|
44
|
-
return String(error);
|
|
45
|
-
}
|
|
46
|
-
async function findOxfmtConfig(startDir) {
|
|
47
|
-
let currentDir = startDir;
|
|
48
|
-
while (true) {
|
|
49
|
-
for (const configFilename of CONFIG_FILENAMES) {
|
|
50
|
-
const configPath = join(currentDir, configFilename);
|
|
51
|
-
const config = await readOxfmtConfig(configPath, configFilename);
|
|
52
|
-
if (config) {
|
|
53
|
-
return config;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
const parentDir = dirname(currentDir);
|
|
57
|
-
if (parentDir === currentDir) {
|
|
58
|
-
return {};
|
|
59
|
-
}
|
|
60
|
-
currentDir = parentDir;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
async function readOxfmtConfig(configPath, configFilename) {
|
|
64
|
-
if (configFilename === "oxfmt.config.ts") {
|
|
65
|
-
return readTypeScriptConfig(configPath);
|
|
66
|
-
}
|
|
67
|
-
const source = await readOptionalFile(configPath);
|
|
68
|
-
if (source === null) {
|
|
69
|
-
return null;
|
|
70
|
-
}
|
|
71
|
-
if (configFilename.endsWith(".jsonc")) {
|
|
72
|
-
return validateConfig(configPath, readJsoncConfig(configPath, source));
|
|
73
|
-
}
|
|
74
|
-
return validateConfig(configPath, JSON.parse(source));
|
|
75
|
-
}
|
|
76
|
-
async function readTypeScriptConfig(configPath) {
|
|
77
|
-
const source = await readOptionalFile(configPath);
|
|
78
|
-
if (source === null) {
|
|
79
|
-
return null;
|
|
80
|
-
}
|
|
81
|
-
const url = pathToFileURL(configPath);
|
|
82
|
-
url.searchParams.set("cache", Date.now().toString());
|
|
83
|
-
const module = await import(url.href);
|
|
84
|
-
return validateConfig(configPath, module.default);
|
|
85
|
-
}
|
|
86
|
-
function readJsoncConfig(configPath, source) {
|
|
87
|
-
const result = parseConfigFileTextToJson(configPath, source);
|
|
88
|
-
if (result.error) {
|
|
89
|
-
throw new Error(String(result.error.messageText));
|
|
90
|
-
}
|
|
91
|
-
return result.config;
|
|
92
|
-
}
|
|
93
|
-
function validateConfig(configPath, config) {
|
|
94
|
-
if (!isPlainConfig(config)) {
|
|
95
|
-
throw new Error(`${configPath} must define an object`);
|
|
96
|
-
}
|
|
97
|
-
return config;
|
|
98
|
-
}
|
|
99
|
-
async function readOptionalFile(path) {
|
|
100
|
-
try {
|
|
101
|
-
return await readFile(path, "utf8");
|
|
102
|
-
} catch (error) {
|
|
103
|
-
if (isMissingFileError(error)) {
|
|
104
|
-
return null;
|
|
105
|
-
}
|
|
106
|
-
throw error;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
function removeFinalEol(value) {
|
|
110
|
-
return value.replace(/\r?\n$/u, "");
|
|
111
|
-
}
|
|
112
|
-
function isPlainConfig(value) {
|
|
113
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
114
|
-
}
|
|
115
|
-
function isMissingFileError(error) {
|
|
116
|
-
if (typeof error !== "object" || error === null || !("code" in error)) {
|
|
117
|
-
return false;
|
|
118
|
-
}
|
|
119
|
-
const { code } = error;
|
|
120
|
-
return code === "ENOENT" || code === "ENOTDIR";
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
// src/remark-lint-code-format.ts
|
|
124
|
-
var LANGUAGE_EXTENSIONS = /* @__PURE__ */ new Map([
|
|
125
|
-
["javascript", ".js"],
|
|
126
|
-
["javascriptreact", ".jsx"],
|
|
127
|
-
["js", ".js"],
|
|
128
|
-
["jsx", ".jsx"],
|
|
129
|
-
["ts", ".ts"],
|
|
130
|
-
["tsx", ".tsx"],
|
|
131
|
-
["typescript", ".ts"],
|
|
132
|
-
["typescriptreact", ".tsx"]
|
|
133
|
-
]);
|
|
134
|
-
function remarkLintCodeFormat() {
|
|
135
|
-
return async function transform(tree, file) {
|
|
136
|
-
let oxfmtConfig;
|
|
137
|
-
try {
|
|
138
|
-
oxfmtConfig = await loadOxfmtConfig(file.path);
|
|
139
|
-
} catch (error) {
|
|
140
|
-
file.message(
|
|
141
|
-
`Unable to load oxfmt config: ${getErrorMessage(error)}`,
|
|
142
|
-
{ column: 1, line: 1 },
|
|
143
|
-
"remark-lint:code-format"
|
|
144
|
-
);
|
|
145
|
-
return;
|
|
146
|
-
}
|
|
147
|
-
const codeNodes = [];
|
|
148
|
-
visit(tree, "code", (node) => {
|
|
149
|
-
if (typeof node.value === "string") {
|
|
150
|
-
codeNodes.push(node);
|
|
151
|
-
}
|
|
152
|
-
});
|
|
153
|
-
for (const [index, node] of codeNodes.entries()) {
|
|
154
|
-
const extension = getExtension(node.lang);
|
|
155
|
-
if (!extension) {
|
|
156
|
-
continue;
|
|
157
|
-
}
|
|
158
|
-
const blockFilePath = getBlockFilePath(file.path, index, extension);
|
|
159
|
-
if (isStandaloneJsxSnippet(extension, node.value)) {
|
|
160
|
-
continue;
|
|
161
|
-
}
|
|
162
|
-
const formatted = await formatOxfmt(
|
|
163
|
-
blockFilePath,
|
|
164
|
-
node.value,
|
|
165
|
-
oxfmtConfig
|
|
166
|
-
);
|
|
167
|
-
if (formatted === null) {
|
|
168
|
-
continue;
|
|
169
|
-
}
|
|
170
|
-
if (formatted !== node.value) {
|
|
171
|
-
file.message(
|
|
172
|
-
"Format code block with oxfmt",
|
|
173
|
-
node,
|
|
174
|
-
"remark-lint:code-format"
|
|
175
|
-
);
|
|
176
|
-
node.value = formatted;
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
};
|
|
180
|
-
}
|
|
181
|
-
function getBlockFilePath(filePath, index, extension) {
|
|
182
|
-
return `${getAbsolutePath(filePath)}.${index}${extension}`;
|
|
183
|
-
}
|
|
184
|
-
function getExtension(language) {
|
|
185
|
-
if (!language) {
|
|
186
|
-
return null;
|
|
187
|
-
}
|
|
188
|
-
const [name = ""] = language.trim().split(/\s+/u);
|
|
189
|
-
return LANGUAGE_EXTENSIONS.get(name.toLowerCase()) ?? null;
|
|
190
|
-
}
|
|
191
|
-
function isStandaloneJsxSnippet(extension, value) {
|
|
192
|
-
return (extension === ".jsx" || extension === ".tsx") && /^<(?:>|\/?[A-Za-z][\w.:/-]*(?:[\s>/]|$))/u.test(trimLeadingComments(value));
|
|
193
|
-
}
|
|
194
|
-
function trimLeadingComments(value) {
|
|
195
|
-
let source = value.trimStart();
|
|
196
|
-
while (true) {
|
|
197
|
-
if (source.startsWith("//")) {
|
|
198
|
-
const nextLineIndex = source.indexOf("\n");
|
|
199
|
-
if (nextLineIndex === -1) {
|
|
200
|
-
return "";
|
|
201
|
-
}
|
|
202
|
-
source = source.slice(nextLineIndex + 1).trimStart();
|
|
203
|
-
continue;
|
|
204
|
-
}
|
|
205
|
-
if (source.startsWith("/*")) {
|
|
206
|
-
const commentEndIndex = source.indexOf("*/");
|
|
207
|
-
if (commentEndIndex === -1) {
|
|
208
|
-
return source;
|
|
209
|
-
}
|
|
210
|
-
source = source.slice(commentEndIndex + 2).trimStart();
|
|
211
|
-
continue;
|
|
212
|
-
}
|
|
213
|
-
return source;
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
function visit(node, type, callback) {
|
|
217
|
-
if (node.type === type) {
|
|
218
|
-
callback(node);
|
|
219
|
-
}
|
|
220
|
-
if (!Array.isArray(node.children)) {
|
|
221
|
-
return;
|
|
222
|
-
}
|
|
223
|
-
for (const child of node.children) {
|
|
224
|
-
visit(child, type, callback);
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
// src/remark-lint-mdx-jsx-format.ts
|
|
229
|
-
function remarkLintMdxJsxFormat() {
|
|
230
|
-
return async function transform(tree, file) {
|
|
231
|
-
const source = getFileValue(file);
|
|
232
|
-
if (!source) {
|
|
233
|
-
return;
|
|
234
|
-
}
|
|
235
|
-
let oxfmtConfig;
|
|
236
|
-
try {
|
|
237
|
-
oxfmtConfig = await loadOxfmtConfig(file.path);
|
|
238
|
-
} catch (error) {
|
|
239
|
-
file.message(
|
|
240
|
-
`Unable to load oxfmt config: ${getErrorMessage(error)}`,
|
|
241
|
-
{ column: 1, line: 1 },
|
|
242
|
-
"remark-lint:mdx-jsx-format"
|
|
243
|
-
);
|
|
244
|
-
await replaceMdxJsxFlowElements(tree, source, file.path, null, file);
|
|
245
|
-
return;
|
|
246
|
-
}
|
|
247
|
-
await replaceMdxJsxFlowElements(tree, source, file.path, oxfmtConfig, file);
|
|
248
|
-
};
|
|
249
|
-
}
|
|
250
|
-
async function replaceMdxJsxFlowElements(node, source, filePath, config, file) {
|
|
251
|
-
if (!Array.isArray(node.children)) {
|
|
252
|
-
return;
|
|
253
|
-
}
|
|
254
|
-
const children = [];
|
|
255
|
-
for (const child of node.children) {
|
|
256
|
-
if (child.type === "mdxJsxFlowElement") {
|
|
257
|
-
const raw = getSourceSlice(source, child);
|
|
258
|
-
if (raw === null) {
|
|
259
|
-
children.push(child);
|
|
260
|
-
continue;
|
|
261
|
-
}
|
|
262
|
-
const formatted = config === null || hasChildren(child) ? raw : await formatMdxJsxBlock(filePath, raw, config);
|
|
263
|
-
if (formatted !== raw) {
|
|
264
|
-
file.message(
|
|
265
|
-
"Format MDX JSX block",
|
|
266
|
-
child,
|
|
267
|
-
"remark-lint:mdx-jsx-format"
|
|
268
|
-
);
|
|
269
|
-
}
|
|
270
|
-
children.push({
|
|
271
|
-
type: "html",
|
|
272
|
-
value: formatted
|
|
273
|
-
});
|
|
274
|
-
continue;
|
|
275
|
-
}
|
|
276
|
-
await replaceMdxJsxFlowElements(child, source, filePath, config, file);
|
|
277
|
-
children.push(child);
|
|
278
|
-
}
|
|
279
|
-
node.children = children;
|
|
280
|
-
}
|
|
281
|
-
async function formatMdxJsxBlock(filePath, value, config) {
|
|
282
|
-
const formatted = await formatOxfmt(
|
|
283
|
-
getBlockFilePath2(filePath),
|
|
284
|
-
wrapMdxJsxBlock(value),
|
|
285
|
-
config
|
|
286
|
-
);
|
|
287
|
-
if (formatted === null) {
|
|
288
|
-
return value;
|
|
289
|
-
}
|
|
290
|
-
return unwrapMdxJsxBlock(formatted) ?? value;
|
|
291
|
-
}
|
|
292
|
-
function wrapMdxJsxBlock(value) {
|
|
293
|
-
return `const __mdx = (
|
|
294
|
-
<>
|
|
295
|
-
${value}
|
|
296
|
-
</>
|
|
297
|
-
)
|
|
298
|
-
`;
|
|
299
|
-
}
|
|
300
|
-
function unwrapMdxJsxBlock(value) {
|
|
301
|
-
const lines = value.split(/\r?\n/u);
|
|
302
|
-
const openIndex = lines.findIndex((line) => line.trim() === "<>");
|
|
303
|
-
const closeIndex = lines.findIndex(
|
|
304
|
-
(line, index) => index > openIndex && line.trim() === "</>"
|
|
305
|
-
);
|
|
306
|
-
if (openIndex === -1 || closeIndex === -1 || closeIndex <= openIndex + 1) {
|
|
307
|
-
return null;
|
|
308
|
-
}
|
|
309
|
-
return lines.slice(openIndex + 1, closeIndex).map((line) => line.startsWith(" ") ? line.slice(4) : line).join("\n");
|
|
310
|
-
}
|
|
311
|
-
function getSourceSlice(source, node) {
|
|
312
|
-
const start = node.position?.start?.offset;
|
|
313
|
-
const end = node.position?.end?.offset;
|
|
314
|
-
if (typeof start !== "number" || typeof end !== "number") {
|
|
315
|
-
return null;
|
|
316
|
-
}
|
|
317
|
-
return source.slice(start, end);
|
|
318
|
-
}
|
|
319
|
-
function getFileValue(file) {
|
|
320
|
-
return file.value ?? "";
|
|
321
|
-
}
|
|
322
|
-
function getBlockFilePath2(filePath) {
|
|
323
|
-
return `${getAbsolutePath(filePath)}.jsx.tsx`;
|
|
324
|
-
}
|
|
325
|
-
function hasChildren(node) {
|
|
326
|
-
return Array.isArray(node.children) && node.children.length > 0;
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
// src/remark-preserve-alert-markers.ts
|
|
330
|
-
var ALERT_MARKER_PATTERN = /^\\?\[!(?:note|tip|success|warning|caution)(?:\/[^\]\n]+)?\]/iu;
|
|
331
|
-
function remarkPreserveAlertMarkers() {
|
|
332
|
-
const extensions = getToMarkdownExtensions(this);
|
|
333
|
-
const data = this.data();
|
|
334
|
-
data.toMarkdownExtensions = [
|
|
335
|
-
...extensions,
|
|
336
|
-
{
|
|
337
|
-
handlers: {
|
|
338
|
-
text: preserveAlertMarkerText
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
];
|
|
342
|
-
}
|
|
343
|
-
function preserveAlertMarkerText(node, parent, state, info) {
|
|
344
|
-
const value = state.safe(node.value, info);
|
|
345
|
-
if (!isAlertMarkerText(node, parent, state)) {
|
|
346
|
-
return value;
|
|
347
|
-
}
|
|
348
|
-
return value.replace(/^\\(?=\[!)/u, "");
|
|
349
|
-
}
|
|
350
|
-
function isAlertMarkerText(node, parent, state) {
|
|
351
|
-
return parent?.type === "paragraph" && parent.children?.[0] === node && state.stack.includes("blockquote") && ALERT_MARKER_PATTERN.test(node.value);
|
|
352
|
-
}
|
|
353
|
-
function getToMarkdownExtensions(processor) {
|
|
354
|
-
const { toMarkdownExtensions } = processor.data();
|
|
355
|
-
return Array.isArray(toMarkdownExtensions) ? toMarkdownExtensions : [];
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
// src/remarkrc.ts
|
|
359
|
-
var remarkConfig = {
|
|
360
|
-
plugins: [
|
|
361
|
-
"remark-frontmatter",
|
|
362
|
-
"remark-lint-fenced-code-flag",
|
|
363
|
-
"remark-lint-final-newline",
|
|
364
|
-
"remark-lint-heading-increment",
|
|
365
|
-
"remark-lint-list-item-content-indent",
|
|
366
|
-
["remark-lint-list-item-indent", "one"],
|
|
367
|
-
["remark-lint-maximum-heading-length", { size: 80 }],
|
|
368
|
-
"remark-lint-no-consecutive-blank-lines",
|
|
369
|
-
"remark-lint-no-duplicate-headings-in-section",
|
|
370
|
-
["remark-lint-no-heading-punctuation", ",.:;"],
|
|
371
|
-
["remark-lint-unordered-list-marker-style", "-"],
|
|
372
|
-
remarkLintCodeFormat,
|
|
373
|
-
remarkLintMdxJsxFormat,
|
|
374
|
-
remarkPreserveAlertMarkers
|
|
375
|
-
],
|
|
376
|
-
settings: {
|
|
377
|
-
bullet: "-",
|
|
378
|
-
rule: "-"
|
|
379
|
-
}
|
|
380
|
-
};
|
|
381
|
-
var remarkrc_default = remarkConfig;
|
|
382
|
-
export {
|
|
383
|
-
remarkrc_default as default
|
|
384
|
-
};
|
|
385
|
-
//# sourceMappingURL=remarkrc.js.map
|
|
1
|
+
import e from"./remark-lint-code-format.js";import t from"./remark-lint-mdx-jsx-format.js";import n from"./remark-preserve-alert-markers.js";var r={plugins:[`remark-frontmatter`,`remark-lint-fenced-code-flag`,`remark-lint-final-newline`,`remark-lint-heading-increment`,`remark-lint-list-item-content-indent`,[`remark-lint-list-item-indent`,`one`],[`remark-lint-maximum-heading-length`,{size:80}],`remark-lint-no-consecutive-blank-lines`,`remark-lint-no-duplicate-headings-in-section`,[`remark-lint-no-heading-punctuation`,`,.:;`],[`remark-lint-unordered-list-marker-style`,`-`],e,t,n],settings:{bullet:`-`,rule:`-`}};export{r as default};
|
|
2
|
+
//# sourceMappingURL=remarkrc.js.map
|
package/dist/remarkrc.js.map
CHANGED
|
@@ -1,7 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/oxfmt-utils.ts", "../src/remark-lint-code-format.ts", "../src/remark-lint-mdx-jsx-format.ts", "../src/remark-preserve-alert-markers.ts", "../src/remarkrc.ts"],
|
|
4
|
-
"sourcesContent": ["// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport {readFile} from \"node:fs/promises\"\nimport {dirname, isAbsolute, join, parse, resolve} from \"node:path\"\nimport {pathToFileURL} from \"node:url\"\nimport {format as formatCode, type FormatConfig} from \"oxfmt\"\nimport {parseConfigFileTextToJson} from \"typescript\"\n\nconst CONFIG_FILENAMES = [\".oxfmtrc.json\", \".oxfmtrc.jsonc\", \"oxfmt.config.ts\"]\nconst configCache = new Map<string, Promise<FormatConfig>>()\n\nexport async function loadOxfmtConfig(\n filePath: string | undefined,\n): Promise<FormatConfig> {\n const basePath = getAbsolutePath(filePath)\n const startDir = parse(basePath).ext ? dirname(basePath) : basePath\n const cachedConfig = configCache.get(startDir)\n\n if (cachedConfig) {\n return cachedConfig\n }\n\n const configPromise = findOxfmtConfig(startDir).catch((error: unknown) => {\n configCache.delete(startDir)\n throw error\n })\n\n configCache.set(startDir, configPromise)\n\n return configPromise\n}\n\nexport async function formatOxfmt(\n filePath: string,\n value: string,\n config: FormatConfig,\n): Promise<null | string> {\n try {\n const result = await formatCode(filePath, value, config)\n\n if (result.errors.length > 0) {\n return null\n }\n\n return removeFinalEol(result.code)\n } catch {\n return null\n }\n}\n\nexport function getAbsolutePath(filePath: string | undefined): string {\n if (!filePath) {\n return process.cwd()\n }\n\n return isAbsolute(filePath) ? filePath : resolve(process.cwd(), filePath)\n}\n\nexport function getErrorMessage(error: unknown): string {\n if (error instanceof Error) {\n return error.message\n }\n\n return String(error)\n}\n\nasync function findOxfmtConfig(startDir: string): Promise<FormatConfig> {\n let currentDir = startDir\n\n while (true) {\n for (const configFilename of CONFIG_FILENAMES) {\n const configPath = join(currentDir, configFilename)\n const config = await readOxfmtConfig(configPath, configFilename)\n\n if (config) {\n return config\n }\n }\n\n const parentDir = dirname(currentDir)\n\n if (parentDir === currentDir) {\n return {}\n }\n\n currentDir = parentDir\n }\n}\n\nasync function readOxfmtConfig(\n configPath: string,\n configFilename: string,\n): Promise<FormatConfig | null> {\n if (configFilename === \"oxfmt.config.ts\") {\n return readTypeScriptConfig(configPath)\n }\n\n const source = await readOptionalFile(configPath)\n\n if (source === null) {\n return null\n }\n\n if (configFilename.endsWith(\".jsonc\")) {\n return validateConfig(configPath, readJsoncConfig(configPath, source))\n }\n\n return validateConfig(configPath, JSON.parse(source))\n}\n\nasync function readTypeScriptConfig(\n configPath: string,\n): Promise<FormatConfig | null> {\n const source = await readOptionalFile(configPath)\n\n if (source === null) {\n return null\n }\n\n const url = pathToFileURL(configPath)\n url.searchParams.set(\"cache\", Date.now().toString())\n\n const module = (await import(url.href)) as {default?: unknown}\n\n return validateConfig(configPath, module.default)\n}\n\nfunction readJsoncConfig(configPath: string, source: string): unknown {\n const result = parseConfigFileTextToJson(configPath, source)\n\n if (result.error) {\n throw new Error(String(result.error.messageText as string))\n }\n\n return result.config\n}\n\nfunction validateConfig(configPath: string, config: unknown): FormatConfig {\n if (!isPlainConfig(config)) {\n throw new Error(`${configPath} must define an object`)\n }\n\n return config as FormatConfig\n}\n\nasync function readOptionalFile(path: string): Promise<null | string> {\n try {\n return await readFile(path, \"utf8\")\n } catch (error) {\n if (isMissingFileError(error)) {\n return null\n }\n\n throw error\n }\n}\n\nfunction removeFinalEol(value: string): string {\n return value.replace(/\\r?\\n$/u, \"\")\n}\n\nfunction isPlainConfig(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value)\n}\n\nfunction isMissingFileError(error: unknown): boolean {\n if (typeof error !== \"object\" || error === null || !(\"code\" in error)) {\n return false\n }\n\n const {code} = error\n\n return code === \"ENOENT\" || code === \"ENOTDIR\"\n}\n", "// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport {\n formatOxfmt,\n getAbsolutePath,\n getErrorMessage,\n loadOxfmtConfig,\n} from \"./oxfmt-utils.js\"\nimport type {RemarkNode, RemarkTransformer} from \"./remark-types.js\"\n\ninterface CodeNode extends RemarkNode {\n lang?: string | null\n value: string\n}\n\nconst LANGUAGE_EXTENSIONS = new Map([\n [\"javascript\", \".js\"],\n [\"javascriptreact\", \".jsx\"],\n [\"js\", \".js\"],\n [\"jsx\", \".jsx\"],\n [\"ts\", \".ts\"],\n [\"tsx\", \".tsx\"],\n [\"typescript\", \".ts\"],\n [\"typescriptreact\", \".tsx\"],\n])\n\nexport default function remarkLintCodeFormat(): RemarkTransformer {\n return async function transform(tree, file) {\n let oxfmtConfig\n\n try {\n oxfmtConfig = await loadOxfmtConfig(file.path)\n } catch (error) {\n file.message(\n `Unable to load oxfmt config: ${getErrorMessage(error)}`,\n {column: 1, line: 1},\n \"remark-lint:code-format\",\n )\n return\n }\n\n const codeNodes: CodeNode[] = []\n visit<CodeNode>(tree, \"code\", (node) => {\n if (typeof node.value === \"string\") {\n codeNodes.push(node)\n }\n })\n\n for (const [index, node] of codeNodes.entries()) {\n const extension = getExtension(node.lang)\n\n if (!extension) {\n continue\n }\n\n const blockFilePath = getBlockFilePath(file.path, index, extension)\n\n if (isStandaloneJsxSnippet(extension, node.value)) {\n // Fenced TSX examples are not always complete TSX programs. Many docs\n // use them for JSX fragments, where Oxfmt would add ASI semicolons or\n // reflow comments if we wrapped the snippet. Real MDX JSX nodes are\n // handled separately by remark-lint-mdx-jsx-format.\n continue\n }\n\n const formatted = await formatOxfmt(\n blockFilePath,\n node.value,\n oxfmtConfig,\n )\n\n if (formatted === null) {\n continue\n }\n\n if (formatted !== node.value) {\n file.message(\n \"Format code block with oxfmt\",\n node,\n \"remark-lint:code-format\",\n )\n node.value = formatted\n }\n }\n }\n}\n\nfunction getBlockFilePath(\n filePath: string | undefined,\n index: number,\n extension: string,\n): string {\n return `${getAbsolutePath(filePath)}.${index}${extension}`\n}\n\nfunction getExtension(language: string | null | undefined): null | string {\n if (!language) {\n return null\n }\n\n const [name = \"\"] = language.trim().split(/\\s+/u)\n\n return LANGUAGE_EXTENSIONS.get(name.toLowerCase()) ?? null\n}\n\nfunction isStandaloneJsxSnippet(extension: string, value: string): boolean {\n return (\n (extension === \".jsx\" || extension === \".tsx\") &&\n /^<(?:>|\\/?[A-Za-z][\\w.:/-]*(?:[\\s>/]|$))/u.test(trimLeadingComments(value))\n )\n}\n\nfunction trimLeadingComments(value: string): string {\n let source = value.trimStart()\n\n while (true) {\n if (source.startsWith(\"//\")) {\n const nextLineIndex = source.indexOf(\"\\n\")\n\n if (nextLineIndex === -1) {\n return \"\"\n }\n\n source = source.slice(nextLineIndex + 1).trimStart()\n continue\n }\n\n if (source.startsWith(\"/*\")) {\n const commentEndIndex = source.indexOf(\"*/\")\n\n if (commentEndIndex === -1) {\n return source\n }\n\n source = source.slice(commentEndIndex + 2).trimStart()\n continue\n }\n\n return source\n }\n}\n\nfunction visit<T extends RemarkNode>(\n node: RemarkNode,\n type: string,\n callback: (node: T) => void,\n): void {\n if (node.type === type) {\n callback(node as T)\n }\n\n if (!Array.isArray(node.children)) {\n return\n }\n\n for (const child of node.children) {\n visit(child, type, callback)\n }\n}\n", "// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport type {FormatConfig} from \"oxfmt\"\n\nimport {\n formatOxfmt,\n getAbsolutePath,\n getErrorMessage,\n loadOxfmtConfig,\n} from \"./oxfmt-utils.js\"\nimport type {RemarkFile, RemarkNode, RemarkTransformer} from \"./remark-types.js\"\n\nexport default function remarkLintMdxJsxFormat(): RemarkTransformer {\n return async function transform(tree, file) {\n const source = getFileValue(file)\n\n if (!source) {\n return\n }\n\n let oxfmtConfig\n\n try {\n oxfmtConfig = await loadOxfmtConfig(file.path)\n } catch (error) {\n file.message(\n `Unable to load oxfmt config: ${getErrorMessage(error)}`,\n {column: 1, line: 1},\n \"remark-lint:mdx-jsx-format\",\n )\n await replaceMdxJsxFlowElements(tree, source, file.path, null, file)\n return\n }\n\n await replaceMdxJsxFlowElements(tree, source, file.path, oxfmtConfig, file)\n }\n}\n\nasync function replaceMdxJsxFlowElements(\n node: RemarkNode,\n source: string,\n filePath: string | undefined,\n config: FormatConfig | null,\n file: RemarkFile,\n): Promise<void> {\n if (!Array.isArray(node.children)) {\n return\n }\n\n const children: RemarkNode[] = []\n\n for (const child of node.children) {\n if (child.type === \"mdxJsxFlowElement\") {\n const raw = getSourceSlice(source, child)\n\n if (raw === null) {\n children.push(child)\n continue\n }\n\n const formatted =\n config === null || hasChildren(child)\n ? raw\n : await formatMdxJsxBlock(filePath, raw, config)\n\n if (formatted !== raw) {\n file.message(\n \"Format MDX JSX block\",\n child,\n \"remark-lint:mdx-jsx-format\",\n )\n }\n\n children.push({\n type: \"html\",\n value: formatted,\n })\n continue\n }\n\n await replaceMdxJsxFlowElements(child, source, filePath, config, file)\n children.push(child)\n }\n\n node.children = children\n}\n\nasync function formatMdxJsxBlock(\n filePath: string | undefined,\n value: string,\n config: FormatConfig,\n): Promise<string> {\n const formatted = await formatOxfmt(\n getBlockFilePath(filePath),\n wrapMdxJsxBlock(value),\n config,\n )\n\n if (formatted === null) {\n return value\n }\n\n return unwrapMdxJsxBlock(formatted) ?? value\n}\n\nfunction wrapMdxJsxBlock(value: string): string {\n return `const __mdx = (\n <>\n${value}\n </>\n)\n`\n}\n\nfunction unwrapMdxJsxBlock(value: string): null | string {\n const lines = value.split(/\\r?\\n/u)\n const openIndex = lines.findIndex((line) => line.trim() === \"<>\")\n const closeIndex = lines.findIndex(\n (line, index) => index > openIndex && line.trim() === \"</>\",\n )\n\n if (openIndex === -1 || closeIndex === -1 || closeIndex <= openIndex + 1) {\n return null\n }\n\n return lines\n .slice(openIndex + 1, closeIndex)\n .map((line) => (line.startsWith(\" \") ? line.slice(4) : line))\n .join(\"\\n\")\n}\n\nfunction getSourceSlice(source: string, node: RemarkNode): null | string {\n const start = node.position?.start?.offset\n const end = node.position?.end?.offset\n\n if (typeof start !== \"number\" || typeof end !== \"number\") {\n return null\n }\n\n return source.slice(start, end)\n}\n\nfunction getFileValue(file: RemarkFile): string {\n return (file.value ?? \"\") as string\n}\n\nfunction getBlockFilePath(filePath: string | undefined): string {\n return `${getAbsolutePath(filePath)}.jsx.tsx`\n}\n\nfunction hasChildren(node: RemarkNode): boolean {\n return Array.isArray(node.children) && node.children.length > 0\n}\n", "// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport type {Processor} from \"unified\"\n\ninterface MarkdownExtension {\n handlers?: {\n text?: MarkdownHandler\n }\n}\n\ninterface MarkdownInfo {\n after?: string\n before?: string\n}\n\ninterface MarkdownNode {\n type: string\n value: string\n}\n\ninterface MarkdownParent {\n children?: MarkdownNode[]\n type: string\n}\n\ninterface MarkdownState {\n safe: (value: string, info: MarkdownInfo) => string\n stack: string[]\n}\n\ninterface MarkdownProcessorData {\n toMarkdownExtensions?: MarkdownExtension[]\n}\n\ntype MarkdownHandler = (\n node: MarkdownNode,\n parent: MarkdownParent | undefined,\n state: MarkdownState,\n info: MarkdownInfo,\n) => string\n\nconst ALERT_MARKER_PATTERN =\n /^\\\\?\\[!(?:note|tip|success|warning|caution)(?:\\/[^\\]\\n]+)?\\]/iu\n\nexport default function remarkPreserveAlertMarkers(this: Processor): void {\n const extensions = getToMarkdownExtensions(this)\n\n // mdx/remark fixes reserialize the whole file. Register with the markdown\n // stringifier so alert markers keep the syntax consumed by the docs runtime.\n const data = this.data() as MarkdownProcessorData\n data.toMarkdownExtensions = [\n ...extensions,\n {\n handlers: {\n text: preserveAlertMarkerText,\n },\n },\n ]\n}\n\nfunction preserveAlertMarkerText(\n node: MarkdownNode,\n parent: MarkdownParent | undefined,\n state: MarkdownState,\n info: MarkdownInfo,\n): string {\n const value = state.safe(node.value, info)\n\n if (!isAlertMarkerText(node, parent, state)) {\n return value\n }\n\n return value.replace(/^\\\\(?=\\[!)/u, \"\")\n}\n\nfunction isAlertMarkerText(\n node: MarkdownNode,\n parent: MarkdownParent | undefined,\n state: MarkdownState,\n): boolean {\n return (\n parent?.type === \"paragraph\" &&\n parent.children?.[0] === node &&\n state.stack.includes(\"blockquote\") &&\n ALERT_MARKER_PATTERN.test(node.value)\n )\n}\n\nfunction getToMarkdownExtensions(processor: Processor): MarkdownExtension[] {\n const {toMarkdownExtensions} = processor.data() as MarkdownProcessorData\n\n return Array.isArray(toMarkdownExtensions) ? toMarkdownExtensions : []\n}\n", "// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport remarkLintCodeFormat from \"./remark-lint-code-format.js\"\nimport remarkLintMdxJsxFormat from \"./remark-lint-mdx-jsx-format.js\"\nimport remarkPreserveAlertMarkers from \"./remark-preserve-alert-markers.js\"\n\nconst remarkConfig = {\n plugins: [\n \"remark-frontmatter\",\n \"remark-lint-fenced-code-flag\",\n \"remark-lint-final-newline\",\n \"remark-lint-heading-increment\",\n \"remark-lint-list-item-content-indent\",\n [\"remark-lint-list-item-indent\", \"one\"],\n [\"remark-lint-maximum-heading-length\", {size: 80}],\n \"remark-lint-no-consecutive-blank-lines\",\n \"remark-lint-no-duplicate-headings-in-section\",\n [\"remark-lint-no-heading-punctuation\", \",.:;\"],\n [\"remark-lint-unordered-list-marker-style\", \"-\"],\n remarkLintCodeFormat,\n remarkLintMdxJsxFormat,\n remarkPreserveAlertMarkers,\n ],\n settings: {\n bullet: \"-\",\n rule: \"-\",\n },\n}\n\nexport default remarkConfig\n"],
|
|
5
|
-
"mappings": ";AAGA,SAAQ,gBAAe;AACvB,SAAQ,SAAS,YAAY,MAAM,OAAO,eAAc;AACxD,SAAQ,qBAAoB;AAC5B,SAAQ,UAAU,kBAAoC;AACtD,SAAQ,iCAAgC;A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A,IACR,MAAM;AAAA,EACR;AACF;AAEA,IAAO,mBAAQ;",
|
|
6
|
-
"names": ["getBlockFilePath"]
|
|
7
|
-
}
|
|
1
|
+
{"version":3,"file":"remarkrc.js","names":[],"sources":["../src/remarkrc.ts"],"sourcesContent":["// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport remarkLintCodeFormat from \"./remark-lint-code-format.js\"\nimport remarkLintMdxJsxFormat from \"./remark-lint-mdx-jsx-format.js\"\nimport remarkPreserveAlertMarkers from \"./remark-preserve-alert-markers.js\"\n\nconst remarkConfig: any = {\n plugins: [\n \"remark-frontmatter\",\n \"remark-lint-fenced-code-flag\",\n \"remark-lint-final-newline\",\n \"remark-lint-heading-increment\",\n \"remark-lint-list-item-content-indent\",\n [\"remark-lint-list-item-indent\", \"one\"],\n [\"remark-lint-maximum-heading-length\", {size: 80}],\n \"remark-lint-no-consecutive-blank-lines\",\n \"remark-lint-no-duplicate-headings-in-section\",\n [\"remark-lint-no-heading-punctuation\", \",.:;\"],\n [\"remark-lint-unordered-list-marker-style\", \"-\"],\n remarkLintCodeFormat,\n remarkLintMdxJsxFormat,\n remarkPreserveAlertMarkers,\n ],\n settings: {\n bullet: \"-\",\n rule: \"-\",\n },\n}\n\nexport default remarkConfig\n"],"mappings":"6IAOA,IAAM,EAAoB,CACxB,QAAS,CACP,qBACA,+BACA,4BACA,gCACA,uCACA,CAAC,+BAAgC,MAAM,CACvC,CAAC,qCAAsC,CAAC,KAAM,GAAG,CAAC,CAClD,yCACA,+CACA,CAAC,qCAAsC,OAAO,CAC9C,CAAC,0CAA2C,IAAI,CAChD,EACA,EACA,EACD,CACD,SAAU,CACR,OAAQ,IACR,KAAM,IACP,CACF"}
|
package/package.json
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qualcomm-ui/eslint-config-mdx",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.3",
|
|
4
4
|
"description": "QUI ESLint config for consistent MDX code",
|
|
5
|
-
"author": "Ryan Bower",
|
|
6
|
-
"license": "BSD-3-Clause-Clear",
|
|
7
|
-
"repository": "https://github.com/qualcomm/qualcomm-ui",
|
|
8
|
-
"publishConfig": {
|
|
9
|
-
"access": "public"
|
|
10
|
-
},
|
|
11
5
|
"keywords": [
|
|
12
6
|
"config",
|
|
13
7
|
"eslint",
|
|
14
8
|
"react"
|
|
15
9
|
],
|
|
16
|
-
"
|
|
17
|
-
"
|
|
10
|
+
"license": "BSD-3-Clause-Clear",
|
|
11
|
+
"author": "Ryan Bower",
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "https://github.com/qualcomm/qualcomm-ui"
|
|
15
|
+
},
|
|
18
16
|
"files": [
|
|
19
17
|
"dist/",
|
|
20
18
|
".remarkrc"
|
|
21
19
|
],
|
|
20
|
+
"type": "module",
|
|
21
|
+
"sideEffects": false,
|
|
22
22
|
"types": "./dist/index.d.ts",
|
|
23
23
|
"exports": {
|
|
24
24
|
".": {
|
|
@@ -47,6 +47,9 @@
|
|
|
47
47
|
"default": "./dist/remark-preserve-alert-markers.js"
|
|
48
48
|
}
|
|
49
49
|
},
|
|
50
|
+
"publishConfig": {
|
|
51
|
+
"access": "public"
|
|
52
|
+
},
|
|
50
53
|
"peerDependencies": {
|
|
51
54
|
"eslint": ">=9.37.0",
|
|
52
55
|
"eslint-mdx": ">=3.7.0",
|