eslint-plugin-jsx

raw JSON →
0.1.0 verified Sat Apr 25 auth: no javascript

eslint-plugin-jsx v0.1.0 provides JSX-specific linting rules for ESLint, designed specifically for the JSX-to-JS transpiler (not standard JSX like React). It includes rules such as jsx/uses-factory, jsx/factory-in-scope, jsx/mark-used-vars, and jsx/no-undef. This plugin is intended for non-standard JSX syntax and is not compatible with typical React JSX. It is based on eslint-plugin-react but targets a different semantics. The project appears to be a niche solution for a specific transpiler, with no recent updates, suggesting it is in maintenance or deprecated state.

error ESLint: Failed to load plugin 'jsx': Cannot find module 'eslint-plugin-jsx'
cause Plugin not installed or installed in wrong scope (global vs local).
fix
Ensure eslint-plugin-jsx is installed in the same location (global or local) as ESLint.
error Definition for rule 'jsx/uses-factory' was not found
cause Plugin not listed in plugins array or misconfigured.
fix
Add "jsx" to the plugins array in .eslintrc.
error Parsing error: Unexpected token <
cause ESLint parser does not support JSX by default.
fix
Use a parser that supports JSX (e.g., babel-eslint) or disable JSX parsing if not needed. Note that this plugin expects JSX-to-JS transpiler syntax.
breaking This plugin is designed for JSX-to-JS transpiler, not standard React JSX; rules may not work as expected with React.
fix Use eslint-plugin-react instead for React JSX.
gotcha Plugin must be installed in the same location as ESLint (global or local). Mismatch can cause plugin not found errors.
fix Install both ESLint and this plugin in the same scope (both global or both local).
deprecated The package is based on an old version of eslint-plugin-react and may not be maintained. No recent updates.
fix Consider migrating to eslint-plugin-react for active development.
npm install eslint-plugin-jsx
yarn add eslint-plugin-jsx
pnpm add eslint-plugin-jsx

Shows installation and configuration of eslint-plugin-jsx in .eslintrc with its rules.

// Install globally or locally alongside ESLint
// .eslintrc.json
{
  "plugins": ["jsx"],
  "rules": {
    "jsx/uses-factory": [1, {"pragma": "JSX"}],
    "jsx/factory-in-scope": [1, {"pragma": "JSX"}],
    "jsx/mark-used-vars": 1,
    "jsx/no-undef": 1
  }
}

// Example JSX file (for JSX-to-JS transpiler)
// Note: This is not standard React JSX
var el = <div id="foo">text</div>;