Comments (7)
There's only so much that can be done. Arrow functions that have expression bodies need to be transformed to have a body or else #20 happens.
from babel-eslint.
Can you try with the default ESLint parser to see if you get the same issues?
from babel-eslint.
ESLint parser does not have the same issue with func-names; espree parses Arrow functions as type: "ArrowFunctionExpression"
[1], [2] which is ignored by the func-names rule[3]
Interestingly, the Mozilla Parser API indicates that it should be neither "FunctionExpression" nor "ArrowFunctionExpression" - but actually "ArrowExpression"[4].
Esprima also parses arrows as "ArrowFunctionExpression"[5]
from babel-eslint.
As for space-before-blocks. Esprima counts the inline arrow function as an expression, e.g. () => x*x;
is a BinaryExpression, but does count it as a block when presented with curlies, (e.g. () => { return x*x; }
).
This behaviour seems like the correct way. Espree also follows this same pattern (I cannot link as it does not have an online repl, but I did verify this).
from babel-eslint.
@keithamus Yes, this is because babel-eslint
was designed for eslint
0.15.x before it had ES6 support so it had to convert nodes that ESLint didn't understand to ones that it did. I'm currently tied up in work on the Babel core but I'm more than welcome to a pull request to update all the nodes to 0.16.x.
from babel-eslint.
Totally fine 😄 I just thought I'd add my findings, I doubt I'll be able to find the time to fix this.
Right now I'm using eslint 0.16 with the ES6 features turned on, which seems to be more reliable than babel-eslint.
from babel-eslint.
Should be fixed if you upgrade babel-eslint
to 2.0.0 and eslint
to 0.16.x
, thanks!
from babel-eslint.
Related Issues (20)
- Latest Babel + flow generates "is not defined" errors on star imports HOT 3
- npm WARN [email protected] requires a peer of @babel/core@>=7.2.0 but none is installed HOT 3
- Disabling eslint on file does not work HOT 2
- Using decorator syntax doesn't pass eslint HOT 7
- There are no release notes for 10.1.0 HOT 2
- Imports from sibling directory not parsed using babel config HOT 2
- 11.0.0-beta.2 - Private method is not defined. (eslintno-undef) HOT 7
- eslint returns with parsing error unexpected token HOT 4
- How to use babel-eslint in a non-node JS environment (such as client environment, browser) HOT 6
- Breaking change in Node 13.13 HOT 2
- Typescript: parsing error when using "readonly" in interface HOT 2
- Expected indentation is forced for comments as well HOT 1
- Question: `11.0.0-beta2` Not installing all babel plugins (top level await) HOT 1
- no-unused-vars false positive with typescript types HOT 2
- Feature idea: have a way for eslint-plugin-prettier to share an AST with eslint HOT 4
- Missing 'ImportExpression' in visitorKeys HOT 4
- `RegExpLiteral` is not converted to `Literal` in an edge case HOT 2
- Template-literal rule attempting to run on nullish coalescing operations, and then crashing eslint HOT 1
- Error on 'extends' operator on generic type HOT 1
- works for me 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 babel-eslint.