-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Add context.isFile
for rules
#12133
Comments
This seems like a reasonable request to me. It would be nice to abstract those internal input placeholders away from rule authors. |
I would be fine with adding a utility like that. But out of curiosity, could you provide an example of a rule that needs to know if it's linting a file or a string? |
This |
|
Good point. I don't think it should be concerned with whether it's a valid filename or existing file. It should only indicate that the |
Unfortunately, it looks like there wasn't enough interest from the team Thanks for contributing to ESLint and we appreciate your understanding. |
@mysticatea I can do a RFC, but it would be good to get some of the open questions here resolved first. |
@mysticatea does the comment above address your concern? |
I'm sorry that I have lost track on this issue.
I guess that the And if we consider eslint/rfcs#35 (it returns |
Unfortunately, it looks like there wasn't enough interest from the team Thanks for contributing to ESLint and we appreciate your understanding. |
@sindresorhus Does @mysticatea's response clarify things? Want to make sure this doesn't get auto closed again :) |
Unfortunately, it looks like there wasn't enough interest from the team Thanks for contributing to ESLint and we appreciate your understanding. |
The version of ESLint you are using.
6.2.1
The problem you want to solve.
I have some ESLint rules that needs to know whether the linted code is a string or an actual file. Currently, I use
context.getFilename() === '<input>' || context.getFilename() === '<text>'
(see sindresorhus/eslint-plugin-unicorn#346).Your take on the correct solution to problem.
Add a
context.isFile
property, so I don't have to check multiple internal filename placeholders.Are you willing to submit a pull request to implement this change?
No
The text was updated successfully, but these errors were encountered: