Skip to content
This repository has been archived by the owner on Oct 30, 2018. It is now read-only.

multiple jslint errors in developer-guide and getting-started code examples #546

Closed
dmitris opened this issue Sep 24, 2012 · 2 comments
Closed

Comments

@dmitris
Copy link
Contributor

dmitris commented Sep 24, 2012

There are multiple jslint issues in the code examples that need to be cleaned-up - otherwise it makes difficult for people to take the examples as basis for their project (you have to fix the jslint errors first) and makes difficult to spot new issues or syntax errors in your own changes. Below are the numbers of jslint errors (from the output of "mojito jslint app .") in some of the subdirectories:

examples/developer-guide:
adding_view_engines 70
binding_events 154
configure_routing 61
device_assets 33
framed_assets 38
generating_urls 27
global_assets 3
hello 13
htmlframe_mojit 22

In the examples/getting-started-guide:
part1 3
part2 18
part3 32
part4 57
part5 88

Example of jslint errors:

$ mojito jslint app . -p
mojits/RoutingMojit/binders/index.js
1 8,44: Expected exactly one space between 'function' and '('.
YUI.add('RoutingMojitBinderIndex', function(Y, NAME) {
2 25,5: Missing 'use strict' statement.
Y.namespace('mojito.binders')[NAME] = {
3 31,23: Expected exactly one space between 'function' and '('.
init: function(mojitProxy) {
4 41,23: Expected exactly one space between 'function' and '('.
bind: function(node) {
mojits/RoutingMojit/controller.server.js
1 7,33: Expected exactly one space between 'function' and '('.
YUI.add('RoutingMojit', function(Y, NAME) {
2 8,3: Missing 'use strict' statement.
Y.namespace('mojito.controllers')[NAME] = {
3 8,3: Expected 'Y' at column 5, not column 3.
Y.namespace('mojito.controllers')[NAME] = {
4 9,5: Expected 'init' at column 9, not column 5.
init: function(config) {
5 9,19: Expected exactly one space between 'function' and '('.
init: function(config) {
6 10,7: Expected 'this' at column 13, not column 7.
this.config = config;
7 11,5: Expected '}' at column 9, not column 5.
},
8 12,5: Expected 'index' at column 9, not column 5.
index: function(ac) {
9 12,20: Expected exactly one space between 'function' and '('.
index: function(ac) {
10 13,7: Expected 'ac' at column 13, not column 7.
ac.done(route_info(ac));
11 13,15: 'route_info' was used before it was defined.
ac.done(route_info(ac));
12 14,5: Expected '}' at column 9, not column 5.
},
13 15,5: Expected 'show' at column 9, not column 5.
show: function(ac){
14 15,19: Expected exactly one space between 'function' and '('.
show: function(ac){
15 15,23: Expected exactly one space between ')' and '{'.
show: function(ac){
16 15,23: Missing space between ')' and '{'.
show: function(ac){
17 16,7: Expected 'ac' at column 13, not column 7.
ac.done(route_info(ac));
18 16,15: 'route_info' was used before it was defined.
ac.done(route_info(ac));
19 17,5: Expected '}' at column 9, not column 5.
}
20 18,3: Expected '}' at column 5, not column 3.
};
21 20,3: Expected 'function' at column 5, not column 3.
function route_info(ac){
22 20,26: Expected exactly one space between ')' and '{'.
function route_info(ac){
23 20,26: Missing space between ')' and '{'.
function route_info(ac){
24 21,5: Expected 'var' at column 9, not column 5.
var methods = "";
25 22,5: Expected 'var' at column 9, not column 5.
var name="";
26 22,9: Combine this with the previous 'var' statement.
var name="";
27 22,13: Missing space between 'name' and '='.
var name="";
28 22,14: Missing space between '=' and ''.
var name="";
29 22,17: Unexpected '(space)'.
var name="";
30 23,5: Expected 'var' at column 9, not column 5.
var action = ac.action;
31 23,9: Combine this with the previous 'var' statement.
var action = ac.action;
32 24,5: Expected 'var' at column 9, not column 5.
var path = ac.http.getRequest().url;
33 24,9: Combine this with the previous 'var' statement.
var path = ac.http.getRequest().url;
34 25,5: Expected 'ac' at column 9, not column 5.
ac.url.getRouteMaker();
35 26,5: Expected 'if' at column 9, not column 5.
if(action==="index" && path==="/"){
36 26,7: Expected exactly one space between 'if' and '('.
if(action==="index" && path==="/"){
37 26,14: Missing space between 'action' and '==='.
if(action==="index" && path==="/"){
38 26,17: Missing space between '===' and 'index'.
if(action==="index" && path==="/"){
39 26,32: Missing space between 'path' and '==='.
if(action==="index" && path==="/"){
40 26,35: Missing space between '===' and '/'.
if(action==="index" && path==="/"){
41 26,39: Expected exactly one space between ')' and '{'.
if(action==="index" && path==="/"){
42 26,39: Missing space between ')' and '{'.
if(action==="index" && path==="/"){
43 27,7: Expected 'name' at column 13, not column 7.
name = ac.app.routes.root_route.name;
44 28,7: Expected 'Object' at column 13, not column 7.
Object.keys(ac.app.routes.root_route.verbs).forEach(function(n) {
45 28,67: Expected exactly one space between 'function' and '('.
Object.keys(ac.app.routes.root_route.verbs).forEach(function(n) {
46 29,9: Expected 'methods' at column 17, not column 9.
methods += n + ", ";
47 30,7: Expected '}' at column 13, not column 7.
});
48 30,10: Unexpected '(space)'.
});
49 31,5: Expected '}' at column 9, not column 5.
}else if(action==="index"){
50 31,6: Expected exactly one space between '}' and 'else'.
}else if(action==="index"){
51 31,6: Too many errors. (63% scanned).

mojits/RoutingMojit/models/model.server.js
1 7,38: Expected exactly one space between 'function' and '('.
YUI.add('RoutingMojitModel', function(Y) {
2 21,5: Missing 'use strict' statement.
Y.mojito.models.RoutingMojit = {
3 23,23: Expected exactly one space between 'function' and '('.
init: function(config) {
4 33,26: Expected exactly one space between 'function' and '('.
getData: function(callback) {
5 34,28: Missing space between ':' and 'data'.
callback({some:'data'});
61 errors found.

@dmitris
Copy link
Contributor Author

dmitris commented Sep 24, 2012

you can run the following command to check for jslint errors in all examples:

$ cd examples
$ mojito jslint app .
path.existsSync is now called fs.existsSync.
Lint report: mojito/examples/artifacts/jslint
2106 errors found.

$ cd developer-guide/
dmitris$ mojito jslint app .
path.existsSync is now called fs.existsSync.
Lint report: mojito/examples/developer-guide/artifacts/jslint
1189 errors found.

$ cd ../getting-started-guide/
dmitris$ mojito jslint app .
path.existsSync is now called fs.existsSync.
Lint report: mojito/examples/getting-started-guide/artifacts/jslint
198 errors found.

@ghost ghost assigned zhouyaoji Sep 25, 2012
lzhan pushed a commit to lzhan/mojito that referenced this issue Oct 11, 2012
lzhan pushed a commit that referenced this issue Oct 11, 2012
fix issue #546 multiple jslint errors in developer-guide
@zhouyaoji
Copy link
Contributor

Merged pull request #641 that fixes jslint errors in getting-started-guide examples.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants