babel/babel · error

No Babel config file detected for ${config.options.filename}

Error message

No Babel config file detected for ${config.options.filename}. Either disable config file checking with requireConfigFile: false, or configure Babel so that it can find the config files.

What it means

Thrown by @babel/eslint-parser's worker when loadPartialConfigAsync returns a non-null config whose hasFilesystemConfig() is false and the user has not set requireConfigFile:false. The parser needs a Babel config to apply transforms for linting; without one it refuses to proceed rather than silently linting unconfigured code. An extra hint is appended when the filename is inside node_modules, because relative configs (.babelrc / package.json#babel) do not apply there.

Source

Thrown at eslint/babel-eslint-parser/src/worker/configuration.ts:69

    },
  };
}

function validateResolvedConfig(
  config: PartialConfig,
  options: Options,
  parseOptions: InputOptions,
): InputOptions | NormalizedOptions {
  if (config !== null) {
    if (options.requireConfigFile !== false) {
      if (!config.hasFilesystemConfig()) {
        let error = `No Babel config file detected for ${config.options.filename}. Either disable config file checking with requireConfigFile: false, or configure Babel so that it can find the config files.`;

        if (config.options.filename!.includes("node_modules")) {
          error += `\nIf you have a .babelrc.js file or use package.json#babel, keep in mind that it's not used when parsing dependencies. If you want your config to be applied to your whole app, consider using babel.config.js or babel.config.json instead.`;
        }

        throw new Error(error);
      }
    }
    if (config.options) return config.options;
  }

  return getDefaultParserOptions(parseOptions);
}

function getDefaultParserOptions(options: InputOptions): InputOptions {
  return {
    plugins: [],
    ...options,
    babelrc: false,
    configFile: false,
    ignore: undefined,
    only: undefined,
  };
}

View on GitHub (pinned to 06b6eae39d)

Solutions

  1. Set requireConfigFile:false in the parserOptions.babelOptions of your ESLint config (the intended escape hatch for JS that needs no Babel transforms).
  2. Add a babel.config.js (project-wide) or .babelrc (relative) so Babel can resolve configuration for the linted files.
  3. If linting files outside the project root, set rootMode:'upward' so Babel searches upward for the config.

Example fix

// before (eslintrc)
parserOptions: {
  sourceType: "module",
  babelOptions: {}
}

// after
parserOptions: {
  sourceType: "module",
  requireConfigFile: false,
  babelOptions: { babelrc: false, configFile: false }
}
Defensive patterns

Strategy: validation

Validate before calling

// Validate eslint parserOptions before linting
const parserOptions = {
  requireConfigFile: false,
  babelOptions: { babelrc: false, configFile: false },
};
// or ensure a babel config file exists:
const fs = require("fs");
const hasConfig = ["babel.config.js", ".babelrc"].some(f => fs.existsSync(f));
if (!hasConfig) parserOptions.requireConfigFile = false;

Prevention

When it happens

Trigger: validateResolvedConfig at configuration.ts:55 runs after loadPartialConfigAsync. It throws at line 69 when options.requireConfigFile !== false AND config.hasFilesystemConfig() === false. Reached via the WorkerClient path when babelOptions.babelrc and configFile are not both false (parse.ts:41).

Common situations: New project using @babel/eslint-parser with no babel.config.js / .babelrc; linting a file outside the configured rootMode; config file is misnamed; linting node_modules dependencies that have no Babel config.

Related errors


AI-assisted analysis of babel/babel@06b6eae39d (2026-08-03). Data as JSON: /data/errors/4260b173f2694872.json. Report an issue: GitHub.