Skip to content
This repository was archived by the owner on Mar 3, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions spec/fixtures/indentation/classes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
class MyClass extends OtherComponent {

state = {
test: 1
}

constructor() {
test();
}

otherfunction = (a, b = {
default: false
}) => {
more();
}
}
43 changes: 43 additions & 0 deletions spec/fixtures/indentation/expressions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/* multi-line expressions */
req
.shouldBeOne();
too.
more.
shouldBeOneToo;

const a =
long_expression;

b =
long;

b =
3 + 5;

b =
3
+ 5;

b =
3
+ 5
+ 7
+ 8
* 8
* 9
/ 17
* 8
/ 20
- 34
+ 3 *
9
- 8;

ifthis
&& thendo()
|| otherwise
&& dothis

/**
A comment, should be at 1
*/
35 changes: 35 additions & 0 deletions spec/fixtures/indentation/function_call.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
foo({
sd,
sdf
},
4
);

foo( 2, {
sd,
sdf
},
4
);

foo( 2,
{
sd,
sdf
});

foo( 2, {
sd,
sdf
});

foo(2,
4);

foo({
symetric_opening_and_closing_scopes: 'indent me at 1'
});

foo(myWrapper(mysecondWrapper({
a: 1 // should be at 1
})));
59 changes: 59 additions & 0 deletions spec/fixtures/indentation/if_then_else.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@

/** if-then-else loops */
if (true)
foo();
else
bar();

if (true) {
foo();
bar();
} else {
foo();
}

// https://github.com/atom/atom/issues/6691
if (true)
{
foo();
bar();
}
else
{
foo();
}

if (true) {
if (yes)
doit(); // 2
bar();
} else if (more()) {
foo(); // 1
}

if (true)
foo();
else
if (more()) { // 1
foo(); // 1
}

if (true)
foo();
else
if (more()) // 1
foo(); // 2

if (we
()) {
go();
}

if (true) {
foo();
bar();
} else if (false) {
more();
} else {
foo();
}
47 changes: 47 additions & 0 deletions spec/fixtures/indentation/jsx.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/** JSX */
const jsx = (
<div
title='start'
>
good
<a>
link
</a>
<i>
sdfg
</i>
<div>
sdf
</div>
</div>
);

const two = (
<div>
<b>
test
</b>
<b>
test
</b>
</div>
);

const a = (
<img
src='/img.jpg'
/>
);

const b = (
<img
src='/img.jpg' />
);

const two = (
<div>
{
test && 'test'
}
</div>
);
39 changes: 39 additions & 0 deletions spec/fixtures/indentation/objects_and_array.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
var x = [
3,
4
];

const y = [
1
];

const j = [{
a: 1
}];

let h = {
a: [ 1,
2 ],
b: { j: [
{ l: 1 }]
},
c:
{ j: [
{ l: 1 }]
},
};

const a =
{
b: 1
};

const x = {
g: {
a: 1,
b: 2
},
h: {
c: 3
}
}
11 changes: 11 additions & 0 deletions spec/fixtures/indentation/switch.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

switch (e) {
case 5:
something();
more();
case 6:
somethingElse();
case 7:
default:
done();
}
36 changes: 36 additions & 0 deletions spec/fixtures/indentation/while.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/** While loops */
while (condition)
inLoop();

while (condition)
inLoop();
after();

while (mycondition) {
sdfsdfg();
}

while (mycondition)
{
sdfsdfg();
}

while (mycond)
if (more)
doit;
after();

while (mycond) if (more)
doit;
after();

while (mycondition) {
sdfsdfg();
if (test) {
more()
}}

while (mycondition)
if (test) {
more()
}
Loading