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
no-restricted-imports with custom messages is throwing a validation error #11717
no-restricted-imports with custom messages is throwing a validation error #11717
Comments
Looks like the ONLY syntax from the examples that works is "no-restricted-imports": ["error", "import1", "import2"] |
Hi @yvele , thanks for this issue. It seems that documentation has something wrong. You can try this: "no-restricted-imports": ["error", [{
"paths": [{
"name": "import-foo",
"message": "Please use import-bar instead."
}]
}]] |
@g-plane I've copy/pasted your config and it's not working either
|
I think the issue is that the severity and options should all be a flat array: {
"no-restricted-imports": [
"error",
{
"name": "import-foo",
"message": "Please use import-bar instead."
}
]
} @yvele Could you please give that a try? And if it works, please advise (or submit a PR) where the documentation needs to be corrected... Thanks! |
Unfortunately, it looks like there wasn't enough interest from the team Thanks for contributing to ESLint and we appreciate your understanding. |
Having the same issue. Tried all the different methods mentioned here to no avail. |
@kumarashwin Please open a new issue and please fill in the information the new issue template asks for (including the configuration you're using). Thanks! |
Example from the original post is indeed wrong in the documentation, it should be as in this comment It seems that the other examples are correct. |
Node 10.15.3 and latest ESLint version.
When configuring the rule with a custom message exactly how it is done in the example page https://eslint.org/docs/rules/no-restricted-imports
I get an ESLint rule validation error
I don't think the documentation is wrong because the rule should accept custom messages as stated here #8400
The text was updated successfully, but these errors were encountered: