Skip to content

Commit 97b22d2

Browse files
committed
chore(lint): consistent JSX curly spacing
1 parent ba11898 commit 97b22d2

File tree

96 files changed

+814
-335
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+814
-335
lines changed

.eslintrc.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ module.exports = {
2323
'@typescript-eslint',
2424
'sonarjs',
2525
'react',
26+
'eslint-plugin-local-rules',
2627
],
2728
rules: {
2829
'no-var': 'error',
@@ -200,6 +201,16 @@ module.exports = {
200201

201202
// https://github.com/yannickcr/eslint-plugin-react/issues/2415
202203
// 'react/jsx-curly-spacing': ['error', { when: 'always', spacing: { objectLiterals: 'never' } }],
204+
'local-rules/jsx-condition-key': 'error',
205+
'local-rules/jsx-curly-spacing': ['error', {
206+
when: 'always',
207+
spacing: {
208+
objectLiterals: 'never',
209+
arrayLiterals: 'never',
210+
multilineClose: 'never',
211+
},
212+
children: true,
213+
}],
203214

204215
'react/jsx-equals-spacing': 'error',
205216
'react/jsx-first-prop-new-line': 'error',

eslint-local-rules.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22
const path = require('path')
33

44
module.exports = {
5-
'no-render-string-reference': {
6-
create: require('./scripts/no-render-string-reference'),
7-
},
5+
'no-render-string-reference': require('./scripts/rules/no-render-string-reference'),
86
'jsx-condition-key': {
97
create (context) {
108
return {
@@ -58,6 +56,7 @@ module.exports = {
5856
}
5957
},
6058
},
59+
'jsx-curly-spacing': require('./scripts/rules/jsx-curly-spacing'),
6160
'jest-global-imports': {
6261
meta: {
6362
fixable: 'code',

packages/vuetify/.eslintrc.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@ module.exports = {
66
__VUETIFY_VERSION__: true,
77
__REQUIRED_VUE__: true,
88
},
9-
plugins: [
10-
'eslint-plugin-local-rules',
11-
],
129
extends: [
1310
// 'plugin:import/typescript', // slow, only enable if needed
1411
],
@@ -19,7 +16,6 @@ module.exports = {
1916
// 'vue/html-self-closing': 'off',
2017
// 'vue/html-closing-bracket-spacing': 'off',
2118
// 'local-rules/no-render-string-reference': 'error',
22-
'local-rules/jsx-condition-key': 'error',
2319

2420
'no-restricted-imports': ['error', {
2521
paths: [{

packages/vuetify/src/components/VAlert/VAlert.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ export const VAlert = genericComponent<VAlertSlots>()({
173173
]}
174174
style={ textColorStyles.value }
175175
/>
176-
) }
176+
)}
177177

178178
{ hasPrepend && (
179179
<VDefaultsProvider
@@ -193,18 +193,18 @@ export const VAlert = genericComponent<VAlertSlots>()({
193193
}
194194
</div>
195195
</VDefaultsProvider>
196-
) }
196+
)}
197197

198198
<div class="v-alert__content">
199199
{ hasTitle && (
200200
<VAlertTitle key="title">
201201
{ slots.title ? slots.title() : props.title }
202202
</VAlertTitle>
203-
) }
203+
)}
204204

205205
{ hasText && (
206206
slots.text ? slots.text() : props.text
207-
) }
207+
)}
208208

209209
{ slots.default?.() }
210210
</div>
@@ -213,7 +213,7 @@ export const VAlert = genericComponent<VAlertSlots>()({
213213
<div key="append" class="v-alert__append">
214214
{ slots.append() }
215215
</div>
216-
) }
216+
)}
217217

218218
{ hasClose && (
219219
<VDefaultsProvider
@@ -230,7 +230,7 @@ export const VAlert = genericComponent<VAlertSlots>()({
230230
{ slots.close?.({ props: closeProps.value }) ?? <VBtn { ...closeProps.value } /> }
231231
</div>
232232
</VDefaultsProvider>
233-
) }
233+
)}
234234
</props.tag>
235235
)
236236
}

packages/vuetify/src/components/VAlert/__tests__/VAlert.spec.cy.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ describe('VAlert', () => {
2222
it('supports default color props', () => {
2323
cy.mount(() => (
2424
<>
25-
{defaultColors.map((color, idx) => (
25+
{ defaultColors.map((color, idx) => (
2626
<VAlert color={ color } text={ idx.toString() }>
2727
{ color } alert
2828
</VAlert>
29-
)) }
29+
))}
3030
</>
3131
))
3232
.get('.v-alert')

packages/vuetify/src/components/VAutocomplete/VAutocomplete.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ export const VAutocomplete = genericComponent<new <
315315
>
316316
{ !displayItems.value.length && !props.hideNoData && (slots['no-data']?.() ?? (
317317
<VListItem title={ t(props.noDataText) } />
318-
)) }
318+
))}
319319

320320
{ slots['prepend-item']?.() }
321321

@@ -340,11 +340,11 @@ export const VAutocomplete = genericComponent<new <
340340
},
341341
}}
342342
</VListItem>
343-
)) }
343+
))}
344344

345345
{ slots['append-item']?.() }
346346
</VList>
347-
) }
347+
)}
348348
</VMenu>
349349

