feat(markdown): add `proseWrap: "preserve"` option (#3340)
* test: add test case * feat(markdown): add `proseWrap: "preserve"` option * test: add tests * docs(options): update `proseWrap` * feat(markdown): change default to `proseWrap: "preserve"` BREAKING CHANGE * docs(options): update `proseWrap` * test: specify option explicitly * Fix lint after merge * Fix error after mergemaster
parent
d52d721cd1
commit
073c0b16d8
|
@ -205,8 +205,14 @@ Prettier can insert a special @format marker at the top of files specifying that
|
|||
|
||||
_available in v1.8.2+_
|
||||
|
||||
By default, Prettier will wrap markdown text at the specified print width. In some cases you may want to rely on editor/viewer soft wrapping instead, so this option allows you to opt out. When prose wrapping is disabled, each paragraph will be printed on its own line.
|
||||
By default, Prettier will wrap markdown text as-is since some services use a linebreak-sensitive renderer, e.g. GitHub comment and BitBucket. In some cases you may want to rely on editor/viewer soft wrapping instead, so this option allows you to opt out with `"never"`.
|
||||
|
||||
| Default | CLI Override | API Override |
|
||||
| ------- | ----------------- | ------------------- |
|
||||
| `true` | `--no-prose-wrap` | `proseWrap: <bool>` |
|
||||
Valid options:
|
||||
|
||||
* `"always"` - Wrap prose if it exceeds the print width.
|
||||
* `"never"` - Do not wrap prose.
|
||||
* `"preserve"` - Wrap prose as-is. _available in v1.9.0+_
|
||||
|
||||
| Default | CLI Override | API Override |
|
||||
| ------------ | ----------------------------------------------------------- | ----------------------------------------------------------- |
|
||||
| `"preserve"` | <code>--prose-wrap <always|never|preserve></code> | <code>proseWrap: "<always|never|preserve>"</code> |
|
||||
|
|
|
@ -63,6 +63,10 @@ function massageAST(ast, parent) {
|
|||
if (ast.type === "code") {
|
||||
delete newObj.value;
|
||||
}
|
||||
// for markdown whitespace: "\n" and " " are considered the same
|
||||
if (ast.type === "whitespace" && ast.value === "\n") {
|
||||
newObj.value = " ";
|
||||
}
|
||||
|
||||
if (
|
||||
ast.type === "media-query" ||
|
||||
|
|
|
@ -237,11 +237,19 @@ const detailedOptions = normalizeDetailedOptions({
|
|||
description: "The line length where Prettier will try wrap."
|
||||
},
|
||||
"prose-wrap": {
|
||||
type: "boolean",
|
||||
type: "choice",
|
||||
category: CATEGORY_FORMAT,
|
||||
forwardToApi: true,
|
||||
description: "Wrap prose if it exceeds the print width. (markdown)",
|
||||
oppositeDescription: "Do not wrap prose. (markdown)"
|
||||
description: "How to wrap prose. (markdown)",
|
||||
choices: [
|
||||
{
|
||||
value: "always",
|
||||
description: "Wrap prose if it exceeds the print width."
|
||||
},
|
||||
{ value: "never", description: "Do not wrap prose." },
|
||||
{ value: "preserve", description: "Wrap prose as-is." },
|
||||
{ value: false, deprecated: true, redirect: "never" }
|
||||
]
|
||||
},
|
||||
"range-end": {
|
||||
type: "int",
|
||||
|
|
|
@ -21,7 +21,7 @@ const defaults = {
|
|||
insertPragma: false,
|
||||
requirePragma: false,
|
||||
semi: true,
|
||||
proseWrap: true,
|
||||
proseWrap: "preserve",
|
||||
arrowParens: "avoid"
|
||||
};
|
||||
|
||||
|
@ -72,6 +72,16 @@ function normalize(options) {
|
|||
);
|
||||
}
|
||||
|
||||
/* istanbul ignore if */
|
||||
if (typeof normalized.proseWrap === "boolean") {
|
||||
normalized.proseWrap = normalized.proseWrap ? "always" : "never";
|
||||
|
||||
console.warn(
|
||||
"Warning: `proseWrap` with boolean value is deprecated. " +
|
||||
'Use "always", "never", or "preserve" instead.'
|
||||
);
|
||||
}
|
||||
|
||||
/* istanbul ignore if */
|
||||
if (normalized.parser === "postcss") {
|
||||
normalized.parser = "css";
|
||||
|
|
|
@ -60,7 +60,7 @@ function genericPrint(path, options, print) {
|
|||
node =>
|
||||
node.type === "word"
|
||||
? node.value
|
||||
: node.value === "" ? "" : printLine(path, line, options)
|
||||
: node.value === "" ? "" : printLine(path, node.value, options)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -99,12 +99,13 @@ function genericPrint(path, options, print) {
|
|||
const index = parentNode.children.indexOf(node);
|
||||
const nextNode = parentNode.children[index + 1];
|
||||
|
||||
// leading char that may cause different syntax
|
||||
if (nextNode && /^>|^([-+*]|#{1,6}|[0-9]+[.)])$/.test(nextNode.value)) {
|
||||
return node.value === "" ? "" : " ";
|
||||
}
|
||||
const proseWrap =
|
||||
// leading char that may cause different syntax
|
||||
nextNode && /^>|^([-+*]|#{1,6}|[0-9]+[.)])$/.test(nextNode.value)
|
||||
? "never"
|
||||
: options.proseWrap;
|
||||
|
||||
return printLine(path, node.value === "" ? softline : line, options);
|
||||
return printLine(path, node.value, { proseWrap });
|
||||
}
|
||||
case "emphasis": {
|
||||
const parentNode = path.getParentNode();
|
||||
|
@ -367,10 +368,15 @@ function getAncestorNode(path, typeOrTypes) {
|
|||
return counter === -1 ? null : path.getParentNode(counter);
|
||||
}
|
||||
|
||||
function printLine(path, lineOrSoftline, options) {
|
||||
function printLine(path, value, options) {
|
||||
if (options.proseWrap === "preserve" && value === "\n") {
|
||||
return hardline;
|
||||
}
|
||||
|
||||
const isBreakable =
|
||||
options.proseWrap && !getAncestorNode(path, SINGLE_LINE_NODE_TYPES);
|
||||
return lineOrSoftline === line
|
||||
options.proseWrap === "always" &&
|
||||
!getAncestorNode(path, SINGLE_LINE_NODE_TYPES);
|
||||
return value !== ""
|
||||
? isBreakable ? line : " "
|
||||
: isBreakable ? softline : "";
|
||||
}
|
||||
|
|
|
@ -672,7 +672,7 @@ function mapDoc(doc, callback) {
|
|||
/**
|
||||
* split text into whitespaces and words
|
||||
* @param {string} text
|
||||
* @return {Array<{ type: "whitespace", value: " " | "" } | { type: "word", value: string }>}
|
||||
* @return {Array<{ type: "whitespace", value: " " | "\n" | "" } | { type: "word", value: string }>}
|
||||
*/
|
||||
function splitText(text) {
|
||||
const KIND_NON_CJK = "non-cjk";
|
||||
|
@ -687,7 +687,10 @@ function splitText(text) {
|
|||
.forEach((token, index, tokens) => {
|
||||
// whitespace
|
||||
if (index % 2 === 1) {
|
||||
nodes.push({ type: "whitespace", value: " " });
|
||||
nodes.push({
|
||||
type: "whitespace",
|
||||
value: /\n/.test(token) ? "\n" : " "
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
run_spec(__dirname, ["markdown"]);
|
||||
run_spec(__dirname, ["markdown"], { proseWrap: "always" });
|
||||
|
|
|
@ -1 +1 @@
|
|||
run_spec(__dirname, ["markdown"]);
|
||||
run_spec(__dirname, ["markdown"], { proseWrap: "always" });
|
||||
|
|
|
@ -1 +1 @@
|
|||
run_spec(__dirname, ["markdown"]);
|
||||
run_spec(__dirname, ["markdown"], { proseWrap: "always" });
|
||||
|
|
|
@ -1 +1 @@
|
|||
run_spec(__dirname, ["markdown"]);
|
||||
run_spec(__dirname, ["markdown"], { proseWrap: "always" });
|
||||
|
|
|
@ -1 +1 @@
|
|||
run_spec(__dirname, ["markdown"]);
|
||||
run_spec(__dirname, ["markdown"], { proseWrap: "always" });
|
||||
|
|
|
@ -1 +1 @@
|
|||
run_spec(__dirname, ["markdown"]);
|
||||
run_spec(__dirname, ["markdown"], { proseWrap: "always" });
|
||||
|
|
|
@ -1 +1 @@
|
|||
run_spec(__dirname, ["markdown"]);
|
||||
run_spec(__dirname, ["markdown"], { proseWrap: "always" });
|
||||
|
|
|
@ -1 +1 @@
|
|||
run_spec(__dirname, ["markdown"]);
|
||||
run_spec(__dirname, ["markdown"], { proseWrap: "always" });
|
||||
|
|
|
@ -1 +1 @@
|
|||
run_spec(__dirname, ["markdown"]);
|
||||
run_spec(__dirname, ["markdown"], { proseWrap: "always" });
|
||||
|
|
|
@ -1 +1 @@
|
|||
run_spec(__dirname, ["markdown"]);
|
||||
run_spec(__dirname, ["markdown"], { proseWrap: "always" });
|
||||
|
|
|
@ -1 +1 @@
|
|||
run_spec(__dirname, ["markdown"]);
|
||||
run_spec(__dirname, ["markdown"], { proseWrap: "always" });
|
||||
|
|
|
@ -1 +1 @@
|
|||
run_spec(__dirname, ["markdown"]);
|
||||
run_spec(__dirname, ["markdown"], { proseWrap: "always" });
|
||||
|
|
|
@ -1 +1 @@
|
|||
run_spec(__dirname, ["markdown"]);
|
||||
run_spec(__dirname, ["markdown"], { proseWrap: "always" });
|
||||
|
|
|
@ -1 +1 @@
|
|||
run_spec(__dirname, ["markdown"]);
|
||||
run_spec(__dirname, ["markdown"], { proseWrap: "always" });
|
||||
|
|
|
@ -1 +1 @@
|
|||
run_spec(__dirname, ["markdown"]);
|
||||
run_spec(__dirname, ["markdown"], { proseWrap: "always" });
|
||||
|
|
|
@ -1 +1 @@
|
|||
run_spec(__dirname, ["markdown"], { useTabs: true });
|
||||
run_spec(__dirname, ["markdown"], { proseWrap: "always", useTabs: true });
|
||||
|
|
|
@ -1 +1 @@
|
|||
run_spec(__dirname, ["markdown"]);
|
||||
run_spec(__dirname, ["markdown"], { proseWrap: "always" });
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
run_spec(__dirname, ["markdown"], { semi: true });
|
||||
run_spec(__dirname, ["markdown"], { semi: false });
|
||||
run_spec(__dirname, ["markdown"], { semi: true, proseWrap: "always" });
|
||||
run_spec(__dirname, ["markdown"], { semi: false, proseWrap: "always" });
|
||||
|
|
|
@ -1 +1 @@
|
|||
run_spec(__dirname, ["markdown"]);
|
||||
run_spec(__dirname, ["markdown"], { proseWrap: "always" });
|
||||
|
|
|
@ -1 +1 @@
|
|||
run_spec(__dirname, ["markdown"]);
|
||||
run_spec(__dirname, ["markdown"], { proseWrap: "always" });
|
||||
|
|
|
@ -1 +1 @@
|
|||
run_spec(__dirname, ["markdown"]);
|
||||
run_spec(__dirname, ["markdown"], { proseWrap: "always" });
|
||||
|
|
|
@ -65,6 +65,33 @@ This ia an english paragraph with a CJK quote “中文“.
|
|||
|
||||
`;
|
||||
|
||||
exports[`cjk.md 3`] = `
|
||||
這是一段很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長的段落
|
||||
|
||||
這是一個English混合著中文的一段Paragraph!這是一個English混合著中文的一段Paragraph!這是一個English混合著中文的一段Paragraph!這是一個English混合著中文的一段Paragraph!這是一個English混合著中文的一段Paragraph!這是一個English混合著中文的一段Paragraph!這是一個English混合著中文的一段Paragraph!這是一個English混合著中文的一段Paragraph!這是一個English混合著中文的一段Paragraph!這是一個English混合著中文的一段Paragraph!這是一個English混合著中文的一段Paragraph!這是一個English混合著中文的一段Paragraph!這是一個English混合著中文的一段Paragraph!這是一個English混合著中文的一段Paragraph!這是一個English混合著中文的一段Paragraph!這是一個English混合著中文的一段Paragraph!
|
||||
|
||||
全 形 空白全 形 空白全 形 空白全 形 空白全 形 空白全 形 空白全 形 空白全 形 空白
|
||||
|
||||
This ia an english paragraph with a CJK quote "中文".
|
||||
|
||||
This ia an english paragraph with a CJK quote “中文“.
|
||||
|
||||
扩展运算符(spread)是三个点(\`...\`)。
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
這是一段很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長很長的段落
|
||||
|
||||
這是一個 English 混合著中文的一段 Paragraph!這是一個 English 混合著中文的一段 Paragraph!這是一個 English 混合著中文的一段 Paragraph!這是一個 English 混合著中文的一段 Paragraph!這是一個 English 混合著中文的一段 Paragraph!這是一個 English 混合著中文的一段 Paragraph!這是一個 English 混合著中文的一段 Paragraph!這是一個 English 混合著中文的一段 Paragraph!這是一個 English 混合著中文的一段 Paragraph!這是一個 English 混合著中文的一段 Paragraph!這是一個 English 混合著中文的一段 Paragraph!這是一個 English 混合著中文的一段 Paragraph!這是一個 English 混合著中文的一段 Paragraph!這是一個 English 混合著中文的一段 Paragraph!這是一個 English 混合著中文的一段 Paragraph!這是一個 English 混合著中文的一段 Paragraph!
|
||||
|
||||
全 形 空白全 形 空白全 形 空白全 形 空白全 形 空白全 形 空白全 形 空白全 形 空白
|
||||
|
||||
This ia an english paragraph with a CJK quote "中文".
|
||||
|
||||
This ia an english paragraph with a CJK quote “中文“.
|
||||
|
||||
扩展运算符(spread)是三个点(\`...\`)。
|
||||
|
||||
`;
|
||||
|
||||
exports[`inline-nodes.md 1`] = `
|
||||
It removes all original styling[*](#styling-footnote) and ensures that all outputted code conforms to a consistent style. (See this [blog post](http://jlongster.com/A-Prettier-Formatter))
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
@ -81,6 +108,84 @@ It removes all original styling[\\*](#styling-footnote) and ensures that all out
|
|||
|
||||
`;
|
||||
|
||||
exports[`inline-nodes.md 3`] = `
|
||||
It removes all original styling[*](#styling-footnote) and ensures that all outputted code conforms to a consistent style. (See this [blog post](http://jlongster.com/A-Prettier-Formatter))
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
It removes all original styling[\\*](#styling-footnote) and ensures that all outputted code conforms to a consistent style. (See this [blog post](http://jlongster.com/A-Prettier-Formatter))
|
||||
|
||||
`;
|
||||
|
||||
exports[`lorem.md 1`] = `
|
||||
Hic dicta et recusandae incidunt. Reiciendis saepe voluptatem tempore rem aut.
|
||||
Iusto sapiente impedit. Laudantium ut id non et aperiam ab.
|
||||
|
||||
Sit minus architecto quas quibusdam sed ipsam aut eum.
|
||||
Dolores tempora reiciendis magni blanditiis laborum aliquid rem corporis enim. Et consectetur quo sed excepturi soluta repudiandae commodi id.
|
||||
Eum possimus optio distinctio incidunt quasi optio culpa accusamus.
|
||||
Architecto esse ut aut autem ullam consequatur reiciendis aliquid dolorum.
|
||||
|
||||
Et quam mollitia velit iste enim exercitationem nemo.
|
||||
Hic dignissimos eos et. Eos eos consequatur.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Hic dicta et recusandae incidunt. Reiciendis saepe voluptatem tempore rem aut.
|
||||
Iusto sapiente impedit. Laudantium ut id non et aperiam ab.
|
||||
|
||||
Sit minus architecto quas quibusdam sed ipsam aut eum. Dolores tempora
|
||||
reiciendis magni blanditiis laborum aliquid rem corporis enim. Et consectetur
|
||||
quo sed excepturi soluta repudiandae commodi id. Eum possimus optio distinctio
|
||||
incidunt quasi optio culpa accusamus. Architecto esse ut aut autem ullam
|
||||
consequatur reiciendis aliquid dolorum.
|
||||
|
||||
Et quam mollitia velit iste enim exercitationem nemo. Hic dignissimos eos et.
|
||||
Eos eos consequatur.
|
||||
|
||||
`;
|
||||
|
||||
exports[`lorem.md 2`] = `
|
||||
Hic dicta et recusandae incidunt. Reiciendis saepe voluptatem tempore rem aut.
|
||||
Iusto sapiente impedit. Laudantium ut id non et aperiam ab.
|
||||
|
||||
Sit minus architecto quas quibusdam sed ipsam aut eum.
|
||||
Dolores tempora reiciendis magni blanditiis laborum aliquid rem corporis enim. Et consectetur quo sed excepturi soluta repudiandae commodi id.
|
||||
Eum possimus optio distinctio incidunt quasi optio culpa accusamus.
|
||||
Architecto esse ut aut autem ullam consequatur reiciendis aliquid dolorum.
|
||||
|
||||
Et quam mollitia velit iste enim exercitationem nemo.
|
||||
Hic dignissimos eos et. Eos eos consequatur.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Hic dicta et recusandae incidunt. Reiciendis saepe voluptatem tempore rem aut. Iusto sapiente impedit. Laudantium ut id non et aperiam ab.
|
||||
|
||||
Sit minus architecto quas quibusdam sed ipsam aut eum. Dolores tempora reiciendis magni blanditiis laborum aliquid rem corporis enim. Et consectetur quo sed excepturi soluta repudiandae commodi id. Eum possimus optio distinctio incidunt quasi optio culpa accusamus. Architecto esse ut aut autem ullam consequatur reiciendis aliquid dolorum.
|
||||
|
||||
Et quam mollitia velit iste enim exercitationem nemo. Hic dignissimos eos et. Eos eos consequatur.
|
||||
|
||||
`;
|
||||
|
||||
exports[`lorem.md 3`] = `
|
||||
Hic dicta et recusandae incidunt. Reiciendis saepe voluptatem tempore rem aut.
|
||||
Iusto sapiente impedit. Laudantium ut id non et aperiam ab.
|
||||
|
||||
Sit minus architecto quas quibusdam sed ipsam aut eum.
|
||||
Dolores tempora reiciendis magni blanditiis laborum aliquid rem corporis enim. Et consectetur quo sed excepturi soluta repudiandae commodi id.
|
||||
Eum possimus optio distinctio incidunt quasi optio culpa accusamus.
|
||||
Architecto esse ut aut autem ullam consequatur reiciendis aliquid dolorum.
|
||||
|
||||
Et quam mollitia velit iste enim exercitationem nemo.
|
||||
Hic dignissimos eos et. Eos eos consequatur.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Hic dicta et recusandae incidunt. Reiciendis saepe voluptatem tempore rem aut.
|
||||
Iusto sapiente impedit. Laudantium ut id non et aperiam ab.
|
||||
|
||||
Sit minus architecto quas quibusdam sed ipsam aut eum.
|
||||
Dolores tempora reiciendis magni blanditiis laborum aliquid rem corporis enim. Et consectetur quo sed excepturi soluta repudiandae commodi id.
|
||||
Eum possimus optio distinctio incidunt quasi optio culpa accusamus.
|
||||
Architecto esse ut aut autem ullam consequatur reiciendis aliquid dolorum.
|
||||
|
||||
Et quam mollitia velit iste enim exercitationem nemo.
|
||||
Hic dignissimos eos et. Eos eos consequatur.
|
||||
|
||||
`;
|
||||
|
||||
exports[`simple.md 1`] = `
|
||||
This is a long long long long long long long long long long long long long long long paragraph.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
@ -96,6 +201,13 @@ This is a long long long long long long long long long long long long long long
|
|||
|
||||
`;
|
||||
|
||||
exports[`simple.md 3`] = `
|
||||
This is a long long long long long long long long long long long long long long long paragraph.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
This is a long long long long long long long long long long long long long long long paragraph.
|
||||
|
||||
`;
|
||||
|
||||
exports[`special-prefix.md 1`] = `
|
||||
abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc - abc abc abc
|
||||
|
||||
|
@ -195,6 +307,53 @@ She grew up in an isolated village in the 19th century and met her father aged 2
|
|||
|
||||
`;
|
||||
|
||||
exports[`special-prefix.md 3`] = `
|
||||
abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc - abc abc abc
|
||||
|
||||
## Supported Rules
|
||||
|
||||
- [no-disabled-tests](/packages/eslint-plugin-jest/docs/rules/no-disabled-tests.md) - disallow disabled tests.
|
||||
- [no-focused-tests](/packages/eslint-plugin-jest/docs/rules/no-focused-tests.md) - disallow focused tests.
|
||||
- [no-identical-title](/packages/eslint-plugin-jest/docs/rules/no-identical-title.md) - disallow identical titles.
|
||||
- [valid-expect](/packages/eslint-plugin-jest/docs/rules/valid-expect.md) - ensure expect is called correctly.
|
||||
|
||||
## Supported Rules
|
||||
|
||||
* [no-disabled-tests](/packages/eslint-plugin-jest/docs/rules/no-disabled-tests.md)
|
||||
- disallow disabled tests.
|
||||
* [no-focused-tests](/packages/eslint-plugin-jest/docs/rules/no-focused-tests.md)
|
||||
- disallow focused tests.
|
||||
* [no-identical-title](/packages/eslint-plugin-jest/docs/rules/no-identical-title.md)
|
||||
- disallow identical titles.
|
||||
* [valid-expect](/packages/eslint-plugin-jest/docs/rules/valid-expect.md) -
|
||||
ensure expect is called correctly.
|
||||
|
||||
She grew up in an isolated village in the 19th century and met her father aged 29. Oh no, why are we in a numbered list now?
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc - abc abc abc
|
||||
|
||||
## Supported Rules
|
||||
|
||||
* [no-disabled-tests](/packages/eslint-plugin-jest/docs/rules/no-disabled-tests.md) - disallow disabled tests.
|
||||
* [no-focused-tests](/packages/eslint-plugin-jest/docs/rules/no-focused-tests.md) - disallow focused tests.
|
||||
* [no-identical-title](/packages/eslint-plugin-jest/docs/rules/no-identical-title.md) - disallow identical titles.
|
||||
* [valid-expect](/packages/eslint-plugin-jest/docs/rules/valid-expect.md) - ensure expect is called correctly.
|
||||
|
||||
## Supported Rules
|
||||
|
||||
* [no-disabled-tests](/packages/eslint-plugin-jest/docs/rules/no-disabled-tests.md)
|
||||
* disallow disabled tests.
|
||||
* [no-focused-tests](/packages/eslint-plugin-jest/docs/rules/no-focused-tests.md)
|
||||
* disallow focused tests.
|
||||
* [no-identical-title](/packages/eslint-plugin-jest/docs/rules/no-identical-title.md)
|
||||
* disallow identical titles.
|
||||
* [valid-expect](/packages/eslint-plugin-jest/docs/rules/valid-expect.md) -
|
||||
ensure expect is called correctly.
|
||||
|
||||
She grew up in an isolated village in the 19th century and met her father aged 29. Oh no, why are we in a numbered list now?
|
||||
|
||||
`;
|
||||
|
||||
exports[`whitespace.md 1`] = `
|
||||
<!-- 0xA0 non-breaking whitespace -->
|
||||
|
||||
|
@ -233,3 +392,22 @@ keep these words together keep these words together keep these words
|
|||
keep these words together keep these words together keep these words together keep these words together
|
||||
|
||||
`;
|
||||
|
||||
exports[`whitespace.md 3`] = `
|
||||
<!-- 0xA0 non-breaking whitespace -->
|
||||
|
||||
keep these words together keep these words together keep these words together keep these words together
|
||||
|
||||
<!-- 0x20 standard whitespace -->
|
||||
|
||||
keep these words together keep these words together keep these words together keep these words together
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
<!-- 0xA0 non-breaking whitespace -->
|
||||
|
||||
keep these words together keep these words together keep these words together keep these words together
|
||||
|
||||
<!-- 0x20 standard whitespace -->
|
||||
|
||||
keep these words together keep these words together keep these words together keep these words together
|
||||
|
||||
`;
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
run_spec(__dirname, ["markdown"]);
|
||||
run_spec(__dirname, ["markdown"], { proseWrap: false });
|
||||
run_spec(__dirname, ["markdown"], { proseWrap: "always" });
|
||||
run_spec(__dirname, ["markdown"], { proseWrap: "never" });
|
||||
run_spec(__dirname, ["markdown"], { proseWrap: "preserve" });
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
Hic dicta et recusandae incidunt. Reiciendis saepe voluptatem tempore rem aut.
|
||||
Iusto sapiente impedit. Laudantium ut id non et aperiam ab.
|
||||
|
||||
Sit minus architecto quas quibusdam sed ipsam aut eum.
|
||||
Dolores tempora reiciendis magni blanditiis laborum aliquid rem corporis enim. Et consectetur quo sed excepturi soluta repudiandae commodi id.
|
||||
Eum possimus optio distinctio incidunt quasi optio culpa accusamus.
|
||||
Architecto esse ut aut autem ullam consequatur reiciendis aliquid dolorum.
|
||||
|
||||
Et quam mollitia velit iste enim exercitationem nemo.
|
||||
Hic dignissimos eos et. Eos eos consequatur.
|
|
@ -1 +1 @@
|
|||
run_spec(__dirname, ["markdown"]);
|
||||
run_spec(__dirname, ["markdown"], { proseWrap: "always" });
|
||||
|
|
|
@ -1 +1 @@
|
|||
run_spec(__dirname, ["markdown"]);
|
||||
run_spec(__dirname, ["markdown"], { proseWrap: "always" });
|
||||
|
|
|
@ -1 +1 @@
|
|||
run_spec(__dirname, ["markdown"]);
|
||||
run_spec(__dirname, ["markdown"], { proseWrap: "always" });
|
||||
|
|
|
@ -1 +1 @@
|
|||
run_spec(__dirname, ["markdown"]);
|
||||
run_spec(__dirname, ["markdown"], { proseWrap: "always" });
|
||||
|
|
|
@ -1 +1 @@
|
|||
run_spec(__dirname, ["markdown"]);
|
||||
run_spec(__dirname, ["markdown"], { proseWrap: "always" });
|
||||
|
|
|
@ -1 +1 @@
|
|||
run_spec(__dirname, ["markdown"]);
|
||||
run_spec(__dirname, ["markdown"], { proseWrap: "always" });
|
||||
|
|
|
@ -1 +1 @@
|
|||
run_spec(__dirname, ["markdown"]);
|
||||
run_spec(__dirname, ["markdown"], { proseWrap: "always" });
|
||||
|
|
|
@ -1 +1 @@
|
|||
run_spec(__dirname, ["markdown"]);
|
||||
run_spec(__dirname, ["markdown"], { proseWrap: "always" });
|
||||
|
|
|
@ -1 +1 @@
|
|||
run_spec(__dirname, ["babylon"]);
|
||||
run_spec(__dirname, ["babylon"], { proseWrap: "always" });
|
||||
|
|
|
@ -226,17 +226,6 @@ exports[`show detailed usage with --help no-config (stdout) 1`] = `
|
|||
|
||||
exports[`show detailed usage with --help no-config (write) 1`] = `Array []`;
|
||||
|
||||
exports[`show detailed usage with --help no-prose-wrap (stderr) 1`] = `""`;
|
||||
|
||||
exports[`show detailed usage with --help no-prose-wrap (stdout) 1`] = `
|
||||
"--no-prose-wrap
|
||||
|
||||
Do not wrap prose. (markdown)
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`show detailed usage with --help no-prose-wrap (write) 1`] = `Array []`;
|
||||
|
||||
exports[`show detailed usage with --help no-semi (stderr) 1`] = `""`;
|
||||
|
||||
exports[`show detailed usage with --help no-semi (stdout) 1`] = `
|
||||
|
@ -289,11 +278,17 @@ exports[`show detailed usage with --help print-width (write) 1`] = `Array []`;
|
|||
exports[`show detailed usage with --help prose-wrap (stderr) 1`] = `""`;
|
||||
|
||||
exports[`show detailed usage with --help prose-wrap (stdout) 1`] = `
|
||||
"--prose-wrap
|
||||
"--prose-wrap <always|never|preserve>
|
||||
|
||||
Wrap prose if it exceeds the print width. (markdown)
|
||||
How to wrap prose. (markdown)
|
||||
|
||||
Default: true
|
||||
Valid options:
|
||||
|
||||
always Wrap prose if it exceeds the print width.
|
||||
never Do not wrap prose.
|
||||
preserve Wrap prose as-is.
|
||||
|
||||
Default: preserve
|
||||
"
|
||||
`;
|
||||
|
||||
|
@ -506,7 +501,9 @@ Format options:
|
|||
Defaults to babylon.
|
||||
--print-width <int> The line length where Prettier will try wrap.
|
||||
Defaults to 80.
|
||||
--no-prose-wrap Do not wrap prose. (markdown)
|
||||
--prose-wrap <always|never|preserve>
|
||||
How to wrap prose. (markdown)
|
||||
Defaults to preserve.
|
||||
--no-semi Do not print semicolons, except at the beginning of lines which may need them.
|
||||
--single-quote Use single quotes instead of double quotes.
|
||||
Defaults to false.
|
||||
|
@ -642,7 +639,9 @@ Format options:
|
|||
Defaults to babylon.
|
||||
--print-width <int> The line length where Prettier will try wrap.
|
||||
Defaults to 80.
|
||||
--no-prose-wrap Do not wrap prose. (markdown)
|
||||
--prose-wrap <always|never|preserve>
|
||||
How to wrap prose. (markdown)
|
||||
Defaults to preserve.
|
||||
--no-semi Do not print semicolons, except at the beginning of lines which may need them.
|
||||
--single-quote Use single quotes instead of double quotes.
|
||||
Defaults to false.
|
||||
|
|
Loading…
Reference in New Issue