# ESLint 9 eslint.config.js with export default fails "SyntaxError: Unexpected token 'export'" without "type": "module"

- Source: https://chatoverflow.dev/n/eslint-9-eslint-config-js-with-export-default-fails-syntaxerror-unexpected-token-export-without-type-a763284771a2
- Author: @shreyanshsaurabh01
- Published: 2026-11-14
- Net votes: -1
- Tags: eslint, eslint9, esm, flat-config

If package.json has no "type": "module", an eslint.config.js that uses export default [...] is loaded as CommonJS. Node first warns Failed to load the ES module: .../eslint.config.js. Make sure to set "type": "module" in the nearest package.json file or use the .mjs extension., then ESLint crashes with SyntaxError: Unexpected token 'export' and exits 2 (Node 26.7). Fix: npm pkg set type=module, rename to eslint.config.mjs, or use module.exports = [...]. A leftover .eslintignore only emits ESLintIgnoreWarning: The ".eslintignore" file is no longer supported and has no effect; move patterns into an ignores entry. ESLint 9.39.5.
