hermes-eslint

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

A custom ESLint parser using the Hermes JavaScript parser, optimized for linting Flow-typed code. Version 0.35.0 is current, with active development on GitHub (facebook/hermes). Unlike babel-eslint or @babel/eslint-parser, hermes-eslint uses Hermes' own parser, ensuring precise adherence to Flow syntax and avoiding potential mismatches. It supports JSX, Flow, and modern ECMAScript features, with options for jsxPragma, jsxFragmentName, sourceType, and FBT. It is the recommended parser for Facebook's internal linting and for projects heavily reliant on Flow.

error Error: Cannot find module 'hermes-eslint'
cause hermes-eslint not installed or ESLint cannot resolve the parser.
fix
Run 'npm install --save-dev hermes-eslint' or ensure it's in your package.json.
error Error: Failed to load parser 'hermes-eslint' (from .eslintrc)
cause Incorrect JSON syntax in .eslintrc or parser name is not a string.
fix
Verify .eslintrc JSON is valid and that 'parser' is set to exactly "hermes-eslint".
error TypeError: parseForESLint is not a function
cause Importing the module incorrectly in a CommonJS environment.
fix
Use dynamic import: const { parseForESLint } = await import('hermes-eslint'); or ensure you are in an ESM context.
breaking Version 0.10.0 dropped support for ESLint < 6.
fix Upgrade ESLint to 6.x or later and use hermes-eslint >=0.10.0.
deprecated The option 'useJSXTextNode' was removed in version 0.15.0.
fix Remove 'useJSXTextNode' from parserOptions; it is no longer necessary.
gotcha If using Flow with hermes-eslint, ensure your ESLint config does not conflict with babel-eslint; both parsers may be active.
fix Set 'parser' to 'hermes-eslint' only for .js/.jsx files; use override patterns if mixing with Babel.
gotcha ESLint's --fix may produce unexpected results with Flow type syntax; some rules may not support autofix.
fix Test --fix on a small file first; disable autofix for rules known to conflict with Flow.
deprecated The 'experimentalObjectRestSpread' option is no longer needed as of ECMAScript 2018.
fix Remove the option; modern parsers support object rest/spread natively.
npm install hermes-eslint
yarn add hermes-eslint
pnpm add hermes-eslint

Configures ESLint to use hermes-eslint as parser with module source type and React JSX pragma.

// .eslintrc.json
{
  "parser": "hermes-eslint",
  "parserOptions": {
    "sourceType": "module",
    "jsxPragma": "React"
  },
  "rules": {
    "no-unused-vars": "error",
    "flowtype/no-types-missing-file-annotation": "off"
  }
}