An ESLint plugin for detecting hard-coded URLs in code. Hard-coded URLs can create dependencies on specific environments and cause bugs when deploying to different environments. This plugin can be used to ensure code portability by checking for hard-coded URLs.
You'll first need to install ESLint:
npm i eslint --save-dev
Next, install eslint-plugin-no-hard-coded-urls
:
npm install eslint-plugin-no-hard-coded-urls --save-dev
Add no-hard-coded-urls
to the plugins section of your .eslintrc
configuration file. You can omit the eslint-plugin-
prefix:
{
"plugins": ["no-hard-coded-urls"]
}
Then configure the rules you want to use under the rules section.
{
"rules": {
"hard-coded-url/no-hard-coded-url": ["error"]
}
}
Name | Description |
---|---|
no-hard-coded-urls | disallow hard coded urls |
Hard-coded URLs in code can create dependencies on specific environments and cause bugs when deploying to different environments. This plugin can help prevent these issues by checking for hard-coded URLs and ensuring code portability.
Contributions are welcome!
This project is licensed under the MIT License.