Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 27e8ada

Browse filesBrowse files
chore: run 'npm run lint:fix'
1 parent 03b4543 commit 27e8ada
Copy full SHA for 27e8ada

File tree

Expand file treeCollapse file tree

89 files changed

+421
-341
lines changed
Filter options

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner
Expand file treeCollapse file tree

89 files changed

+421
-341
lines changed

‎eslint-internal-rules/no-invalid-meta-docs-categories.js

Copy file name to clipboardExpand all lines: eslint-internal-rules/no-invalid-meta-docs-categories.js
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,15 +71,15 @@ function checkMetaValidity(context, exportsNode) {
7171
// fixes.push(fixer.insertTextBefore(category.value, '['), fixer.insertTextAfter(category.value, ']'))
7272

7373
// for vue3 migration
74-
if (category.value.value !== 'base') {
74+
if (category.value.value === 'base') {
75+
fixes.push(fixer.insertTextBefore(category.value, '['))
76+
} else {
7577
fixes.push(
7678
fixer.insertTextBefore(
7779
category.value,
7880
`['vue3-${category.value.value}', `
7981
)
8082
)
81-
} else {
82-
fixes.push(fixer.insertTextBefore(category.value, '['))
8383
}
8484
fixes.push(fixer.insertTextAfter(category.value, ']'))
8585
}

‎lib/processor.js

Copy file name to clipboardExpand all lines: lib/processor.js
+20-10Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,40 +46,50 @@ module.exports = {
4646
const directiveType = message.messageId
4747
const data = message.message.split(' ')
4848
switch (directiveType) {
49-
case 'disableBlock':
49+
case 'disableBlock': {
5050
state.block.disableAllKeys.add(data[1])
5151
break
52-
case 'disableLine':
52+
}
53+
case 'disableLine': {
5354
state.line.disableAllKeys.add(data[1])
5455
break
55-
case 'enableBlock':
56+
}
57+
case 'enableBlock': {
5658
state.block.disableAllKeys.clear()
5759
break
58-
case 'enableLine':
60+
}
61+
case 'enableLine': {
5962
state.line.disableAllKeys.clear()
6063
break
61-
case 'disableBlockRule':
64+
}
65+
case 'disableBlockRule': {
6266
addDisableRule(state.block.disableRuleKeys, data[1], data[2])
6367
break
64-
case 'disableLineRule':
68+
}
69+
case 'disableLineRule': {
6570
addDisableRule(state.line.disableRuleKeys, data[1], data[2])
6671
break
67-
case 'enableBlockRule':
72+
}
73+
case 'enableBlockRule': {
6874
state.block.disableRuleKeys.delete(data[1])
6975
break
70-
case 'enableLineRule':
76+
}
77+
case 'enableLineRule': {
7178
state.line.disableRuleKeys.delete(data[1])
7279
break
73-
case 'clear':
80+
}
81+
case 'clear': {
7482
state.block.disableAllKeys.clear()
7583
state.block.disableRuleKeys.clear()
7684
state.line.disableAllKeys.clear()
7785
state.line.disableRuleKeys.clear()
7886
break
79-
default:
87+
}
88+
default: {
8089
// unused eslint-disable comments report
8190
unusedDisableDirectiveReports.set(messageToKey(message), message)
8291
break
92+
}
8393
}
8494
return false
8595
} else {

‎lib/rules/attributes-order.js

Copy file name to clipboardExpand all lines: lib/rules/attributes-order.js
+31-17Lines changed: 31 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -120,30 +120,39 @@ function getAttributeType(attribute) {
120120
if (!isVBind(attribute)) {
121121
const name = attribute.key.name.name
122122
switch (name) {
123-
case 'for':
123+
case 'for': {
124124
return ATTRS.LIST_RENDERING
125+
}
125126
case 'if':
126127
case 'else-if':
127128
case 'else':
128129
case 'show':
129-
case 'cloak':
130+
case 'cloak': {
130131
return ATTRS.CONDITIONALS
132+
}
131133
case 'pre':
132-
case 'once':
134+
case 'once': {
133135
return ATTRS.RENDER_MODIFIERS
134-
case 'model':
136+
}
137+
case 'model': {
135138
return ATTRS.TWO_WAY_BINDING
136-
case 'on':
139+
}
140+
case 'on': {
137141
return ATTRS.EVENTS
142+
}
138143
case 'html':
139-
case 'text':
144+
case 'text': {
140145
return ATTRS.CONTENT
141-
case 'slot':
146+
}
147+
case 'slot': {
142148
return ATTRS.SLOT
143-
case 'is':
149+
}
150+
case 'is': {
144151
return ATTRS.DEFINITION
145-
default:
152+
}
153+
default: {
146154
return ATTRS.OTHER_DIRECTIVES
155+
}
147156
}
148157
}
149158
propName =
@@ -154,24 +163,29 @@ function getAttributeType(attribute) {
154163
propName = attribute.key.name
155164
}
156165
switch (propName) {
157-
case 'is':
166+
case 'is': {
158167
return ATTRS.DEFINITION
159-
case 'id':
168+
}
169+
case 'id': {
160170
return ATTRS.GLOBAL
171+
}
161172
case 'ref':
162-
case 'key':
173+
case 'key': {
163174
return ATTRS.UNIQUE
175+
}
164176
case 'slot':
165-
case 'slot-scope':
177+
case 'slot-scope': {
166178
return ATTRS.SLOT
167-
default:
179+
}
180+
default: {
168181
if (isVBind(attribute)) {
169182
return ATTRS.ATTR_DYNAMIC
170183
}
171184
if (isVShorthandBoolean(attribute)) {
172185
return ATTRS.ATTR_SHORTHAND_BOOL
173186
}
174187
return ATTRS.ATTR_STATIC
188+
}
175189
}
176190
}
177191

@@ -182,9 +196,9 @@ function getAttributeType(attribute) {
182196
*/
183197
function getPosition(attribute, attributePosition) {
184198
const attributeType = getAttributeType(attribute)
185-
return attributePosition[attributeType] != null
186-
? attributePosition[attributeType]
187-
: null
199+
return attributePosition[attributeType] == null
200+
? null
201+
: attributePosition[attributeType]
188202
}
189203

190204
/**

‎lib/rules/block-lang.js

Copy file name to clipboardExpand all lines: lib/rules/block-lang.js
+5-3Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,12 @@ const DEFAULT_LANGUAGES = {
4242
function getAllowsLangPhrase(lang) {
4343
const langs = [...lang].map((s) => `"${s}"`)
4444
switch (langs.length) {
45-
case 1:
45+
case 1: {
4646
return langs[0]
47-
default:
48-
return `${langs.slice(0, -1).join(', ')}, and ${langs[langs.length - 1]}`
47+
}
48+
default: {
49+
return `${langs.slice(0, -1).join(', ')}, and ${langs.at(-1)}`
50+
}
4951
}
5052
}
5153

‎lib/rules/block-tag-newline.js

Copy file name to clipboardExpand all lines: lib/rules/block-tag-newline.js
+10-8Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,12 @@ function getLinebreakCount(text) {
2525
*/
2626
function getPhrase(lineBreaks) {
2727
switch (lineBreaks) {
28-
case 1:
28+
case 1: {
2929
return '1 line break'
30-
default:
30+
}
31+
default: {
3132
return `${lineBreaks} line breaks`
33+
}
3234
}
3335
}
3436

@@ -324,17 +326,17 @@ module.exports = {
324326
return (element) => {
325327
const { name } = element
326328
const elementsOptions = blocks[name]
327-
if (!elementsOptions) {
328-
verifyElement(element, options)
329-
} else {
329+
if (elementsOptions) {
330330
normalizeOptionValue({
331331
singleline: elementsOptions.singleline || options.singleline,
332332
multiline: elementsOptions.multiline || options.multiline,
333333
maxEmptyLines:
334-
elementsOptions.maxEmptyLines != null
335-
? elementsOptions.maxEmptyLines
336-
: options.maxEmptyLines
334+
elementsOptions.maxEmptyLines == null
335+
? options.maxEmptyLines
336+
: elementsOptions.maxEmptyLines
337337
})(element)
338+
} else {
339+
verifyElement(element, options)
338340
}
339341
}
340342
}

‎lib/rules/comment-directive.js

Copy file name to clipboardExpand all lines: lib/rules/comment-directive.js
+9-9Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -70,16 +70,16 @@ function parse(pattern, comment) {
7070
* @returns {void}
7171
*/
7272
function enable(context, loc, group, rule) {
73-
if (!rule) {
73+
if (rule) {
7474
context.report({
7575
loc,
76-
messageId: group === 'block' ? 'enableBlock' : 'enableLine'
76+
messageId: group === 'block' ? 'enableBlockRule' : 'enableLineRule',
77+
data: { rule }
7778
})
7879
} else {
7980
context.report({
8081
loc,
81-
messageId: group === 'block' ? 'enableBlockRule' : 'enableLineRule',
82-
data: { rule }
82+
messageId: group === 'block' ? 'enableBlock' : 'enableLine'
8383
})
8484
}
8585
}
@@ -94,17 +94,17 @@ function enable(context, loc, group, rule) {
9494
* @returns {void}
9595
*/
9696
function disable(context, loc, group, rule, key) {
97-
if (!rule) {
97+
if (rule) {
9898
context.report({
9999
loc,
100-
messageId: group === 'block' ? 'disableBlock' : 'disableLine',
101-
data: { key }
100+
messageId: group === 'block' ? 'disableBlockRule' : 'disableLineRule',
101+
data: { rule, key }
102102
})
103103
} else {
104104
context.report({
105105
loc,
106-
messageId: group === 'block' ? 'disableBlockRule' : 'disableLineRule',
107-
data: { rule, key }
106+
messageId: group === 'block' ? 'disableBlock' : 'disableLine',
107+
data: { key }
108108
})
109109
}
110110
}

‎lib/rules/component-api-style.js

Copy file name to clipboardExpand all lines: lib/rules/component-api-style.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ function buildAllowedPhrase(allowsOpt) {
162162
phrases.push('Options API')
163163
}
164164
return phrases.length > 2
165-
? `${phrases.slice(0, -1).join(', ')} or ${phrases.slice(-1)[0]}`
165+
? `${phrases.slice(0, -1).join(', ')} or ${phrases.at(-1)}`
166166
: phrases.join(' or ')
167167
}
168168

‎lib/rules/define-emits-declaration.js

Copy file name to clipboardExpand all lines: lib/rules/define-emits-declaration.js
+4-2Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,23 +36,25 @@ module.exports = {
3636
return utils.defineScriptSetupVisitor(context, {
3737
onDefineEmitsEnter(node) {
3838
switch (defineType) {
39-
case 'type-based':
39+
case 'type-based': {
4040
if (node.arguments.length > 0) {
4141
context.report({
4242
node,
4343
messageId: 'hasArg'
4444
})
4545
}
4646
break
47+
}
4748

48-
case 'runtime':
49+
case 'runtime': {
4950
if (node.typeParameters && node.typeParameters.params.length > 0) {
5051
context.report({
5152
node,
5253
messageId: 'hasTypeArg'
5354
})
5455
}
5556
break
57+
}
5658
}
5759
}
5860
})

‎lib/rules/define-props-declaration.js

Copy file name to clipboardExpand all lines: lib/rules/define-props-declaration.js
+4-2Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,23 +36,25 @@ module.exports = {
3636
return utils.defineScriptSetupVisitor(context, {
3737
onDefinePropsEnter(node) {
3838
switch (defineType) {
39-
case 'type-based':
39+
case 'type-based': {
4040
if (node.arguments.length > 0) {
4141
context.report({
4242
node,
4343
messageId: 'hasArg'
4444
})
4545
}
4646
break
47+
}
4748

48-
case 'runtime':
49+
case 'runtime': {
4950
if (node.typeParameters && node.typeParameters.params.length > 0) {
5051
context.report({
5152
node,
5253
messageId: 'hasTypeArg'
5354
})
5455
}
5556
break
57+
}
5658
}
5759
}
5860
})

‎lib/rules/first-attribute-linebreak.js

Copy file name to clipboardExpand all lines: lib/rules/first-attribute-linebreak.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ module.exports = {
6969
const firstAttribute = node.attributes[0]
7070
if (!firstAttribute) return
7171

72-
const lastAttribute = node.attributes[node.attributes.length - 1]
72+
const lastAttribute = node.attributes.at(-1)
7373

7474
const location =
7575
firstAttribute.loc.start.line === lastAttribute.loc.end.line

‎lib/rules/html-closing-bracket-newline.js

Copy file name to clipboardExpand all lines: lib/rules/html-closing-bracket-newline.js
+6-3Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,15 @@ const utils = require('../utils')
1212
*/
1313
function getPhrase(lineBreaks) {
1414
switch (lineBreaks) {
15-
case 0:
15+
case 0: {
1616
return 'no line breaks'
17-
case 1:
17+
}
18+
case 1: {
1819
return '1 line break'
19-
default:
20+
}
21+
default: {
2022
return `${lineBreaks} line breaks`
23+
}
2124
}
2225
}
2326

‎lib/rules/html-self-closing.js

Copy file name to clipboardExpand all lines: lib/rules/html-self-closing.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ function getElementType(node) {
7878
*/
7979
function isEmpty(node, sourceCode) {
8080
const start = node.startTag.range[1]
81-
const end = node.endTag != null ? node.endTag.range[0] : node.range[1]
81+
const end = node.endTag == null ? node.range[1] : node.endTag.range[0]
8282

8383
return sourceCode.text.slice(start, end).trim() === ''
8484
}

‎lib/rules/match-component-file-name.js

Copy file name to clipboardExpand all lines: lib/rules/match-component-file-name.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
const utils = require('../utils')
88
const casing = require('../utils/casing')
9-
const path = require('path')
9+
const path = require('node:path')
1010

1111
/**
1212
* @param {Expression | SpreadElement} node

‎lib/rules/max-attributes-per-line.js

Copy file name to clipboardExpand all lines: lib/rules/max-attributes-per-line.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ function groupAttrsByLine(attributes) {
5151
const current = attributes[index]
5252

5353
if (previous.loc.end.line === current.loc.start.line) {
54-
propsPerLine[propsPerLine.length - 1].push(current)
54+
propsPerLine.at(-1).push(current)
5555
} else {
5656
propsPerLine.push([current])
5757
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.