unicorn/prefer-https
eslint-plugin-unicorn
Safe autofix
eslint.config.js
import unicorn from "eslint-plugin-unicorn";
export default [
{
plugins: { unicorn },
rules: {
"unicorn/prefer-https": "error",
},
},
];const url = 'http://sindresorhus.com';// See http://sindresorhus.comconst element = <a href="http://sindresorhus.com">http://sindresorhus.com</a>;const url = 'https://sindresorhus.com';// See https://sindresorhus.comconst element = <a href="https://sindresorhus.com">https://sindresorhus.com</a>;Examples from the ESLint documentation.
unicorn/prefer-https
eslint-plugin-unicorn
import unicorn from "eslint-plugin-unicorn";
export default [
{
plugins: { unicorn },
rules: {
"unicorn/prefer-https": "error",
},
},
];Oxlint does not have this rule.
Biome does not have this rule.
Prefer moving code shared by all branches of an if statement out of the branches.
Prefer .includes() over repeated equality comparisons.
Prefer Object.groupBy() or Map.groupBy() over manual grouping.
Prefer Iterator#toArray() over temporary arrays from iterator spreads.
Prefer .getOrInsertComputed() when the default value has side effects.
Prefer location.assign() over assigning to location.href.