ESLint Plugin: No HTTP Links
The `eslint-plugin-no-http` package provides an ESLint rule specifically designed to prevent the use of insecure `http://` links in source code, enforcing the adoption of `https://` for better security and best practices. Its current stable version is `0.0.3`. Given the very low version number, it likely operates on a slow release cadence, receiving updates primarily for critical bug fixes or compatibility with newer ESLint versions rather than frequent feature additions. This plugin differentiates itself by its singular, focused purpose: identifying and flagging all instances of `http://` within strings, comments, or other relevant code contexts. It offers a straightforward, lightweight solution for teams looking to enforce HTTPS by default without integrating a broader, more complex set of security linting rules.
Common errors
-
ESLint: Cannot read config file: .eslintrc.js
cause ESLint is unable to find or parse the configuration file, possibly due to a syntax error or incorrect path.fixVerify the `.eslintrc` file (e.g., `.eslintrc.json`, `.eslintrc.js`) exists in the project root or specified path, and its syntax is correct. -
ESLint: Failed to load plugin 'no-http'. The plugin 'eslint-plugin-no-http' was not found.
cause The `eslint-plugin-no-http` package has not been installed or is not accessible in the project's `node_modules`.fixRun `npm install eslint-plugin-no-http --save-dev` or `yarn add eslint-plugin-no-http --dev` to install the plugin. -
ESLint: Definition for rule 'no-http/no-http' was not found.
cause The `no-http` plugin is listed in the `plugins` array, but the specific rule `no-http/no-http` is not correctly referenced or the plugin itself failed to load its rules.fixEnsure `"no-http"` is in the `plugins` array and `"no-http/no-http"` is correctly spelled and configured under the `rules` section.
Warnings
- gotcha This plugin is in a very early development stage (v0.0.3). While functional, it might not cover all edge cases or have extensive community support. Users should test thoroughly.
- gotcha Ensure ESLint is installed as a `devDependency` in your project. This plugin cannot function without a compatible ESLint installation.
Install
-
npm install eslint-plugin-no-http -
yarn add eslint-plugin-no-http -
pnpm add eslint-plugin-no-http
Imports
- plugins
import 'eslint-plugin-no-http'
{ "plugins": ["no-http"] } - rules
"no-http": "error"
{ "rules": { "no-http/no-http": "error" } }
Quickstart
{
"env": {
"browser": true,
"node": true,
"es2021": true
},
"extends": [
"eslint:recommended"
],
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": [
"no-http"
],
"rules": {
"no-http/no-http": "warn"
}
}