Comments (5)
Wouldn't help: xojs/eslint-config-xo@fc08f10
The reason you can return top-level in node modules is that they're wrapped by the Node.js runtime in an IIFE. With ES2015 modules they're actually on the top-level where return
is not allowed. Not returning even though it's allowed is probably more future proof. I have been annoyed at not being able to return
in CLI's many times though, so I'm happy to look into this again, but I think the modules
option makes it not work.
from xo.
I think the modules option makes it not work.
That appears to still be true.
I say punt until eslint
moves to the new acorn-based version of Espree. I believe acorn
has better options for disabling this.
Ideally eslint
would automatically detect your module type and allow/dis-allow this accordingly.
from xo.
We now use Babel as the parser and seems it's not that strict and allows return even in modules
. So this is effectively fixed for now.
from xo.
We now use Babel as the parser and seems it's not that strict and allows return even in modules. So this is effectively fixed for now.
Not anymore: 04733f1. This is an issue with AVA now.
from xo.
@novemberborn It's annoying indeed, but it's more spec compliant. return
is not allowed top-level. The reason it works in Node.js is that each CommonJS module is wrapped in an IIFE. I plan on proposing allowing top-level return in JS, but haven't had the time.
from xo.
Related Issues (20)
- [minor] Improve documentation
- Fails with eslint 8.40.0: TypeError: Cannot read properties of undefined (reading 'getAllComments') HOT 6
- Error with 'no-unsafe-*' rules in Vite project HOT 1
- Add `--max-warnings` flag (fail on warnings) HOT 1
- xo --fix: Multiple fails with TypeError: Cannot read properties of undefined (reading 'get') HOT 2
- Expected HOT 2
- Unexpected token with dynamic import with type assertion HOT 1
- In a monorepo with turborepo and typescript which is the best setup? HOT 1
- Support with reviewdog? HOT 1
- Replace native/deprecated stylistic rules with `eslint-stylistic` HOT 2
- Automatic ecmaVersion HOT 2
- Projects in a Turborepo monorepo not using workspace package.json config HOT 2
- Deprecation of Formatting Rules in ESLint v8.53 HOT 5
- Proposal: enable strict-boolean-expressions
- XO seems to not play well with Typescript's array `extends` HOT 1
- EACCESS: permission denied on ignored directory HOT 2
- Reintroduce "length" rules to catch excess HOT 3
- List typescript extensions as well for `extensions` config
- regression: `xo: false` in nested `package.json` is not supported any more HOT 9
- xo does not check for `.xo.config.js` (or any file with dot '.' prefix) HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xo.