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 adf77e9

Browse filesBrowse files
Revert "chore: run 'npm run lint:fix'"
This reverts commit 27e8ada.
1 parent 41b22e1 commit adf77e9
Copy full SHA for adf77e9

File tree

Expand file treeCollapse file tree

89 files changed

+341
-421
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

+341
-421
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') {
75-
fixes.push(fixer.insertTextBefore(category.value, '['))
76-
} else {
74+
if (category.value.value !== 'base') {
7775
fixes.push(
7876
fixer.insertTextBefore(
7977
category.value,
8078
`['vue3-${category.value.value}', `
8179
)
8280
)
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
+10-20Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -46,50 +46,40 @@ 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-
}
53-
case 'disableLine': {
52+
case 'disableLine':
5453
state.line.disableAllKeys.add(data[1])
5554
break
56-
}
57-
case 'enableBlock': {
55+
case 'enableBlock':
5856
state.block.disableAllKeys.clear()
5957
break
60-
}
61-
case 'enableLine': {
58+
case 'enableLine':
6259
state.line.disableAllKeys.clear()
6360
break
64-
}
65-
case 'disableBlockRule': {
61+
case 'disableBlockRule':
6662
addDisableRule(state.block.disableRuleKeys, data[1], data[2])
6763
break
68-
}
69-
case 'disableLineRule': {
64+
case 'disableLineRule':
7065
addDisableRule(state.line.disableRuleKeys, data[1], data[2])
7166
break
72-
}
73-
case 'enableBlockRule': {
67+
case 'enableBlockRule':
7468
state.block.disableRuleKeys.delete(data[1])
7569
break
76-
}
77-
case 'enableLineRule': {
70+
case 'enableLineRule':
7871
state.line.disableRuleKeys.delete(data[1])
7972
break
80-
}
81-
case 'clear': {
73+
case 'clear':
8274
state.block.disableAllKeys.clear()
8375
state.block.disableRuleKeys.clear()
8476
state.line.disableAllKeys.clear()
8577
state.line.disableRuleKeys.clear()
8678
break
87-
}
88-
default: {
79+
default:
8980
// unused eslint-disable comments report
9081
unusedDisableDirectiveReports.set(messageToKey(message), message)
9182
break
92-
}
9383
}
9484
return false
9585
} else {

‎lib/rules/attributes-order.js

Copy file name to clipboardExpand all lines: lib/rules/attributes-order.js
+17-31Lines changed: 17 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -120,39 +120,30 @@ 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-
}
126125
case 'if':
127126
case 'else-if':
128127
case 'else':
129128
case 'show':
130-
case 'cloak': {
129+
case 'cloak':
131130
return ATTRS.CONDITIONALS
132-
}
133131
case 'pre':
134-
case 'once': {
132+
case 'once':
135133
return ATTRS.RENDER_MODIFIERS
136-
}
137-
case 'model': {
134+
case 'model':
138135
return ATTRS.TWO_WAY_BINDING
139-
}
140-
case 'on': {
136+
case 'on':
141137
return ATTRS.EVENTS
142-
}
143138
case 'html':
144-
case 'text': {
139+
case 'text':
145140
return ATTRS.CONTENT
146-
}
147-
case 'slot': {
141+
case 'slot':
148142
return ATTRS.SLOT
149-
}
150-
case 'is': {
143+
case 'is':
151144
return ATTRS.DEFINITION
152-
}
153-
default: {
145+
default:
154146
return ATTRS.OTHER_DIRECTIVES
155-
}
156147
}
157148
}
158149
propName =
@@ -163,29 +154,24 @@ function getAttributeType(attribute) {
163154
propName = attribute.key.name
164155
}
165156
switch (propName) {
166-
case 'is': {
157+
case 'is':
167158
return ATTRS.DEFINITION
168-
}
169-
case 'id': {
159+
case 'id':
170160
return ATTRS.GLOBAL
171-
}
172161
case 'ref':
173-
case 'key': {
162+
case 'key':
174163
return ATTRS.UNIQUE
175-
}
176164
case 'slot':
177-
case 'slot-scope': {
165+
case 'slot-scope':
178166
return ATTRS.SLOT
179-
}
180-
default: {
167+
default:
181168
if (isVBind(attribute)) {
182169
return ATTRS.ATTR_DYNAMIC
183170
}
184171
if (isVShorthandBoolean(attribute)) {
185172
return ATTRS.ATTR_SHORTHAND_BOOL
186173
}
187174
return ATTRS.ATTR_STATIC
188-
}
189175
}
190176
}
191177

@@ -196,9 +182,9 @@ function getAttributeType(attribute) {
196182
*/
197183
function getPosition(attribute, attributePosition) {
198184
const attributeType = getAttributeType(attribute)
199-
return attributePosition[attributeType] == null
200-
? null
201-
: attributePosition[attributeType]
185+
return attributePosition[attributeType] != null
186+
? attributePosition[attributeType]
187+
: null
202188
}
203189

204190
/**

‎lib/rules/block-lang.js

Copy file name to clipboardExpand all lines: lib/rules/block-lang.js
+3-5Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,10 @@ 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-
}
48-
default: {
49-
return `${langs.slice(0, -1).join(', ')}, and ${langs.at(-1)}`
50-
}
47+
default:
48+
return `${langs.slice(0, -1).join(', ')}, and ${langs[langs.length - 1]}`
5149
}
5250
}
5351

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

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

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

‎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' ? 'enableBlockRule' : 'enableLineRule',
77-
data: { rule }
76+
messageId: group === 'block' ? 'enableBlock' : 'enableLine'
7877
})
7978
} else {
8079
context.report({
8180
loc,
82-
messageId: group === 'block' ? 'enableBlock' : 'enableLine'
81+
messageId: group === 'block' ? 'enableBlockRule' : 'enableLineRule',
82+
data: { rule }
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' ? 'disableBlockRule' : 'disableLineRule',
101-
data: { rule, key }
100+
messageId: group === 'block' ? 'disableBlock' : 'disableLine',
101+
data: { key }
102102
})
103103
} else {
104104
context.report({
105105
loc,
106-
messageId: group === 'block' ? 'disableBlock' : 'disableLine',
107-
data: { key }
106+
messageId: group === 'block' ? 'disableBlockRule' : 'disableLineRule',
107+
data: { rule, 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.at(-1)}`
165+
? `${phrases.slice(0, -1).join(', ')} or ${phrases.slice(-1)[0]}`
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
+2-4Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,25 +36,23 @@ 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-
}
4847

49-
case 'runtime': {
48+
case 'runtime':
5049
if (node.typeParameters && node.typeParameters.params.length > 0) {
5150
context.report({
5251
node,
5352
messageId: 'hasTypeArg'
5453
})
5554
}
5655
break
57-
}
5856
}
5957
}
6058
})

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

Copy file name to clipboardExpand all lines: lib/rules/define-props-declaration.js
+2-4Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,25 +36,23 @@ 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-
}
4847

49-
case 'runtime': {
48+
case 'runtime':
5049
if (node.typeParameters && node.typeParameters.params.length > 0) {
5150
context.report({
5251
node,
5352
messageId: 'hasTypeArg'
5453
})
5554
}
5655
break
57-
}
5856
}
5957
}
6058
})

‎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.at(-1)
72+
const lastAttribute = node.attributes[node.attributes.length - 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
+3-6Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,12 @@ const utils = require('../utils')
1212
*/
1313
function getPhrase(lineBreaks) {
1414
switch (lineBreaks) {
15-
case 0: {
15+
case 0:
1616
return 'no line breaks'
17-
}
18-
case 1: {
17+
case 1:
1918
return '1 line break'
20-
}
21-
default: {
19+
default:
2220
return `${lineBreaks} line breaks`
23-
}
2421
}
2522
}
2623

‎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.range[1] : node.endTag.range[0]
81+
const end = node.endTag != null ? node.endTag.range[0] : node.range[1]
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('node:path')
9+
const path = require('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.at(-1).push(current)
54+
propsPerLine[propsPerLine.length - 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.