1.2.0 • Published 1 year ago
@doochik/eslint-plugin-location v1.2.0
@doochik/eslint-plugin-location
ESLint plugin for Location.
Installation
$ npm install --save-dev @doochik/eslint-plugin-locationUsage
Add @doochik/eslint-plugin-location to the plugins section of your .eslintrc configuration file:
{
"plugins": [
"@doochik/eslint-plugin-location"
]
}Then configure the rules you want to use under the rules section.
{
"rules": {
"@doochik/location/prefer-new-url": "error"
}
}Rule "location/prefer-new-url"
location/prefer-new-url Forbid location.href.replace() in favor new URL().
Bad examples:
location.replace.href.replace('foo', 'bar')Good examples:
location.replace('https://example.com')
location.href = new URL('https://example.com');
location = new URL('https://example.com');