1.0.2 • Published 7 years ago

eslint-plugin-no-http-protocol v1.0.2

Weekly downloads
45
License
ISC
Repository
github
Last release
7 years ago

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';
$.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';

Options

None

When Not To Use It

FTP(S) or custom protocols.

Further Reading

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago