Preserve blank lines between JSX attributes (#19161)
This commit is contained in:
8 files changed
+328
-1
No files matched your search
@@ -0,0 +1,171 @@
|
||||
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
|
||||
|
||||
exports[`attribute-blank-lines.js - {"singleAttributePerLine":true} format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["flow", "babel", "typescript"]
|
||||
singleAttributePerLine: true
|
||||
printWidth: 80 (default) |
|
||||
=====================================input======================================
|
||||
const basic = (
|
||||
<Component
|
||||
first={1}
|
||||
|
||||
second={2}
|
||||
third={3}
|
||||
/>
|
||||
);
|
||||
|
||||
const multipleBlankLines = (
|
||||
<Component
|
||||
first={1}
|
||||
|
||||
|
||||
|
||||
second={2}
|
||||
/>
|
||||
);
|
||||
|
||||
const spreadAttributes = (
|
||||
<Component
|
||||
first={1}
|
||||
|
||||
{...props}
|
||||
|
||||
second={2}
|
||||
/>
|
||||
);
|
||||
|
||||
const noBlankLines = (
|
||||
<Component
|
||||
first={1}
|
||||
second={2}
|
||||
third={3}
|
||||
/>
|
||||
);
|
||||
|
||||
const inlineAttributes = <Component first={1} second={2} />;
|
||||
|
||||
=====================================output=====================================
|
||||
const basic = (
|
||||
<Component
|
||||
first={1}
|
||||
|
||||
second={2}
|
||||
third={3}
|
||||
/>
|
||||
);
|
||||
|
||||
const multipleBlankLines = (
|
||||
<Component
|
||||
first={1}
|
||||
|
||||
second={2}
|
||||
/>
|
||||
);
|
||||
|
||||
const spreadAttributes = (
|
||||
<Component
|
||||
first={1}
|
||||
|
||||
{...props}
|
||||
|
||||
second={2}
|
||||
/>
|
||||
);
|
||||
|
||||
const noBlankLines = (
|
||||
<Component
|
||||
first={1}
|
||||
second={2}
|
||||
third={3}
|
||||
/>
|
||||
);
|
||||
|
||||
const inlineAttributes = (
|
||||
<Component
|
||||
first={1}
|
||||
second={2}
|
||||
/>
|
||||
);
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`attribute-blank-lines.js format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["flow", "babel", "typescript"]
|
||||
printWidth: 80 (default) |
|
||||
=====================================input======================================
|
||||
const basic = (
|
||||
<Component
|
||||
first={1}
|
||||
|
||||
second={2}
|
||||
third={3}
|
||||
/>
|
||||
);
|
||||
|
||||
const multipleBlankLines = (
|
||||
<Component
|
||||
first={1}
|
||||
|
||||
|
||||
|
||||
second={2}
|
||||
/>
|
||||
);
|
||||
|
||||
const spreadAttributes = (
|
||||
<Component
|
||||
first={1}
|
||||
|
||||
{...props}
|
||||
|
||||
second={2}
|
||||
/>
|
||||
);
|
||||
|
||||
const noBlankLines = (
|
||||
<Component
|
||||
first={1}
|
||||
second={2}
|
||||
third={3}
|
||||
/>
|
||||
);
|
||||
|
||||
const inlineAttributes = <Component first={1} second={2} />;
|
||||
|
||||
=====================================output=====================================
|
||||
const basic = (
|
||||
<Component
|
||||
first={1}
|
||||
|
||||
second={2}
|
||||
third={3}
|
||||
/>
|
||||
);
|
||||
|
||||
const multipleBlankLines = (
|
||||
<Component
|
||||
first={1}
|
||||
|
||||
second={2}
|
||||
/>
|
||||
);
|
||||
|
||||
const spreadAttributes = (
|
||||
<Component
|
||||
first={1}
|
||||
|
||||
{...props}
|
||||
|
||||
second={2}
|
||||
/>
|
||||
);
|
||||
|
||||
const noBlankLines = <Component first={1} second={2} third={3} />;
|
||||
|
||||
const inlineAttributes = <Component first={1} second={2} />;
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
@@ -0,0 +1,38 @@
|
||||
const basic = (
|
||||
<Component
|
||||
first={1}
|
||||
|
||||
second={2}
|
||||
third={3}
|
||||
/>
|
||||
);
|
||||
|
||||
const multipleBlankLines = (
|
||||
<Component
|
||||
first={1}
|
||||
|
||||
|
||||
|
||||
second={2}
|
||||
/>
|
||||
);
|
||||
|
||||
const spreadAttributes = (
|
||||
<Component
|
||||
first={1}
|
||||
|
||||
{...props}
|
||||
|
||||
second={2}
|
||||
/>
|
||||
);
|
||||
|
||||
const noBlankLines = (
|
||||
<Component
|
||||
first={1}
|
||||
second={2}
|
||||
third={3}
|
||||
/>
|
||||
);
|
||||
|
||||
const inlineAttributes = <Component first={1} second={2} />;
|
||||
@@ -0,0 +1,4 @@
|
||||
runFormatTest(import.meta, ["flow", "babel", "typescript"]);
|
||||
runFormatTest(import.meta, ["flow", "babel", "typescript"], {
|
||||
singleAttributePerLine: true,
|
||||
});
|
||||
@@ -4988,21 +4988,29 @@ singleQuote: false
|
||||
<div
|
||||
single="foo"
|
||||
single2={"foo"}
|
||||
|
||||
double="bar"
|
||||
double2={"bar"}
|
||||
|
||||
singleDouble='"'
|
||||
singleDouble2={'"'}
|
||||
|
||||
doubleSingle="'"
|
||||
doubleSingle2={"'"}
|
||||
|
||||
singleEscaped={"'"}
|
||||
singleEscaped2="'"
|
||||
|
||||
doubleEscaped={'"'}
|
||||
doubleEscaped2='"'
|
||||
|
||||
singleBothEscaped={"'\\""}
|
||||
singleBothEscaped2="'""
|
||||
|
||||
singleBoth="' ""
|
||||
singleBoth2={"' \\""}
|
||||
singleBoth3="' ' ""
|
||||
|
||||
doubleBoth="" '"
|
||||
doubleBoth2={"\\" '"}
|
||||
doubleBoth3="" ' '"
|
||||
@@ -5077,21 +5085,29 @@ singleQuote: false
|
||||
<div
|
||||
single='foo'
|
||||
single2={"foo"}
|
||||
|
||||
double='bar'
|
||||
double2={"bar"}
|
||||
|
||||
singleDouble='"'
|
||||
singleDouble2={'"'}
|
||||
|
||||
doubleSingle="'"
|
||||
doubleSingle2={"'"}
|
||||
|
||||
singleEscaped={"'"}
|
||||
singleEscaped2="'"
|
||||
|
||||
doubleEscaped={'"'}
|
||||
doubleEscaped2='"'
|
||||
|
||||
singleBothEscaped={"'\\""}
|
||||
singleBothEscaped2=''"'
|
||||
|
||||
singleBoth='' "'
|
||||
singleBoth2={"' \\""}
|
||||
singleBoth3="' ' ""
|
||||
|
||||
doubleBoth='" ''
|
||||
doubleBoth2={"\\" '"}
|
||||
doubleBoth3="" ' '"
|
||||
@@ -5166,21 +5182,29 @@ singleQuote: true
|
||||
<div
|
||||
single="foo"
|
||||
single2={'foo'}
|
||||
|
||||
double="bar"
|
||||
double2={'bar'}
|
||||
|
||||
singleDouble='"'
|
||||
singleDouble2={'"'}
|
||||
|
||||
doubleSingle="'"
|
||||
doubleSingle2={"'"}
|
||||
|
||||
singleEscaped={"'"}
|
||||
singleEscaped2="'"
|
||||
|
||||
doubleEscaped={'"'}
|
||||
doubleEscaped2='"'
|
||||
|
||||
singleBothEscaped={'\\'"'}
|
||||
singleBothEscaped2="'""
|
||||
|
||||
singleBoth="' ""
|
||||
singleBoth2={'\\' "'}
|
||||
singleBoth3="' ' ""
|
||||
|
||||
doubleBoth="" '"
|
||||
doubleBoth2={'" \\''}
|
||||
doubleBoth3="" ' '"
|
||||
@@ -5255,21 +5279,29 @@ singleQuote: true
|
||||
<div
|
||||
single='foo'
|
||||
single2={'foo'}
|
||||
|
||||
double='bar'
|
||||
double2={'bar'}
|
||||
|
||||
singleDouble='"'
|
||||
singleDouble2={'"'}
|
||||
|
||||
doubleSingle="'"
|
||||
doubleSingle2={"'"}
|
||||
|
||||
singleEscaped={"'"}
|
||||
singleEscaped2="'"
|
||||
|
||||
doubleEscaped={'"'}
|
||||
doubleEscaped2='"'
|
||||
|
||||
singleBothEscaped={'\\'"'}
|
||||
singleBothEscaped2=''"'
|
||||
|
||||
singleBoth='' "'
|
||||
singleBoth2={'\\' "'}
|
||||
singleBoth3="' ' ""
|
||||
|
||||
doubleBoth='" ''
|
||||
doubleBoth2={'" \\''}
|
||||
doubleBoth3="" ' '"
|
||||
|
||||
@@ -1,5 +1,30 @@
|
||||
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
|
||||
|
||||
exports[`attribute-blank-lines.tsx format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["typescript"]
|
||||
printWidth: 80 (default) |
|
||||
=====================================input======================================
|
||||
const element = (
|
||||
<Component<Props>
|
||||
first={1}
|
||||
|
||||
second={2}
|
||||
/>
|
||||
);
|
||||
|
||||
=====================================output=====================================
|
||||
const element = (
|
||||
<Component<Props>
|
||||
first={1}
|
||||
|
||||
second={2}
|
||||
/>
|
||||
);
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`generic-component.tsx format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["typescript"]
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
const element = (
|
||||
<Component<Props>
|
||||
first={1}
|
||||
|
||||
second={2}
|
||||
/>
|
||||
);
|
||||
Reference in new issue
Block a user