A CLI tool (v1.1.12, npm, available as a global or npx command) for formatting and standardizing React code files. It reorders hooks, functions, and return statements based on a user-defined JSON config, integrates Prettier for consistent formatting, and supports JSX, TSX, JS, TS files. Differentiates itself by focusing on React-specific code organization (e.g., hook ordering) rather than generic formatting alone. Low maintenance frequency; no recent updates.
npm install react-file-formatterNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Formats all React files in directories defined in .reactfileformaterrc.json content property.
Ensure .reactfileformaterrc.json in root contains 'content' with paths like ['./src'].
Use exact string values: 'useContext', 'useState', 'useRef', 'useMutation', 'function', 'ArrowFunctionExpression', 'useEffect', 'return'.
Commit or backup files before running react-file-formatter.
Define all Prettier settings inside the 'prettier' key of config file, or omit to use defaults.
Create .reactfileformaterrc.json in the project root with at least: { "content": ["./src"], "order": [] }Update 'content' with correct relative paths from project root, e.g., "./src/components".
Validate JSON (e.g., using jsonlint) and ensure there are no trailing commas, unquoted keys, etc.
No dependency data recorded yet.