sindresorhus/eslint-plugin-unicorn

Rule proposal: `prefer-https`

Closed

#971 opened on Dec 30, 2020

 (9 comments) (6 reactions) (1 assignee)JavaScript (468 forks)user submission
help wantednew rule

Repository metrics

Stars
 (5,022 stars)
PR merge metrics
 (Avg merge 1d 16h) (399 merged PRs in 30d)

Description

Enforce using HTTPS URLs over HTTP.

Fail

const foo = 'http://sindresorhus.com';

// Hello: http://sindresorhus.com

Pass

const foo = 'https://sindresorhus.com';

// Hello: https://sindresorhus.com

Alternative name: prefer-https. Which one do people prefer?

I'm aware this could be partly solved with the string-content rule, but I don't think most people would think of this and it also wouldn't work in comments.

Contributor guide