Registry / testing / eslint-plugin-fetch

eslint-plugin-fetch

JSON →
library0.0.1jsnpmunverified

ESLint plugin to enforce using fetch over other AJAX methods like jQuery's $.ajax, Angular's $http, and XMLHttpRequest. Version 0.0.1 is the only release, with no active development since 2019. Key rules include no-jquery, no-xhr, and no-$http (the latter disabled by default). Differentiates from broader eslint-plugin-compat by focusing solely on fetch preference.

npm install eslint-plugin-fetch
INSTALL
IMPORT
SIG · ESLINT-PLUGIN-FETC
E
eslint-plugin-fetch
testingjavascriptv0.0.1
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
plugins: ['fetch']
plugins: ['eslint-plugin-fetch']
ESLint automatically resolves the 'eslint-plugin-' prefix.
recommended config
extends: ['plugin:fetch/recommended']
extends: ['fetch']
Must use the full plugin prefix when extending.
rules
rules: { 'fetch/no-jquery': 'error' }
rules: { 'no-jquery': 'error' }
Rule names must be prefixed with 'fetch/'.

Shows how to configure the plugin in .eslintrc.json and which patterns are flagged.

// .eslintrc.json { "plugins": ["fetch"], "extends": ["plugin:fetch/recommended"], "rules": { "fetch/no-jquery": "error", "fetch/no-xhr": "error" } } // Example code that triggers errors: // $.ajax({ url: '/api' }); // error: Unexpected jQuery ajax request. // new XMLHttpRequest(); // error: Unexpected XMLHttpRequest. // Allowed: // fetch('/api').then(response => response.json());
Debug
Known issues
deprecatedPackage has not been updated since 2019; consider using eslint-plugin-no-jquery for broader jQuery linting.
fix
Use eslint-plugin-no-jquery or a custom eslint rule.
affects: >=0.0.1
gotchaThe 'no-$http' rule is disabled by default to improve performance; must be explicitly enabled.
fix
Add 'fetch/no-$http': 'error' to rules.
affects: >=0.0.1
deprecatedOnly supports ESLint 1.x legacy config format; incompatible with flat config in ESLint 9+.
fix
Use eslint-plugin-fetch only with ESLint < 9 or convert config to legacy format.
affects: >=0.0.1
Errors
Common errors & fixes
ESLint couldn't find the plugin "eslint-plugin-fetch".
Plugin not installed or config typo.
fix
Run npm install eslint-plugin-fetch --save-dev or check config uses 'fetch' not 'eslint-plugin-fetch'.
Failed to load plugin 'fetch': Cannot find module 'eslint-plugin-fetch'
Local installation missing or global vs local mismatch.
fix
Install plugin locally in project root or globally if ESLint is global.
Configuration for rule "fetch/no-$http" is invalid
Rule is disabled by default but referenced in config.
fix
Ensure rule exists in the plugin version; it's part of 0.0.1, so it's valid.
Upgrade
Version history
0.0.1latest on npm
Audit
Dependencies
eslintrequiredpeer dependency required for plugin to work
Agent activity
2 hits · last 30 days
node
2
Resources
eslint-plugin-fetch — npm install eslint-plugin-fetch · libregistry