mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-01 17:57:36 +08:00
This CL adds the eslint-plugin-jsdoc plugin and enables just one rule, `jsdoc/check-alignment`, which ensures that all the lines in a comment are correctly aligned. For example: ``` /** * foo * bar */ ``` Would fail the check and be corrected to: ``` /** * foo * bar */ ``` DISABLE_THIRD_PARTY_CHECK=deliberate install + use of eslint-plugin-jsdoc node_module Bug: none Change-Id: I969983cd550653654a334ede3409b8c850467245 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/4110906 Commit-Queue: Andres Olivares <andoli@chromium.org> Reviewed-by: Andres Olivares <andoli@chromium.org> Auto-Submit: Jack Franklin <jacktfranklin@chromium.org> Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
66 lines
1.7 KiB
JavaScript
66 lines
1.7 KiB
JavaScript
"use strict";
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
|
|
const primitives_1 = require("../primitives.cjs");
|
|
|
|
const util_1 = require("../util.cjs");
|
|
|
|
const block_parser_1 = require("./block-parser.cjs");
|
|
|
|
const source_parser_1 = require("./source-parser.cjs");
|
|
|
|
const spec_parser_1 = require("./spec-parser.cjs");
|
|
|
|
const tag_1 = require("./tokenizers/tag.cjs");
|
|
|
|
const type_1 = require("./tokenizers/type.cjs");
|
|
|
|
const name_1 = require("./tokenizers/name.cjs");
|
|
|
|
const description_1 = require("./tokenizers/description.cjs");
|
|
|
|
function getParser({
|
|
startLine = 0,
|
|
fence = '```',
|
|
spacing = 'compact',
|
|
markers = primitives_1.Markers,
|
|
tokenizers = [tag_1.default(), type_1.default(spacing), name_1.default(), description_1.default(spacing)]
|
|
} = {}) {
|
|
if (startLine < 0 || startLine % 1 > 0) throw new Error('Invalid startLine');
|
|
const parseSource = source_parser_1.default({
|
|
startLine,
|
|
markers
|
|
});
|
|
const parseBlock = block_parser_1.default({
|
|
fence
|
|
});
|
|
const parseSpec = spec_parser_1.default({
|
|
tokenizers
|
|
});
|
|
const joinDescription = description_1.getJoiner(spacing);
|
|
return function (source) {
|
|
const blocks = [];
|
|
|
|
for (const line of util_1.splitLines(source)) {
|
|
const lines = parseSource(line);
|
|
if (lines === null) continue;
|
|
const sections = parseBlock(lines);
|
|
const specs = sections.slice(1).map(parseSpec);
|
|
blocks.push({
|
|
description: joinDescription(sections[0], markers),
|
|
tags: specs,
|
|
source: lines,
|
|
problems: specs.reduce((acc, spec) => acc.concat(spec.problems), [])
|
|
});
|
|
}
|
|
|
|
return blocks;
|
|
};
|
|
}
|
|
|
|
exports.default = getParser;
|
|
//# sourceMappingURL=index.cjs.map
|