Skip to content

Commit 757daaf

Browse files
armano2JamesHenry
authored andcommitted
[CHORE] enable report-message-format (typescript-eslint#220) (eslint-plugin-eslint-plugin)
1 parent 5833576 commit 757daaf

33 files changed

+824
-810
lines changed

packages/eslint-plugin-typescript/.eslintrc

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"lines-around-comment": "off",
2222
"eslint-plugin/prefer-placeholders": "error",
2323
"eslint-plugin/prefer-replace-text": "error",
24-
"eslint-plugin/no-deprecated-report-api": "error"
24+
"eslint-plugin/no-deprecated-report-api": "error",
25+
"eslint-plugin/report-message-format": ["error", "^[A-Z'{].*[\\.}]$"]
2526
}
2627
}

packages/eslint-plugin-typescript/lib/rules/adjacent-overload-signatures.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ module.exports = {
9393
context.report({
9494
node: member,
9595
message:
96-
"All '{{name}}' signatures should be adjacent",
96+
"All '{{name}}' signatures should be adjacent.",
9797
data: {
9898
name,
9999
},

packages/eslint-plugin-typescript/lib/rules/class-name-casing.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ module.exports = {
6767

6868
context.report({
6969
node: resolvedId,
70-
message: "{{friendlyName}} '{{name}}' must be PascalCased",
70+
message: "{{friendlyName}} '{{name}}' must be PascalCased.",
7171
data: {
7272
friendlyName,
7373
name: resolvedId.name,

packages/eslint-plugin-typescript/lib/rules/generic-type-naming.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ function createTypeParameterChecker(context, rule) {
2929

3030
context.report({
3131
node,
32-
message:
33-
"Type parameter {{name}} does not match rule {{rule}}",
32+
messageId: "paramNotMatchRule",
3433
data,
3534
});
3635
}
@@ -47,6 +46,10 @@ module.exports = {
4746
url:
4847
"https://github.com/nzakas/eslint-plugin-typescript/blob/master/docs/rules/generic-type-naming.md",
4948
},
49+
messages: {
50+
paramNotMatchRule:
51+
"Type parameter {{name}} does not match rule {{rule}}.",
52+
},
5053
},
5154

5255
create(context) {

packages/eslint-plugin-typescript/lib/rules/interface-name-prefix.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,15 @@ module.exports = {
5858
if (isPrefixedWithI(interfaceNode.id.name)) {
5959
context.report({
6060
node: interfaceNode.id,
61-
message: 'Interface name must not be prefixed with "I"',
61+
message:
62+
'Interface name must not be prefixed with "I".',
6263
});
6364
}
6465
} else {
6566
if (!isPrefixedWithI(interfaceNode.id.name)) {
6667
context.report({
6768
node: interfaceNode.id,
68-
message: 'Interface name must be prefixed with "I"',
69+
message: 'Interface name must be prefixed with "I".',
6970
});
7071
}
7172
}

packages/eslint-plugin-typescript/lib/rules/member-naming.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ module.exports = {
5959
context.report({
6060
node: node.key,
6161
message:
62-
"{{accessibility}} property {{name}} should match {{convention}}",
62+
"{{accessibility}} property {{name}} should match {{convention}}.",
6363
data: { accessibility, name, convention },
6464
});
6565
}

packages/eslint-plugin-typescript/lib/rules/no-angle-bracket-type-assertion.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ module.exports = {
3636
context.report({
3737
node,
3838
message:
39-
"Prefer 'as {{cast}}' instead of '<{{cast}}>' when doing type assertions",
39+
"Prefer 'as {{cast}}' instead of '<{{cast}}>' when doing type assertions.",
4040
data: {
4141
cast: sourceCode.getText(
4242
node.typeAnnotation.typeAnnotation

packages/eslint-plugin-typescript/lib/rules/no-empty-interface.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ module.exports = {
3636
node: node.id,
3737
message:
3838
heritage === 0
39-
? "An empty interface is equivalent to `{}`"
39+
? "An empty interface is equivalent to `{}`."
4040
: "An interface declaring no members is equivalent to its supertype.",
4141
});
4242
}

packages/eslint-plugin-typescript/lib/rules/no-inferrable-types.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ module.exports = {
123123
context.report({
124124
node,
125125
message:
126-
"Type {{type}} trivially inferred from a {{type}} literal, remove type annotation",
126+
"Type {{type}} trivially inferred from a {{type}} literal, remove type annotation.",
127127
data: {
128128
type,
129129
},

packages/eslint-plugin-typescript/lib/rules/no-namespace.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ module.exports = {
9797
context.report({
9898
node,
9999
message:
100-
"ES2015 module syntax is preferred over custom TypeScript modules and namespaces",
100+
"ES2015 module syntax is preferred over custom TypeScript modules and namespaces.",
101101
});
102102
},
103103
};

packages/eslint-plugin-typescript/lib/rules/no-non-null-assertion.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ module.exports = {
3131
TSNonNullExpression(node) {
3232
context.report({
3333
node,
34-
message: "Forbidden non-null assertion",
34+
message: "Forbidden non-null assertion.",
3535
});
3636
},
3737
};

packages/eslint-plugin-typescript/lib/rules/no-parameter-properties.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ module.exports = {
8181
context.report({
8282
node,
8383
message:
84-
"Property {{parameter}} cannot be declared in the constructor",
84+
"Property {{parameter}} cannot be declared in the constructor.",
8585
data: {
8686
parameter: node.parameter.name,
8787
},

packages/eslint-plugin-typescript/lib/rules/no-triple-slash-reference.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ module.exports = {
4646
if (referenceRegExp.test(comment.value)) {
4747
context.report({
4848
node: comment,
49-
message: "Do not use a triple slash reference",
49+
message: "Do not use a triple slash reference.",
5050
});
5151
}
5252
});

packages/eslint-plugin-typescript/lib/rules/no-type-alias.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -191,17 +191,17 @@ module.exports = {
191191
function getMessage(compositionType, isRoot, type) {
192192
if (isRoot) {
193193
return type
194-
? `Type ${type} are not allowed`
195-
: "Type aliases are not allowed";
194+
? `Type ${type} are not allowed.`
195+
: "Type aliases are not allowed.";
196196
}
197197

198198
return compositionType === "TSUnionType"
199199
? `${type[0].toUpperCase()}${type.slice(
200200
1
201-
)} in union types are not allowed`
201+
)} in union types are not allowed.`
202202
: `${type[0].toUpperCase()}${type.slice(
203203
1
204-
)} in intersection types are not allowed`;
204+
)} in intersection types are not allowed.`;
205205
}
206206

207207
/**

packages/eslint-plugin-typescript/lib/rules/no-var-requires.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ module.exports = {
3636
context.report({
3737
node,
3838
message:
39-
"Require statement not part of import statement",
39+
"Require statement not part of import statement.",
4040
});
4141
}
4242
},

packages/eslint-plugin-typescript/lib/rules/prefer-namespace-keyword.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ module.exports = {
4848
context.report({
4949
node,
5050
message:
51-
"Use 'namespace' instead of 'module' to declare custom TypeScript modules",
51+
"Use 'namespace' instead of 'module' to declare custom TypeScript modules.",
5252
fix(fixer) {
5353
return fixer.replaceText(moduleType, "namespace");
5454
},

packages/eslint-plugin-typescript/lib/rules/type-annotation-spacing.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ module.exports = {
117117
if (after && nextDelta === 0) {
118118
context.report({
119119
node: punctuatorTokenEnd,
120-
message: "Expected a space after the '{{type}}'",
120+
message: "Expected a space after the '{{type}}'.",
121121
data: {
122122
type,
123123
},
@@ -128,7 +128,7 @@ module.exports = {
128128
} else if (!after && nextDelta > 0) {
129129
context.report({
130130
node: punctuatorTokenEnd,
131-
message: "Unexpected space after the '{{type}}'",
131+
message: "Unexpected space after the '{{type}}'.",
132132
data: {
133133
type,
134134
},
@@ -144,7 +144,7 @@ module.exports = {
144144
if (before && previousDelta === 0) {
145145
context.report({
146146
node: punctuatorTokenStart,
147-
message: "Expected a space before the '{{type}}'",
147+
message: "Expected a space before the '{{type}}'.",
148148
data: {
149149
type,
150150
},
@@ -155,7 +155,7 @@ module.exports = {
155155
} else if (!before && previousDelta > 0) {
156156
context.report({
157157
node: punctuatorTokenStart,
158-
message: "Unexpected space before the '{{type}}'",
158+
message: "Unexpected space before the '{{type}}'.",
159159
data: {
160160
type,
161161
},

0 commit comments

Comments
 (0)