no-restricted-imports allow patterns to have custom message in config
See original GitHub issueThe version of ESLint you are using. v6.8.0
The problem you want to solve.
Currently the no-restricted-imports rule config allows us to configure custom message for paths. Proposal is to extend the capability to patterns as well.
"no-restricted-imports": [
"error",
{
"patterns": [
"@lodash/*"
]
}]
Will give us the below linting error when we do "import get from "lodash/get"
"@lodash/* restricted by a pattern"
The error is not informative, something like this will be helpful"@lodash/* restricted by a pattern, {{ customMessage }}"
, so that we can give additional information why we did such pattern restriction.
Your take on the correct solution to problem.
A change in rule config schema for accepting custom message for pattern and modify the eslint output to print the custom message along with the actual output "@lodash/* restricted by a pattern, {{ customMessage }}"
.
Are you willing to submit a pull request to implement this change?
Yes
Issue Analytics
- State:
- Created 3 years ago
- Comments:11 (6 by maintainers)
Top GitHub Comments
I think we already have an accepted issue for this enhancement: #11843
@kaicataldo updated the info