Skip to content

Commit 52a9966

Browse files
authored
Bump eslint-plugin-eslint-plugin to v5 (#2241)
1 parent 9bbef7e commit 52a9966

File tree

193 files changed

+1707
-1645
lines changed

Some content is hidden

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

193 files changed

+1707
-1645
lines changed

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

+12-3
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ function checkMetaValidity(context, exportsNode) {
5656
if (!categories) {
5757
context.report({
5858
node: metaDocs,
59-
message: 'Rule is missing a meta.docs.categories property.',
59+
messageId: 'missingCategories',
6060
fix(fixer) {
6161
const category = getPropertyFromObject('category', metaDocs.value)
6262
if (!category) {
@@ -98,18 +98,27 @@ function checkMetaValidity(context, exportsNode) {
9898
categories.value.name === 'undefined'
9999
)
100100
) {
101-
context.report(categories.value, 'meta.docs.categories must be an array.')
101+
context.report({
102+
node: categories.value,
103+
messageId: 'categoriesMustBeArray'
104+
})
102105
}
103106
}
104107

105108
module.exports = {
106109
meta: {
110+
type: 'problem',
107111
docs: {
108112
description: 'enforce correct use of `meta` property in core rules',
109113
categories: ['Internal']
110114
},
111115
fixable: 'code',
112-
schema: []
116+
schema: [],
117+
messages: {
118+
missingCategories: 'Rule is missing a meta.docs.categories property.',
119+
// eslint-disable-next-line eslint-plugin/report-message-format
120+
categoriesMustBeArray: 'meta.docs.categories must be an array.'
121+
}
113122
},
114123

115124
create(context) {

eslint-internal-rules/no-invalid-meta.js

+20-8
Original file line numberDiff line numberDiff line change
@@ -67,32 +67,44 @@ function checkMetaValidity(context, exportsNode) {
6767
const metaProperty = getMetaPropertyFromExportsNode(exportsNode)
6868

6969
if (!metaProperty) {
70-
context.report(exportsNode, 'Rule is missing a meta property.')
70+
context.report({
71+
node: exportsNode,
72+
messageId: 'missingMeta'
73+
})
7174
return
7275
}
7376

7477
if (!hasMetaDocs(metaProperty)) {
75-
context.report(metaProperty, 'Rule is missing a meta.docs property.')
78+
context.report({
79+
node: 'metaDocs',
80+
messageId: 'missingMetaDocs'
81+
})
7682
return
7783
}
7884

7985
if (!hasMetaDocsCategories(metaProperty)) {
80-
context.report(
81-
metaProperty,
82-
'Rule is missing a meta.docs.categories property.'
83-
)
86+
context.report({
87+
node: metaProperty,
88+
messageId: 'missingMetaDocsCategories'
89+
})
8490
return
8591
}
8692
}
8793

8894
module.exports = {
8995
meta: {
96+
type: 'problem',
9097
docs: {
9198
description: 'enforce correct use of `meta` property in core rules',
9299
categories: ['Internal']
93100
},
94-
95-
schema: []
101+
schema: [],
102+
messages: {
103+
missingMeta: 'Rule is missing a meta property.',
104+
missingMetaDocs: 'Rule is missing a meta.docs property.',
105+
missingMetaDocsCategories:
106+
'Rule is missing a meta.docs.categories property.'
107+
}
96108
},
97109

98110
create(context) {

eslint-internal-rules/require-eslint-community.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,17 @@
22

33
module.exports = {
44
meta: {
5+
type: 'problem',
56
docs: {
67
description: 'enforce use of the `@eslint-community/*` package',
78
categories: ['Internal']
89
},
910
fixable: 'code',
11+
schema: [],
1012
messages: {
1113
useCommunityPackageInstead:
1214
'Please use `@eslint-community/{{name}}` instead.'
13-
},
14-
schema: []
15+
}
1516
},
1617

1718
/** @param {import('eslint').Rule.RuleContext} context */

eslint.config.js

+8-13
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ module.exports = [
2727
},
2828
...eslintrc.plugins('eslint-plugin', 'prettier', 'unicorn'),
2929
...eslintrc.extends(
30-
'plugin:eslint-plugin/recommended',
30+
'plugin:eslint-plugin/all',
3131
'prettier',
3232
'plugin:node-dependencies/recommended',
3333
'plugin:jsonc/recommended-with-jsonc',
@@ -143,8 +143,6 @@ module.exports = [
143143

144144
'prettier/prettier': 'error',
145145
'eslint-plugin/report-message-format': ['error', "^[A-Z`'{].*\\.$"],
146-
'eslint-plugin/prefer-placeholders': 'error',
147-
'eslint-plugin/consistent-output': 'error',
148146

149147
'no-debugger': 'error',
150148
'no-console': 'error',
@@ -199,23 +197,20 @@ module.exports = [
199197
{
200198
files: ['lib/rules/*.js'],
201199
rules: {
202-
'eslint-plugin/no-deprecated-context-methods': 'error',
203-
'eslint-plugin/no-only-tests': 'error',
204-
'eslint-plugin/prefer-object-rule': 'error',
205-
'eslint-plugin/require-meta-docs-description': 'error',
206200
'eslint-plugin/require-meta-docs-url': [
207201
'error',
208-
{
209-
pattern: `https://eslint.vuejs.org/rules/{{name}}.html`
210-
}
202+
{ pattern: 'https://eslint.vuejs.org/rules/{{name}}.html' }
211203
],
212-
'eslint-plugin/require-meta-has-suggestions': 'error',
213-
'eslint-plugin/require-meta-schema': 'error',
214-
'eslint-plugin/require-meta-type': 'error',
215204
'internal/no-invalid-meta': 'error',
216205
'internal/no-invalid-meta-docs-categories': 'error'
217206
}
218207
},
208+
{
209+
files: ['eslint-internal-rules/*.js'],
210+
rules: {
211+
'eslint-plugin/require-meta-docs-url': 'off'
212+
}
213+
},
219214
{
220215
files: ['**/*.json'],
221216
rules: {

lib/rules/attribute-hyphenation.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,11 @@ module.exports = {
6060
},
6161
additionalProperties: false
6262
}
63-
]
63+
],
64+
messages: {
65+
mustBeHyphenated: "Attribute '{{text}}' must be hyphenated.",
66+
cannotBeHyphenated: "Attribute '{{text}}' can't be hyphenated."
67+
}
6468
},
6569
/** @param {RuleContext} context */
6670
create(context) {
@@ -88,9 +92,7 @@ module.exports = {
8892
context.report({
8993
node: node.key,
9094
loc: node.loc,
91-
message: useHyphenated
92-
? "Attribute '{{text}}' must be hyphenated."
93-
: "Attribute '{{text}}' can't be hyphenated.",
95+
messageId: useHyphenated ? 'mustBeHyphenated' : 'cannotBeHyphenated',
9496
data: {
9597
text
9698
},

lib/rules/attributes-order.js

+7-3
Original file line numberDiff line numberDiff line change
@@ -277,9 +277,10 @@ function create(context) {
277277
const prevNode = sourceCode.getText(previousNode.key)
278278
context.report({
279279
node,
280-
message: `Attribute "${currentNode}" should go before "${prevNode}".`,
280+
messageId: 'expectedOrder',
281281
data: {
282-
currentNode
282+
currentNode,
283+
prevNode
283284
},
284285

285286
fix(fixer) {
@@ -439,7 +440,10 @@ module.exports = {
439440
},
440441
additionalProperties: false
441442
}
442-
]
443+
],
444+
messages: {
445+
expectedOrder: `Attribute "{{currentNode}}" should go before "{{prevNode}}".`
446+
}
443447
},
444448
create
445449
}

lib/rules/block-tag-newline.js

-2
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,6 @@ module.exports = {
7272
messages: {
7373
unexpectedOpeningLinebreak:
7474
"There should be no line break after '<{{tag}}>'.",
75-
unexpectedClosingLinebreak:
76-
"There should be no line break before '</{{tag}}>'.",
7775
expectedOpeningLinebreak:
7876
"Expected {{expected}} after '<{{tag}}>', but {{actual}} found.",
7977
expectedClosingLinebreak:

lib/rules/component-definition-name-casing.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,15 @@ module.exports = {
2929
categories: ['vue3-strongly-recommended', 'strongly-recommended'],
3030
url: 'https://eslint.vuejs.org/rules/component-definition-name-casing.html'
3131
},
32-
fixable: 'code', // or "code" or "whitespace"
32+
fixable: 'code',
3333
schema: [
3434
{
3535
enum: allowedCaseOptions
3636
}
37-
]
37+
],
38+
messages: {
39+
incorrectCase: 'Property name "{{value}}" is not {{caseType}}.'
40+
}
3841
},
3942
/** @param {RuleContext} context */
4043
create(context) {
@@ -63,7 +66,7 @@ module.exports = {
6366
if (!casing.getChecker(caseType)(nodeValue)) {
6467
context.report({
6568
node,
66-
message: 'Property name "{{value}}" is not {{caseType}}.',
69+
messageId: 'incorrectCase',
6770
data: {
6871
value: nodeValue,
6972
caseType

lib/rules/component-name-in-template-casing.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,10 @@ module.exports = {
6969
},
7070
additionalProperties: false
7171
}
72-
]
72+
],
73+
messages: {
74+
incorrectCase: 'Component name "{{name}}" is not {{caseType}}.'
75+
}
7376
},
7477
/** @param {RuleContext} context */
7578
create(context) {
@@ -156,7 +159,7 @@ module.exports = {
156159
context.report({
157160
node: open,
158161
loc: open.loc,
159-
message: 'Component name "{{name}}" is not {{caseType}}.',
162+
messageId: 'incorrectCase',
160163
data: {
161164
name,
162165
caseType

lib/rules/define-emits-declaration.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ module.exports = {
1515
url: 'https://eslint.vuejs.org/rules/define-emits-declaration.html'
1616
},
1717
fixable: null,
18-
messages: {
19-
hasArg: 'Use type-based declaration instead of runtime declaration.',
20-
hasTypeArg: 'Use runtime declaration instead of type-based declaration.'
21-
},
2218
schema: [
2319
{
2420
enum: ['type-based', 'runtime']
2521
}
26-
]
22+
],
23+
messages: {
24+
hasArg: 'Use type-based declaration instead of runtime declaration.',
25+
hasTypeArg: 'Use runtime declaration instead of type-based declaration.'
26+
}
2727
},
2828
/** @param {RuleContext} context */
2929
create(context) {

lib/rules/define-props-declaration.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ module.exports = {
1515
url: 'https://eslint.vuejs.org/rules/define-props-declaration.html'
1616
},
1717
fixable: null,
18-
messages: {
19-
hasArg: 'Use type-based declaration instead of runtime declaration.',
20-
hasTypeArg: 'Use runtime declaration instead of type-based declaration.'
21-
},
2218
schema: [
2319
{
2420
enum: ['type-based', 'runtime']
2521
}
26-
]
22+
],
23+
messages: {
24+
hasArg: 'Use type-based declaration instead of runtime declaration.',
25+
hasTypeArg: 'Use runtime declaration instead of type-based declaration.'
26+
}
2727
},
2828
/** @param {RuleContext} context */
2929
create(context) {

lib/rules/first-attribute-linebreak.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ module.exports = {
1414
categories: ['vue3-strongly-recommended', 'strongly-recommended'],
1515
url: 'https://eslint.vuejs.org/rules/first-attribute-linebreak.html'
1616
},
17-
fixable: 'whitespace', // or "code" or "whitespace"
17+
fixable: 'whitespace',
1818
schema: [
1919
{
2020
type: 'object',

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

+6-3
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,11 @@ module.exports = {
4040
},
4141
additionalProperties: false
4242
}
43-
]
43+
],
44+
messages: {
45+
expectedBeforeClosingBracket:
46+
'Expected {{expected}} before closing bracket, but {{actual}} found.'
47+
}
4448
},
4549
/** @param {RuleContext} context */
4650
create(context) {
@@ -83,8 +87,7 @@ module.exports = {
8387
start: prevToken.loc.end,
8488
end: closingBracketToken.loc.start
8589
},
86-
message:
87-
'Expected {{expected}} before closing bracket, but {{actual}} found.',
90+
messageId: 'expectedBeforeClosingBracket',
8891
data: {
8992
expected: getPhrase(expectedLineBreaks),
9093
actual: getPhrase(actualLineBreaks)

lib/rules/html-closing-bracket-spacing.js

+7-3
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ module.exports = {
5959
categories: ['vue3-strongly-recommended', 'strongly-recommended'],
6060
url: 'https://eslint.vuejs.org/rules/html-closing-bracket-spacing.html'
6161
},
62+
fixable: 'whitespace',
6263
schema: [
6364
{
6465
type: 'object',
@@ -70,7 +71,10 @@ module.exports = {
7071
additionalProperties: false
7172
}
7273
],
73-
fixable: 'whitespace'
74+
messages: {
75+
missing: "Expected a space before '{{bracket}}', but not found.",
76+
unexpected: "Expected no space before '{{bracket}}', but found."
77+
}
7478
},
7579
/** @param {RuleContext} context */
7680
create(context) {
@@ -102,7 +106,7 @@ module.exports = {
102106
context.report({
103107
node,
104108
loc: lastToken.loc,
105-
message: "Expected a space before '{{bracket}}', but not found.",
109+
messageId: 'missing',
106110
data: { bracket: sourceCode.getText(lastToken) },
107111
fix: (fixer) => fixer.insertTextBefore(lastToken, ' ')
108112
})
@@ -113,7 +117,7 @@ module.exports = {
113117
start: prevToken.loc.end,
114118
end: lastToken.loc.end
115119
},
116-
message: "Expected no space before '{{bracket}}', but found.",
120+
messageId: 'unexpected',
117121
data: { bracket: sourceCode.getText(lastToken) },
118122
fix: (fixer) =>
119123
fixer.removeRange([prevToken.range[1], lastToken.range[0]])

lib/rules/html-end-tags.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ module.exports = {
1616
url: 'https://eslint.vuejs.org/rules/html-end-tags.html'
1717
},
1818
fixable: 'code',
19-
schema: []
19+
schema: [],
20+
messages: {
21+
missingEndTag: "'<{{name}}>' should have end tag."
22+
}
2023
},
2124
/** @param {RuleContext} context */
2225
create(context) {
@@ -39,7 +42,7 @@ module.exports = {
3942
context.report({
4043
node: node.startTag,
4144
loc: node.startTag.loc,
42-
message: "'<{{name}}>' should have end tag.",
45+
messageId: 'missingEndTag',
4346
data: { name },
4447
fix: (fixer) => fixer.insertTextAfter(node, `</${name}>`)
4548
})

0 commit comments

Comments
 (0)