350350
{ selections.value.map((item, index) => {
@@ -386,13 +386,13 @@ export const VAutocomplete = genericComponent<new <
386386
{ item.title }
387387
{ props.multiple && (index < selections.value.length - 1) && (
388388
<span class="v-autocomplete__selection-comma">,</span>
389-
) }
389+
)}
390390
</span>
391391
)
392392
)}
393393
</div>
394394
)
395-
}) }
395+
})}
396396
</>
397397
),
398398
}}

packages/vuetify/src/components/VAutocomplete/__tests__/VAutocomplete.spec.cy.tsx

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ describe('VAutocomplete', () => {
1212

1313
cy.mount(() => (
1414
<VAutocomplete
15-
items={items}
16-
modelValue={selectedItems}
15+
items={ items }
16+
modelValue={ selectedItems }
1717
chips
1818
closableChips
1919
multiple
@@ -34,8 +34,8 @@ describe('VAutocomplete', () => {
3434

3535
cy.mount(() => (
3636
<VAutocomplete
37-
v-model={selectedItems.value}
38-
items={items.value}
37+
v-model={ selectedItems.value }
38+
items={ items.value }
3939
chips
4040
multiple
4141
closableChips
@@ -81,8 +81,8 @@ describe('VAutocomplete', () => {
8181

8282
cy.mount(() => (
8383
<VAutocomplete
84-
v-model={selectedItems.value}
85-
items={items.value}
84+
v-model={ selectedItems.value }
85+
items={ items.value }
8686
returnObject
8787
chips
8888
multiple
@@ -105,8 +105,8 @@ describe('VAutocomplete', () => {
105105

106106
cy.mount(() => (
107107
<VAutocomplete
108-
items={items}
109-
modelValue={selectedItems}
108+
items={ items }
109+
modelValue={ selectedItems }
110110
readonly
111111
/>
112112
))
@@ -132,8 +132,8 @@ describe('VAutocomplete', () => {
132132
cy.mount(() => (
133133
<VForm readonly>
134134
<VAutocomplete
135-
items={items}
136-
modelValue={selectedItems}
135+
items={ items }
136+
modelValue={ selectedItems }
137137
readonly
138138
/>
139139
</VForm>
@@ -160,8 +160,8 @@ describe('VAutocomplete', () => {
160160

161161
cy.mount(() => (
162162
<VAutocomplete
163-
items={items}
164-
modelValue={selectedItems}
163+
items={ items }
164+
modelValue={ selectedItems }
165165
hideSelected
166166
multiple
167167
/>

packages/vuetify/src/components/VBadge/__tests__/VBadge.spec.cy.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const stories = {
2626
'Default badge': <VBadge />,
2727
'Icon badge': <VBadge icon="mdi-vuetify" />,
2828
'Offset badge': gridOn(['offsetX', 'offsetY'], offset, (xy, offset) => (
29-
<VBadge {...{ [xy]: offset }} content={ `${offset}` }>
29+
<VBadge { ...{ [xy]: offset } } content={ `${offset}` }>
3030
<VBtn>
3131
{ xy }
3232
</VBtn>
@@ -47,11 +47,11 @@ describe('VBadge', () => {
4747
it('supports default color props', () => {
4848
cy.mount(() => (
4949
<>
50-
{defaultColors.map((color, idx) => (
50+
{ defaultColors.map((color, idx) => (
5151
<VBadge color={ color } content={ idx.toString() }>
5252
{ color } badge
5353
</VBadge>
54-
)) }
54+
))}
5555
</>
5656
))
5757
.get('.v-badge')
@@ -94,11 +94,11 @@ describe('VBadge', () => {
9494
it('supports default text color props', () => {
9595
cy.mount(() => (
9696
<>
97-
{defaultColors.map((color, idx) => (
97+
{ defaultColors.map((color, idx) => (
9898
<VBadge textColor={ color } content={ idx.toString() }>
9999
{ color } text badge
100100
</VBadge>
101-
)) }
101+
))}
102102
</>
103103
))
104104
.get('.v-badge')

packages/vuetify/src/components/VBanner/VBanner.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,14 +121,14 @@ export const VBanner = genericComponent<VBannerSlots>()({
121121
}
122122
</div>
123123
</VDefaultsProvider>
124-
) }
124+
)}
125125

126126
<div class="v-banner__content">
127127
{ hasText && (
128128
<VBannerText key="text">
129129
{ slots.text ? slots.text() : props.text }
130130
</VBannerText>
131-
) }
131+
)}
132132

133133
{ slots.default?.() }
134134
</div>
@@ -137,7 +137,7 @@ export const VBanner = genericComponent<VBannerSlots>()({
137137
<VBannerActions>
138138
{ slots.actions() }
139139
</VBannerActions>
140-
) }
140+
)}
141141
</props.tag>
142142
)
143143
})

packages/vuetify/src/components/VBottomNavigation/VBottomNavigation.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ export const VBottomNavigation = genericComponent()({
124124
<div class="v-bottom-navigation__content">
125125
{ slots.default() }
126126
</div>
127-
) }
127+
)}
128128
</props.tag>
129129
)
130130
})

0 commit comments

Comments
 (0)