);
return (
// Also dedent.
);
return (
)
// JSXMemberExpression names are parsed/indented:
Hello World!
// JSXOpeningFragment and JSXClosingFragment are parsed/indented:
<>
<>
Hello World!
>
<>
>
>
// Indent void expressions (no need for contextual parens / commas)
// (https://github.com/mooz/js2-mode/issues/140#issuecomment-166250016).
Title
{array.map(() => {
return ;
})}
{message}
// Another example of above issue
// (https://github.com/mooz/js2-mode/issues/490).
{variable1}
// Comments and arrows can break indentation (Bug#24896 /
// https://github.com/mooz/js2-mode/issues/389).
const Component = props => (
c}
b={123}>
);
const Component = props => (
);
const Component = props => ( // Parse this comment, please.
c}
b={123}>
);
const Component = props => ( // Parse this comment, please.
);
// Another example of above issue (Bug#30225).
class {
render() {
return (
);
}
}
// JSX attributes of an arrow function’s expression body’s JSX
// expression should be indented with respect to the JSX opening
// element (Bug#26001 /
// https://github.com/mooz/js2-mode/issues/389#issuecomment-271869380).
class {
render() {
const messages = this.state.messages.map(
message =>
); return messages;
}
render() {
const messages = this.state.messages.map(message =>
); return messages;
}
}
// Users expect tag closers to align with the tag’s start; this is the
// style used in the React docs, so it should be the default.
// - https://github.com/mooz/js2-mode/issues/389#issuecomment-390766873
// - https://github.com/mooz/js2-mode/issues/482
// - Bug#32158
const foo = (props) => (
i}
/>
);
// Embedded JSX in parens breaks indentation
// (https://github.com/mooz/js2-mode/issues/411).
let a = (
{condition && }
{condition && }
)
let b = (
{condition && ()}
)
let c = (
{condition && ()}
{condition && "something"}
)
let d = (
{()}
{condition && "something"}
)
// Another example of the above issue (Bug#27000).
function testA() {
return (
{ ( ) }
);
}
function testB() {
return (
{ }
);
}
// Another example of the above issue
// (https://github.com/mooz/js2-mode/issues/451).
class Classy extends React.Component {
render () {
return (
{ this.state.list.map((item) => {
return ()
})}
)
}
}
// Self-closing tags should be indented properly
// (https://github.com/mooz/js2-mode/issues/459).
export default ({ stars }) => (
Congratulations!
0)} size='large' />
1)} size='small' />
2)} size='small' />
You have created 1 reminder
)
// JS expressions should not break indentation
// (https://github.com/mooz/js2-mode/issues/462).
//
// In the referenced issue, the user actually wanted indentation which
// was simply different than Emacs’ SGML attribute indentation.
// Nevertheless, his issue highlighted our inability to properly
// indent code with JSX inside JSXExpressionContainers inside JSX.
return (
(