Use //my.server.com
instead.
npm i -D eslint-plugin-no-http-protocol
"plugins": ["no-http-protocol"],
"rules": {
"no-http-protocol/no-http-protocol": ["error"]
}
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';
$.get('http://my.site.com');
$.get('https://my.site.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';
$.get('//my.site.com');
let https = '//my.site.com';
None
FTP(S) or custom protocols.