Registry /
testing / eslint-plugin-sort-react-dependency-arrays
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
muslnode 18–226 runs
build_error
glibcnode 18–226 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
rules
✓ import { rules } from 'eslint-plugin-sort-react-dependency-arrays'
✗ const rules = require('eslint-plugin-sort-react-dependency-arrays').rules
ESM export; the package is ESM-only. CommonJS require still works for Node, but named import is preferred.
configs
✓ import { configs } from 'eslint-plugin-sort-react-dependency-arrays'
✗ import configs from 'eslint-plugin-sort-react-dependency-arrays'
configs is a named export, not default.
plugin
✓ import sortReactDepArrPlugin from 'eslint-plugin-sort-react-dependency-arrays'
✗ const sortReactDepArrPlugin = require('eslint-plugin-sort-react-dependency-arrays')
Default export is the plugin object. With CommonJS, require returns the default.
Configures the plugin and shows a sorted vs unsorted dependency array in useEffect.
// .eslintrc.json
{
"plugins": ["sort-react-dependency-arrays"],
"rules": {
"sort-react-dependency-arrays/sort": "error"
}
}
// Example React component
import { useEffect } from 'react';
function MyComponent({ flag, value }) {
useEffect(() => {
// ...
}, [value, flag]); // <-- sorted correctly (alphabetically)
useEffect(() => {
// ...
}, [flag, value]); // <-- will trigger lint error; use --fix to reorder
}
Errors
Common errors & fixes
Error: Failed to load plugin 'sort-react-dependency-arrays' declared in '.eslintrc.json': Cannot find module 'eslint-plugin-sort-react-dependency-arrays'
Plugin not installed or missing from node_modules.
fixRun `npm install eslint-plugin-sort-react-dependency-arrays --save-dev`
TypeError: ruleMapper is not a function
Using an older ESLint version (<7) that does not support custom rules properly.
fixUpgrade ESLint to >=7: `npm install eslint@^7 --save-dev`
Parsing error: The keyword 'import' is reserved
Using 'import' in .eslintrc.json (which must be valid JSON).
fixUse 'plugins' array with string names, not import statements inside config.
Cannot read properties of undefined (reading 'sort')
Dependency array is dynamically constructed (e.g., using spread).
fixRewrite to use a static array literal for the autofix to work.
Audit
Dependencies
eslintrequiredPeer dependency; requires ESLint >=7