Registry / testing / eslint-plugin-react-namespace-import

eslint-plugin-react-namespace-import

JSON →
library1.0.5jsnpmunverified

An ESLint plugin that enforces namespace imports (import * as React from 'react') over named or default imports from the React package. Version 1.0.5 is current, with stable API since initial release. Key differentiator: focused solely on a single rule to enforce consistent React import style, unlike broader linting configs. Low maintenance frequency.

npm install eslint-plugin-react-namespace-import
INSTALL
IMPORT
SIG · ESLINT-PLUGIN-REAC
E
eslint-plugin-react-namespace-import
testingjavascriptv1.0.5
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

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

plugin
import plugin from 'eslint-plugin-react-namespace-import'
import { rules } from 'eslint-plugin-react-namespace-import'
Default export provides { rules, configs }.
rules
const { rules } = require('eslint-plugin-react-namespace-import')
const rules = require('eslint-plugin-react-namespace-import').rules
CommonJS require is supported; rule object is under 'rules' key.
configs.recommended
import { configs } from 'eslint-plugin-react-namespace-import'
Access recommended config via configs.recommended for programmatic use.

Install and configure the plugin to enforce namespace imports from React.

// Install plugin npm install --save-dev eslint eslint-plugin-react-namespace-import // .eslintrc.json { "extends": ["plugin:react-namespace-import/recommended"], "rules": { "react-namespace-import/no-namespace-import": "error" } } // Example code that will fail lint: // import React from 'react'; // Correct: import * as React from 'react';
Debug
Known issues
gotchaThe rule only applies to imports from 'react' package; does not check aliases like 'react-dom' or other packages.
fix
Only enforces namespace imports for 'react'; other packages ignored.
affects: >=1.0.0
deprecatedPlugin uses 'no-namespace-import' rule name which is confusing (it actually enforces namespace import).
fix
No fix available; rule name remains as is. Consider it as 'enforce-namespace-import' mentally.
affects: >=1.0.0
gotchaWhen using recommended config, the rule is set to 'warn' by default, not 'error'.
fix
Override rule severity in your own .eslintrc if you want errors.
affects: >=1.0.0
gotchaPlugin does not support customizing the package name to enforce; hardcoded to 'react'.
fix
Use another plugin if you need to enforce namespace imports for other packages.
affects: >=1.0.0
Errors
Common errors & fixes
ESLint couldn't find the plugin "eslint-plugin-react-namespace-import".
Plugin not installed or not in node_modules.
fix
Run npm install --save-dev eslint-plugin-react-namespace-import
Configuration for rule "react-namespace-import/no-namespace-import" is invalid.
Rule referenced incorrectly in plugins or rules section.
fix
Ensure plugin is in 'plugins' array, not 'extends', and rule name is correct.
Cannot read properties of undefined (reading 'no-namespace-import')
Plugin not loaded due to missing or mismatched eslint version.
fix
Ensure eslint version >=0.8.0 and plugin is installed.
Upgrade
Version history
1.0.5latest on npm
Audit
Dependencies
eslintrequiredPeer dependency required for plugin to work
Agent activity
6 hits · last 30 days
node
6
Resources
eslint-plugin-react-namespace-import — npm install eslint-plugin-react-namespace-import · libregistry