Skip to content

Commit 4760cb8

Browse files
committed
fix: switch to @stylistic/exp-list-style to resolve array edge-cases
Signed-off-by: Ferdinand Thiessen <[email protected]>
1 parent cb2bba9 commit 4760cb8

File tree

5 files changed

+40
-21
lines changed

5 files changed

+40
-21
lines changed

lib/configs/codeStyle.ts

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -93,25 +93,15 @@ export function codeStyle(options: ConfigOptions): Linter.Config[] {
9393
{ avoidQuotes: true },
9494
],
9595

96-
// Enforce consistent new lines after [ and before ]
97-
'@stylistic/array-bracket-newline': [
98-
'error',
99-
'consistent',
100-
],
101-
// Enforce new lines between array elements (better git diff) but allow to have single line arrays
102-
'@stylistic/array-element-newline': ['error', 'consistent'],
103-
// Same for objects as for arrays
104-
'@stylistic/object-curly-newline': [
105-
'error',
106-
{
107-
consistent: true,
108-
multiline: true,
109-
},
110-
],
111-
'@stylistic/object-property-newline': [
112-
'error',
113-
{ allowAllPropertiesOnSameLine: true },
114-
],
96+
// Enforce consistent new lines after brackets
97+
'@stylistic/array-bracket-newline': 'off',
98+
'@stylistic/array-bracket-spacing': 'off',
99+
'@stylistic/array-element-newline': 'off',
100+
'@stylistic/jsx-function-call-newline': 'off',
101+
'@stylistic/object-curly-newline': 'off',
102+
'@stylistic/object-curly-spacing': 'off',
103+
'@stylistic/object-property-newline': 'off',
104+
'@stylistic/exp-list-style': 'error',
115105

116106
// No space between function name and parenthesis. Enforce fn() instead of fn ()
117107
'@stylistic/function-call-spacing': [

lib/configs/vue.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,8 @@ export function vue(options: ConfigOptions): Linter.Config[] {
143143
'vue/prefer-separate-static-class': 'error',
144144
// For consistent layout of components
145145
'vue/define-macros-order': [
146-
'error', {
146+
'error',
147+
{
147148
order: [
148149
'defineOptions',
149150
'defineModel',

tests/fixtures/codestyle/input/array.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,22 @@ const arr3 = [
1414
'second',
1515
'third'
1616
]
17+
18+
// inconsistent brackets
19+
const brackets = ['Monday',
20+
'Tuesday',
21+
'Wednesday',
22+
'Thursday',
23+
'Friday',
24+
'Saturday',
25+
'Sunday',
26+
]
27+
28+
// consistent brackets but not a list style
29+
const brackets2 = ['Monday',
30+
'Tuesday',
31+
'Wednesday',
32+
'Thursday',
33+
'Friday',
34+
'Saturday',
35+
'Sunday']

tests/fixtures/codestyle/output/array.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,9 @@ const arr3 = [
1717
'second',
1818
'third',
1919
]
20+
21+
// inconsistent brackets
22+
const brackets = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
23+
24+
// consistent brackets but not a list style
25+
const brackets2 = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']

tests/fixtures/codestyle/output/function.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@ export function doSomething(
4848
* @param num
4949
* @param enable
5050
*/
51-
export function doSomethingDifferent(num: number, enable: boolean) {
51+
export function doSomethingDifferent(
52+
num: number,
53+
enable: boolean,
54+
) {
5255
// ...
5356
}
5457

0 commit comments

Comments
 (0)