-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
fix: missing placeholders in violation messages for no-unnecessary-type-constraint
and no-unsafe-argument
(and enable eslint-plugin/recommended
rules internally)
#5453
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
6243463
c4265a7
2ec6bb8
ab5d4d5
ec3fb4b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ export default util.createRule({ | |
description: 'Disallow duplicate enum member values', | ||
recommended: 'strict', | ||
}, | ||
hasSuggestions: true, | ||
hasSuggestions: false, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Many of these rules indicated they had suggestions but do not actually provide suggestions. Caught by the eslint-plugin/require-meta-has-suggestions rule. |
||
messages: { | ||
duplicateValue: 'Duplicate enum member value {{value}}.', | ||
}, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,10 +15,9 @@ export default util.createRule<Options, MessageIds>({ | |
docs: { | ||
description: 'Disallow the declaration of empty interfaces', | ||
recommended: 'error', | ||
suggestion: true, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This |
||
}, | ||
fixable: 'code', | ||
hasSuggestions: true, | ||
hasSuggestions: true, // eslint-disable-line eslint-plugin/require-meta-has-suggestions -- https://github.com/not-an-aardvark/eslint-plugin-eslint-plugin/issues/272 | ||
messages: { | ||
noEmpty: 'An empty interface is equivalent to `{}`.', | ||
noEmptyWithSuper: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,7 +31,6 @@ export default util.createRule({ | |
docs: { | ||
description: 'Disallow unnecessary constraints on generic types', | ||
recommended: 'error', | ||
suggestion: true, | ||
}, | ||
hasSuggestions: true, | ||
messages: { | ||
|
@@ -89,6 +88,9 @@ export default util.createRule({ | |
suggest: [ | ||
{ | ||
messageId: 'removeUnnecessaryConstraint', | ||
data: { | ||
constraint, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is an actual bug. This data was missing for the suggestion message and would thus show as I can extract this bug fix into a separate PR if desired. Caught by the eslint-plugin/no-missing-placeholders and eslint-plugin/no-unused-placeholders rules. |
||
}, | ||
fix(fixer): TSESLint.RuleFix | null { | ||
return fixer.replaceTextRange( | ||
[node.name.range[1], node.constraint.range[1]], | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -142,7 +142,7 @@ export default util.createRule<[], MessageIds>({ | |
unsafeArgument: | ||
'Unsafe argument of type `{{sender}}` assigned to a parameter of type `{{receiver}}`.', | ||
unsafeTupleSpread: | ||
'Unsafe spread of a tuple type. The {{index}} element is of type `{{sender}}` and is assigned to a parameter of type `{{reciever}}`.', | ||
'Unsafe spread of a tuple type. The argument is of type `{{sender}}` and is assigned to a parameter of type `{{receiver}}`.', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is an actual bug. The I can extract this bug fix into a separate PR if desired. Caught by the eslint-plugin/no-missing-placeholders and eslint-plugin/no-unused-placeholders rules. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is an actual bug. There is a typo in the I can extract this bug fix into a separate PR if desired. Caught by the eslint-plugin/no-missing-placeholders and eslint-plugin/no-unused-placeholders rules. |
||
unsafeArraySpread: 'Unsafe spread of an `any` array type.', | ||
unsafeSpread: 'Unsafe spread of an `any` type.', | ||
}, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This rule is now included in the
recommended
config.