-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
[member-ordering] Index signature is considered a method in interface #1186
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
Comments
Index signature support was never added to the rule. |
Even without adding an option to support position of index signature, the rule should be corrected to, at least, ignore index signature when checking order. The tslint replaced rule was not failing in this situation. |
We don't aim for 1:1 replacements with tslint when adding a rule. TSLint rules in many cases have options added that aren't used, or have options that should be on by default, etc. The rule was built by a community member (as has been pretty much every rule). Either nobody has had a use case for this since the rule was implemented, or users have worked around it. Happy to accept a PR to add support, if this functionality is important to you.
|
EDIT: I take it, I'll try to add the signature to the list of items to order. |
fixed in #1190 |
Repro
Expected Result
No error.
Actual Result
Member req should be declared before all method definitions. eslint(@typescript-eslint/member-ordering)
Member res should be declared before all method definitions. eslint(@typescript-eslint/member-ordering)
Additional Info
If I remove the index signature, or put it after the interface members, there is no error.
Versions
@typescript-eslint/eslint-plugin
2.6.1
@typescript-eslint/parser
2.6.1
TypeScript
3.6.4
ESLint
6.6.0
node
12.13.0
npm
6.12.0
The text was updated successfully, but these errors were encountered: