Registry / testing / eslint-plugin-fetch-options

eslint-plugin-fetch-options

JSON →
library0.0.5jsnpmunverified

An ESLint plugin that enforces explicit fetch() options to prevent insecure default behavior. Version 0.0.5 is the latest, with infrequent releases. It focuses on HTTP fetch security, offering rules like no-fetch-credentials and no-fetch-method to catch missing credentials or method options. Unlike general security linters, it specifically targets fetch() calls.

npm install eslint-plugin-fetch-options
INSTALL
IMPORT
SIG · ESLINT-PLUGIN-FETC
E
eslint-plugin-fetch-options
testingjavascriptv0.0.5
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

plugin object
const plugin = require('eslint-plugin-fetch-options');
for use in eslintrc plugins array
rules
rules: { 'fetch-options/no-fetch-credentials': 'error' }
rule names are prefixed with 'fetch-options/'

Configure ESLint to enforce fetch options using the plugin rules.

// .eslintrc.json { "plugins": ["fetch-options"], "rules": { "fetch-options/no-fetch-credentials": "error", "fetch-options/no-fetch-method": "error" } } // Example code that triggers errors const response = fetch('https://api.example.com/data', {}); // missing credentials, method
Debug
Known issues
gotchaPlugin requires ESLint as a peer dependency; must be installed separately.
fix
Install ESLint: npm install eslint --save-dev
affects: >=0.0.0
gotchaRule names must be prefixed with 'fetch-options/' in configuration.
fix
Use 'fetch-options/no-fetch-credentials' instead of 'no-fetch-credentials'
affects: >=0.0.0
gotchaPlugin only checks fetch calls; other HTTP clients not covered.
fix
Use additional linters for axios, XMLHttpRequest, etc.
affects: >=0.0.0
Errors
Common errors & fixes
Error: Failed to load plugin 'fetch-options': Cannot find module 'eslint-plugin-fetch-options'
Plugin not installed or missing from package.json
fix
npm install eslint-plugin-fetch-options --save-dev
Configuration for rule "no-fetch-credentials" is invalid: Rule "no-fetch-credentials" was not found.
Rule name used without the plugin prefix
fix
Change to "fetch-options/no-fetch-credentials" in .eslintrc
Upgrade
Version history
0.0.5latest on npm
Audit
Dependencies
eslintrequiredrequired peer dependency; the plugin runs as an ESLint rule
Agent activity
4 hits · last 30 days
node
4
Resources
eslint-plugin-fetch-options — npm install eslint-plugin-fetch-options · libregistry