[React] [tests] Using JSHint instead of JSLint

- for using jsx in React js
- grunt-jsxhint task added

Related to blueprint backbone-to-react

Change-Id: Icab0dce882699a518bb4959847f0294c90558658
This commit is contained in:
Alexandra Morozova 2014-07-23 19:18:30 +03:00 committed by Vitaly Kramskikh
parent fb848a3193
commit 7b236bcfc3
5 changed files with 384 additions and 96 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright 2013 Mirantis, Inc.
* Copyright 2014 Mirantis, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License. You may obtain
@ -49,25 +49,26 @@ module.exports = function(grunt) {
}
}
},
jslint: {
client: {
src: [
'static/js/**/*.js',
'!static/js/libs/**',
'!static/js/expression_parser.js'
],
directives: {
predef: ['requirejs', 'require', 'define', 'app', 'Backbone', '$', '_'],
ass: true,
browser: true,
unparam: true,
nomen: true,
eqeq: true,
vars: true,
white: true,
es5: false
}
}
jshint: {
options: {
reporter: require('jshint-stylish'),
eqeqeq: false,
browser: true,
bitwise: true,
newcap: false,
undef: true,
predef: ['requirejs', 'require', 'define', 'app', 'Backbone', '$', '_'],
strict: true,
lastsemic: true,
scripturl: true,
"-W041": false
},
all: [
'static/js/**/*.js',
'static/js/**/*.jsx',
'!static/js/libs/**',
'!static/js/expression_parser.js'
]
},
less: {
all: {
@ -244,5 +245,6 @@ module.exports = function(grunt) {
'clean:finalize_build'
]);
grunt.registerTask('default', ['build']);
grunt.registerTask('lint-ui', ['jshint']);
grunt.task.loadTasks('grunt');
};

426
npm-shrinkwrap.json generated
View File

@ -266,7 +266,7 @@
"dependencies": {
"qs": {
"version": "0.6.6",
"from": "qs@~0.6.0"
"from": "qs@0.6.6"
},
"json-stringify-safe": {
"version": "5.0.0",
@ -368,7 +368,7 @@
},
"mkdirp": {
"version": "0.3.5",
"from": "mkdirp@~0.3.5"
"from": "mkdirp@0.3.5"
}
}
},
@ -410,7 +410,7 @@
"dependencies": {
"ansi-regex": {
"version": "0.2.1",
"from": "ansi-regex@^0.2.0"
"from": "ansi-regex@^0.2.1"
}
}
},
@ -420,7 +420,7 @@
"dependencies": {
"ansi-regex": {
"version": "0.2.1",
"from": "ansi-regex@^0.2.0"
"from": "ansi-regex@^0.2.1"
}
}
},
@ -536,7 +536,7 @@
"dependencies": {
"inherits": {
"version": "2.0.1",
"from": "inherits@2"
"from": "inherits@~2.0.1"
},
"minimatch": {
"version": "1.0.0",
@ -556,7 +556,7 @@
},
"graceful-fs": {
"version": "3.0.2",
"from": "graceful-fs@^3.0.2"
"from": "graceful-fs@~3.0.1"
},
"handlebars": {
"version": "1.3.0",
@ -696,7 +696,7 @@
"dependencies": {
"async": {
"version": "0.9.0",
"from": "async@^0.9.0"
"from": "async@~0.9.0"
},
"configstore": {
"version": "0.3.1",
@ -798,7 +798,7 @@
},
"mute-stream": {
"version": "0.0.4",
"from": "mute-stream@0.0.4"
"from": "mute-stream@~0.0.4"
},
"readline2": {
"version": "0.1.0",
@ -958,7 +958,7 @@
},
"mime": {
"version": "1.2.11",
"from": "mime@~1.2.9"
"from": "mime@~1.2.11"
}
}
},
@ -1042,7 +1042,7 @@
},
"lru-cache": {
"version": "2.5.0",
"from": "lru-cache@2"
"from": "lru-cache@~2.5.0"
},
"mkdirp": {
"version": "0.5.0",
@ -1060,7 +1060,7 @@
},
"nopt": {
"version": "3.0.1",
"from": "nopt@^3.0.0"
"from": "nopt@~3.0.0"
},
"opn": {
"version": "0.1.2",
@ -1114,7 +1114,7 @@
},
"mime": {
"version": "1.2.11",
"from": "mime@~1.2.11"
"from": "mime@~1.2.9"
},
"forever-agent": {
"version": "0.5.2",
@ -1150,7 +1150,7 @@
},
"async": {
"version": "0.9.0",
"from": "async@>= 0.1.18"
"from": "async@~0.9.0"
}
}
},
@ -1266,7 +1266,7 @@
},
"inherits": {
"version": "2.0.1",
"from": "inherits@2"
"from": "inherits@~2.0.1"
}
}
},
@ -1354,7 +1354,7 @@
},
"inherits": {
"version": "2.0.1",
"from": "inherits@~2.0.0"
"from": "inherits@~2.0.1"
},
"ini": {
"version": "1.2.1",
@ -1566,7 +1566,7 @@
},
"qs": {
"version": "0.6.6",
"from": "qs@~0.6.0"
"from": "qs@0.6.6"
},
"bytes": {
"version": "0.2.1",
@ -1638,7 +1638,7 @@
},
"mkdirp": {
"version": "0.3.5",
"from": "mkdirp@~0.3.5"
"from": "mkdirp@0.3.5"
},
"cookie": {
"version": "0.1.0",
@ -1678,7 +1678,7 @@
},
"async": {
"version": "0.2.10",
"from": "async@~0.2.6"
"from": "async@~0.2.8"
},
"glob": {
"version": "3.2.11",
@ -1748,57 +1748,307 @@
"version": "1.2.1",
"from": "grunt-jison@~1.2.1"
},
"grunt-jslint": {
"version": "1.1.12",
"from": "grunt-jslint@~1.1.1",
"grunt-jsxhint": {
"version": "0.2.0",
"from": "grunt-jsxhint@~0.2.0",
"dependencies": {
"jslint": {
"version": "0.6.2",
"from": "jslint@>=0.5.0",
"proxyquire": {
"version": "1.0.1",
"from": "proxyquire@~1.0.1"
},
"rewire": {
"version": "2.1.0",
"from": "rewire@~2.1.0"
},
"react-tools": {
"version": "0.11.1",
"from": "react-tools@~0.11.1",
"dependencies": {
"exit": {
"version": "0.1.2",
"from": "exit@^0.1.2"
},
"glob": {
"version": "4.0.5",
"from": "glob@~4.0.2",
"commoner": {
"version": "0.9.8",
"from": "commoner@^0.9.6",
"dependencies": {
"inherits": {
"version": "2.0.1",
"from": "inherits@2"
"q": {
"version": "1.0.1",
"from": "q@~1.0.1"
},
"minimatch": {
"version": "1.0.0",
"from": "minimatch@^1.0.0",
"recast": {
"version": "0.7.1",
"from": "recast@~0.7.0",
"dependencies": {
"lru-cache": {
"version": "2.5.0",
"from": "lru-cache@2"
"esprima-fb": {
"version": "5001.1.0-dev-harmony-fb",
"from": "esprima-fb@~5001.1.0-dev-harmony-fb"
},
"sigmund": {
"version": "1.0.0",
"from": "sigmund@~1.0.0"
"source-map": {
"version": "0.1.32",
"from": "source-map@0.1.32",
"dependencies": {
"amdefine": {
"version": "0.1.0",
"from": "amdefine@>=0.0.4"
}
}
},
"cls": {
"version": "0.1.5",
"from": "cls@~0.1.3"
},
"ast-types": {
"version": "0.4.9",
"from": "ast-types@~0.4.7"
}
}
},
"once": {
"version": "1.3.0",
"from": "once@^1.3.0"
"commander": {
"version": "2.2.0",
"from": "commander@~2.2.0"
},
"graceful-fs": {
"version": "3.0.2",
"from": "graceful-fs@^3.0.2"
"version": "2.0.3",
"from": "graceful-fs@~2.0.0"
},
"glob": {
"version": "3.2.11",
"from": "glob@~3.2.9",
"dependencies": {
"inherits": {
"version": "2.0.1",
"from": "inherits@2"
},
"minimatch": {
"version": "0.3.0",
"from": "minimatch@0.3",
"dependencies": {
"lru-cache": {
"version": "2.5.0",
"from": "lru-cache@2"
},
"sigmund": {
"version": "1.0.0",
"from": "sigmund@~1.0.0"
}
}
}
}
},
"mkdirp": {
"version": "0.3.5",
"from": "mkdirp@0.3.5"
},
"private": {
"version": "0.1.5",
"from": "private@~0.1.2"
},
"install": {
"version": "0.1.7",
"from": "install@~0.1.7",
"dependencies": {
"whiskey": {
"version": "0.6.13",
"from": "whiskey@0.6.x",
"dependencies": {
"sprintf": {
"version": "0.1.4",
"from": "sprintf@>= 0.1.1"
},
"async": {
"version": "0.9.0",
"from": "async@>= 0.1.18"
},
"magic-templates": {
"version": "0.1.1",
"from": "magic-templates@= 0.1.1"
},
"rimraf": {
"version": "1.0.1",
"from": "rimraf@= 1.0.1"
},
"terminal": {
"version": "0.1.3",
"from": "terminal@= 0.1.3"
},
"gex": {
"version": "0.0.1",
"from": "gex@= 0.0.1"
},
"simplesets": {
"version": "1.1.6",
"from": "simplesets@= 1.1.6"
},
"logmagic": {
"version": "0.1.4",
"from": "logmagic@= 0.1.4"
},
"underscore": {
"version": "1.7.0",
"from": "underscore@>= 1.4.2"
}
}
}
}
},
"iconv-lite": {
"version": "0.2.11",
"from": "iconv-lite@~0.2.11"
}
}
},
"nopt": {
"version": "3.0.1",
"from": "nopt@^3.0.0",
"esprima-fb": {
"version": "4001.3001.0-dev-harmony-fb",
"from": "esprima-fb@^4001.3001.0-dev-harmony-fb"
}
}
},
"grunt-contrib-jshint": {
"version": "0.10.0",
"from": "grunt-contrib-jshint@0.10.0",
"dependencies": {
"hooker": {
"version": "0.2.3",
"from": "hooker@~0.2.3"
}
}
},
"jshint": {
"version": "2.5.5",
"from": "jshint@~2.5.1",
"dependencies": {
"shelljs": {
"version": "0.3.0",
"from": "shelljs@0.3.x"
},
"underscore": {
"version": "1.6.0",
"from": "underscore@1.6.x"
},
"cli": {
"version": "0.6.4",
"from": "cli@0.6.x",
"dependencies": {
"abbrev": {
"version": "1.0.5",
"from": "abbrev@1"
"glob": {
"version": "3.2.11",
"from": "glob@~ 3.2.1",
"dependencies": {
"inherits": {
"version": "2.0.1",
"from": "inherits@2"
},
"minimatch": {
"version": "0.3.0",
"from": "minimatch@0.3",
"dependencies": {
"lru-cache": {
"version": "2.5.0",
"from": "lru-cache@2"
},
"sigmund": {
"version": "1.0.0",
"from": "sigmund@~1.0.0"
}
}
}
}
}
}
},
"minimatch": {
"version": "0.4.0",
"from": "minimatch@0.x.x",
"dependencies": {
"lru-cache": {
"version": "2.5.0",
"from": "lru-cache@2"
},
"sigmund": {
"version": "1.0.0",
"from": "sigmund@~1.0.0"
}
}
},
"htmlparser2": {
"version": "3.7.3",
"from": "htmlparser2@3.7.x",
"dependencies": {
"domhandler": {
"version": "2.2.0",
"from": "domhandler@2.2"
},
"domutils": {
"version": "1.5.0",
"from": "domutils@1.5"
},
"domelementtype": {
"version": "1.1.1",
"from": "domelementtype@1"
},
"readable-stream": {
"version": "1.1.13",
"from": "readable-stream@1.1",
"dependencies": {
"core-util-is": {
"version": "1.0.1",
"from": "core-util-is@~1.0.0"
},
"isarray": {
"version": "0.0.1",
"from": "isarray@0.0.1"
},
"string_decoder": {
"version": "0.10.31",
"from": "string_decoder@~0.10.x"
},
"inherits": {
"version": "2.0.1",
"from": "inherits@~2.0.1"
}
}
},
"entities": {
"version": "1.0.0",
"from": "entities@1.0"
}
}
},
"console-browserify": {
"version": "1.1.0",
"from": "console-browserify@1.1.x",
"dependencies": {
"date-now": {
"version": "0.1.4",
"from": "date-now@^0.1.4"
}
}
},
"exit": {
"version": "0.1.2",
"from": "exit@0.1.x"
},
"strip-json-comments": {
"version": "0.1.3",
"from": "strip-json-comments@0.1.x"
}
}
},
"jstransform": {
"version": "6.1.0",
"from": "jstransform@~6.1.0",
"dependencies": {
"base62": {
"version": "0.1.1",
"from": "base62@0.1.1"
},
"esprima-fb": {
"version": "4001.3001.0-dev-harmony-fb",
"from": "esprima-fb@~4001.3001.0-dev-harmony-fb"
},
"source-map": {
"version": "0.1.31",
"from": "source-map@0.1.31",
"dependencies": {
"amdefine": {
"version": "0.1.0",
"from": "amdefine@>=0.0.4"
}
}
}
@ -1856,7 +2106,7 @@
},
"graceful-fs": {
"version": "2.0.3",
"from": "graceful-fs@~2.0.3"
"from": "graceful-fs@~2.0.0"
},
"glob": {
"version": "3.2.11",
@ -1904,7 +2154,7 @@
},
"async": {
"version": "0.9.0",
"from": "async@~0.9.0"
"from": "async@>= 0.1.18"
},
"magic-templates": {
"version": "0.1.1",
@ -2010,7 +2260,7 @@
},
"source-map": {
"version": "0.1.39",
"from": "source-map@~0.1.33",
"from": "source-map@0.1.x",
"dependencies": {
"amdefine": {
"version": "0.1.0",
@ -2064,19 +2314,55 @@
}
}
},
"jslint": {
"version": "0.2.11",
"from": "jslint@~0.2.5",
"jshint-stylish": {
"version": "0.4.0",
"from": "jshint-stylish@~0.4.0",
"dependencies": {
"nopt": {
"version": "1.0.10",
"from": "nopt@~1.0.0",
"chalk": {
"version": "0.5.1",
"from": "chalk@^0.5.1",
"dependencies": {
"abbrev": {
"version": "1.0.5",
"from": "abbrev@1"
"ansi-styles": {
"version": "1.1.0",
"from": "ansi-styles@^1.1.0"
},
"escape-string-regexp": {
"version": "1.0.1",
"from": "escape-string-regexp@^1.0.0"
},
"has-ansi": {
"version": "0.1.0",
"from": "has-ansi@^0.1.0",
"dependencies": {
"ansi-regex": {
"version": "0.2.1",
"from": "ansi-regex@^0.2.1"
}
}
},
"strip-ansi": {
"version": "0.3.0",
"from": "strip-ansi@^0.3.0",
"dependencies": {
"ansi-regex": {
"version": "0.2.1",
"from": "ansi-regex@^0.2.1"
}
}
},
"supports-color": {
"version": "0.2.0",
"from": "supports-color@^0.2.0"
}
}
},
"log-symbols": {
"version": "1.0.0",
"from": "log-symbols@^1.0.0"
},
"text-table": {
"version": "0.2.0",
"from": "text-table@^0.2.0"
}
}
},
@ -2150,7 +2436,7 @@
},
"tough-cookie": {
"version": "0.12.1",
"from": "tough-cookie@^0.12.1",
"from": "tough-cookie@>=0.12.0",
"dependencies": {
"punycode": {
"version": "1.3.1",
@ -2174,7 +2460,7 @@
},
"async": {
"version": "0.9.0",
"from": "async@>= 0.1.18"
"from": "async@~0.9.0"
}
}
},
@ -2234,7 +2520,7 @@
},
"mkdirp": {
"version": "0.3.5",
"from": "mkdirp@0.3.5"
"from": "mkdirp@~0.3.5"
},
"clean-css": {
"version": "2.0.8",
@ -2276,7 +2562,7 @@
},
"source-map": {
"version": "0.1.39",
"from": "source-map@0.1.x",
"from": "source-map@~0.1.7",
"dependencies": {
"amdefine": {
"version": "0.1.0",

View File

@ -13,14 +13,14 @@
"grunt-contrib-copy": "~0.5.0",
"grunt-contrib-less": "~0.8.2",
"grunt-contrib-requirejs": "~0.4.1",
"grunt-jison": "~1.2.1",
"grunt-jsxhint": "~0.2.0",
"grunt-debug-task": "~0.1.3",
"grunt-git-revision": "~0.0.1",
"grunt-jison": "~1.2.1",
"grunt-jslint": "~1.1.1",
"grunt-react": "~0.9.0",
"grunt-text-replace": "~0.3.12",
"jison": "~0.4.13",
"jslint": "~0.2.5",
"jshint-stylish": "~0.4.0",
"less": "~1.5.1",
"lodash-node": "~2.4.1",
"requirejs": "~2.1.9",

View File

@ -245,12 +245,12 @@ define(['require', 'expression_parser', 'react'], function(require, ExpressionPa
validateIpCorrespondsToCIDR: function(cidr, ip) {
var result = true;
if (cidr) {
/*jslint bitwise: true*/
/* jshint bitwise: false */
var networkAddressToInt = utils.ipIntRepresentation(cidr.split('/')[0]);
var netmask = ~((Math.pow(2, 32) - 1) >>> cidr.split('/')[1]);
var ipToInt = utils.ipIntRepresentation(ip);
result = (networkAddressToInt & netmask).toString(16) == (ipToInt & netmask).toString(16);
/*jslint bitwise: false*/
/* jshint bitwise: true */
}
return result;
},

View File

@ -159,7 +159,7 @@ function(React, utils, models, componentMixins, dialogs) {
showNodeInfo: function(id) {
var node = new models.Node({id: id});
node.deferred = node.fetch();
(new dialogViews.ShowNodeInfoDialog({node: node})).render();
(new dialogs.ShowNodeInfoDialog({node: node})).render();
},
toggle: function(visible) {
this.props.togglePopover(visible);