Comments (7)
@vonWolfehaus I thought eslint is designed for es6, but not es5. Besides, riot's default syntax is es5 + tiny es6 like method declaration, I thought it is not going to work. Maybe I am wrong?
from eslint-plugin-riot.
No, eslint only lints es5 by default - you need a plugin to lint es6+. Riot does use the es6 way of declaring functions, but it is optional. So instead of requiring it, it seems prudent to let developers choose whichever linting rules they want. ESLint was designed to be open-ended and not force any particular version of JS - it all depends on the plugins you use with it.
Didn't you try it without that early return
and a default eslint installation? What happened?
from eslint-plugin-riot.
I don't remember I use some plugin to let eslint lint es6:)
I will have a try to see what will happen, thanks for the suggestion.
from eslint-plugin-riot.
This is my test result:
script (copied from riot official site):
this.items = []
add(e) {
var input = e.target[0]
this.items.push(input.value)
input.value = ''
}
Then use eslint to lint it, I got:
/Users/txchen/localcode/eslinttest/riotes5.js
3:9 error Parsing error: Unexpected token {
✖ 1 problem (1 error, 0 warnings)
So I think eslint by default does not support riot's mini es6 syntax, which is not a standard syntax. http://riotjs.com/guide/#tag-syntax
from eslint-plugin-riot.
I didn't expect it to. People will have to use pure es5 with riot in order to use eslint, which I think is the way to go. Otherwise they can add the es6 plugin.
In the meantime, can you add that function syntax to your plugin as a rule? That would solve the issue and make it work out of the box without having to use extra plugins (eg es6).
from eslint-plugin-riot.
I don't think a rule can solve the problem, it should be parser problem. Both eslint default parser 'esprima' and 'babel-eslint' does not support riot's mini es6 syntax. And honestly I don't think I have bandwidth to create a parser for that, sorry.
BTW, in the README of this plugin, it is called out that this only support 'es6' script type.
from eslint-plugin-riot.
I know your plugin only supports es6, that's why I created this issue :) Thanks for your time anyway though.
from eslint-plugin-riot.
Related Issues (11)
- Need to fix the parsing logic, about the code block HOT 1
- Error/Warning indicators (dots) not displaying in next to line numbers in Sublime Text 2 HOT 1
- Support autofix HOT 1
- Support for riot 4
- Support linting HTML expressions, not just <script> tags
- Was the latest commit pushed to the NPM registry?
- Lint errors not showing in Sublime Text and Atom HOT 12
- Support plain <script> tags? HOT 2
- Riot ES6 syntax produces parsing error HOT 6
- Is it possible to add eslint even when type is empty? HOT 3
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 eslint-plugin-riot.