Forbid specifying http(s) protocol in URLs. (no-http-protocol)
Use //my.server.com
instead.
Install
npm i -D eslint-plugin-no-http-protocol
"plugins": "no-http-protocol" "rules": "no-http-protocol/no-http-protocol": "error"
Rule Details
This rule aims to keep URLs protocol netural. The idea is to prevent errors typically when the site is under HTTPS and somewhere there's an HTTP URL left in the code.
Examples of incorrect code for this rule:
var invalidVar = 'http://my.server.com';var invalidVar = 'https://my.server.com';$;$;let http = 'http://my.site.com';let https = 'https://my.site.com';
Examples of correct code for this rule:
var valid = '//my.server.com';$;let https = '//my.site.com';
Options
None
When Not To Use It
FTP(S) or custom protocols.