Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions packages/espree/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,6 @@ const options = {
// enable JSX parsing
jsx: false,

// enable return in global scope (set to true automatically when sourceType is "commonjs")
globalReturn: false,

// enable implied strict mode (if ecmaVersion >= 5)
impliedStrict: false
}
Expand Down
3 changes: 0 additions & 3 deletions packages/espree/docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,6 @@ const options = {
// enable JSX parsing
jsx: false,

// enable return in global scope (set to true automatically when sourceType is "commonjs")
globalReturn: false,

// enable implied strict mode (if ecmaVersion >= 5)
impliedStrict: false
}
Expand Down
3 changes: 0 additions & 3 deletions packages/espree/lib/features.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ export default {
// React JSX parsing
jsx: false,

// allow return statement in global scope
globalReturn: false,

// allow implied strict mode
impliedStrict: false
};
8 changes: 6 additions & 2 deletions packages/espree/lib/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,12 @@ export function normalizeOptions(options) {
}
const allowReserved = ecmaVersion === 3 ? (options.allowReserved || "never") : false;
const ecmaFeatures = options.ecmaFeatures || {};
const allowReturnOutsideFunction = options.sourceType === "commonjs" ||
Boolean(ecmaFeatures.globalReturn);

if (Object.hasOwn(ecmaFeatures, "globalReturn")) {
throw new Error("`ecmaFeatures.globalReturn` has been removed. To allow top-level return statements, set `sourceType` to 'commonjs'.");
}

const allowReturnOutsideFunction = options.sourceType === "commonjs";

if (sourceType === "module" && ecmaVersion < 6) {
throw new Error("sourceType 'module' is not supported when ecmaVersion < 2015. Consider adding `{ ecmaVersion: 2015 }` to the parser options.");
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading
Loading