Files
681124042f Support sourceType: "commonjs" (#17390)
* feat: support sourceType: commonjs

* fix: improve eslint-parser souceType: commonjs handling

* allow sourceType: commonjs in babel/core

* set program.sourceType to script for commonjs

* feat: disallow some allow* parser flags in commonjs mode

* do not set allowReturnOutsideFunction for commonjs source type

* update error messages

* normalize Windows path

* fix option typo

* add souceType: "commonjs" compatibility layer

* update default ecmaVersion to latest

* update eslint-parser docs

---------

Co-authored-by: Nicolò Ribaudo <[email protected]>
2025-06-29 22:34:52 +02:00

15 lines
427 B
JavaScript

import path from "node:path";
import runFixtureTests from "./helpers/run-fixture-tests.js";
import { parseExpression } from "../lib/index.js";
import { fileURLToPath } from "node:url";
runFixtureTests(
path.join(path.dirname(fileURLToPath(import.meta.url)), "expressions"),
(input, options = {}) => {
options.attachComment = false;
return parseExpression(input, options);
},
/* filter */ undefined,
true,
);