eslint / eslint/js

Future of ecmaFeatures.globalReturn

Open
#525 22 comments 0 reactions 1 assignee Claimed by @Pixel998 View on GitHub
accepted breaking enhancement
Dominant language
JavaScript
Stars
2.4k
Forks
234
Avg merge
28m
Merged PRs (30d)
2

Description

**Problem:** `globalReturn` can't be used with `sourceType:module`, and right now in ESLint we will detect this combination and set `globalReturn` to `false`. Arguably, this behavior is undesirable because ESLint is silently fixing a problem rather than letting the user know that it happened.

We recently just implemented `sourceType: commonjs`, which effectively makes `ecmaFeatures.globalReturn` obsolete, so there are several options we could pursue going forward:

1. We could remove `ecmaFeatures.globalReturn` altogether. I think this is the cleanest solution now that we have `sourceType: commonjs`, however, we would probably want to throw an error if `ecmaFeatures.globalReturn` is specified to let people know that it has been removed.
2. We could keep `ecmaFeatures.globalReturn` but throw an error if it is used with `sourceType: module`. This error would bubble up to ESLint and to the user, allowing them to fix their configuration.

In either case, we could remove the logic from ESLint completely.

Thoughts?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.