Introduce grunt-lintspaces

Change-Id: I1ec92435419a4e660d11b17017e98b2a3b1cc7b6
This commit is contained in:
Vitaly Kramskikh 2014-09-19 18:33:39 -07:00
parent 872e370285
commit 9611242f21
14 changed files with 87 additions and 28 deletions

View File

@ -51,6 +51,23 @@ module.exports = function(grunt) {
}
}
},
lintspaces: {
javascript: {
options: {
newline: true,
indentation: 'spaces',
spaces: 4,
trailingspaces: true,
ignores: ['js-comments']
},
src: [
'static/js/**/*.js',
'static/js/**/*.jsx',
'!static/js/libs/**',
'!static/js/expression/parser.js'
]
}
},
jshint: {
options: {
reporter: require('jshint-stylish'),
@ -289,6 +306,7 @@ module.exports = function(grunt) {
]);
grunt.registerTask('default', ['build']);
grunt.registerTask('lint-ui', [
'lintspaces',
'clean:prepare_build',
'copy:preprocess_js',
'react',

54
npm-shrinkwrap.json generated
View File

@ -16,7 +16,7 @@
},
"colors": {
"version": "0.6.2",
"from": "colors@~0.6.0-1"
"from": "colors@~0.6.2"
},
"dateformat": {
"version": "1.0.2-1.2.3",
@ -924,7 +924,7 @@
},
"lru-cache": {
"version": "2.5.0",
"from": "lru-cache@2"
"from": "lru-cache@~2.5.0"
},
"mkdirp": {
"version": "0.5.0",
@ -1350,7 +1350,7 @@
},
"inherits": {
"version": "2.0.1",
"from": "inherits@~2.0.1"
"from": "inherits@~2.0.0"
},
"ini": {
"version": "1.3.0",
@ -1770,7 +1770,7 @@
},
"mkdirp": {
"version": "0.3.5",
"from": "mkdirp@~0.3.5"
"from": "mkdirp@0.3.5"
},
"cookie": {
"version": "0.1.0",
@ -2012,6 +2012,46 @@
}
}
},
"grunt-lintspaces": {
"version": "0.6.0",
"from": "grunt-lintspaces@~0.6.0",
"dependencies": {
"lintspaces": {
"version": "0.2.1",
"from": "lintspaces@0.2.1",
"dependencies": {
"merge": {
"version": "1.2.0",
"from": "merge@^1.1.2"
},
"editorconfig": {
"version": "0.11.4",
"from": "editorconfig@^0.11.4",
"dependencies": {
"commander": {
"version": "1.1.1",
"from": "commander@~1.1.1",
"dependencies": {
"keypress": {
"version": "0.1.0",
"from": "keypress@0.1.x"
}
}
},
"lru-cache": {
"version": "2.0.4",
"from": "lru-cache@~2.0.0"
},
"sigmund": {
"version": "1.0.0",
"from": "sigmund@~1.0.0"
}
}
}
}
}
}
},
"grunt-react": {
"version": "0.9.0",
"from": "grunt-react@~0.9.0",
@ -2272,7 +2312,7 @@
"dependencies": {
"chalk": {
"version": "0.5.1",
"from": "chalk@~0.5.0",
"from": "chalk@^0.5.1",
"dependencies": {
"ansi-styles": {
"version": "1.1.0",
@ -2288,7 +2328,7 @@
"dependencies": {
"ansi-regex": {
"version": "0.2.1",
"from": "ansi-regex@^0.2.0"
"from": "ansi-regex@^0.2.1"
}
}
},
@ -2298,7 +2338,7 @@
"dependencies": {
"ansi-regex": {
"version": "0.2.1",
"from": "ansi-regex@^0.2.0"
"from": "ansi-regex@^0.2.1"
}
}
},

View File

@ -18,6 +18,7 @@
"grunt-git-revision": "~0.0.1",
"grunt-jison": "~1.2.1",
"grunt-jscs": "~0.7.1",
"grunt-lintspaces": "~0.6.0",
"grunt-react": "~0.9.0",
"grunt-text-replace": "~0.3.12",
"jison": "~0.4.13",

View File

@ -287,7 +287,7 @@ function(React, utils, layoutComponents, Coccyx, coccyxMixins, models, KeystoneC
showCapacityPage: function() {
var task = new models.Task();
task.save({}, {url: '/api/capacity/', method: 'PUT'}).done(_.bind(function() {
this.setPage(CapacityPage, {capacityLog: new models.CapacityLog()});
this.setPage(CapacityPage, {capacityLog: new models.CapacityLog()});
}, this));
}
});

View File

@ -24,7 +24,7 @@ function(React, models, componentMixins, controls) {
'use strict';
var CapacityPage = React.createClass({
mixins: [
mixins: [
React.BackboneMixin('capacityLog'),
componentMixins.pollingMixin(2)
],
@ -46,7 +46,7 @@ function(React, models, componentMixins, controls) {
<h3 className='page-title'>{$.t('capacity_page.title')}</h3>
<div className='capacity page-wrapper'>
{!capacityLog.isNew() ?
<LicenseUsage capacityLog = {capacityLog} />
<LicenseUsage capacityLog = {capacityLog} />
:
<controls.ProgressBar />
}
@ -80,7 +80,7 @@ function(React, models, componentMixins, controls) {
head = {[{label: $.t('capacity_page.total_number_alloc_nodes'), className: headClassName},
{label: $.t('capacity_page.total_number_unalloc_nodes')}]}
body = {[[capacityReport.allocation_stats.allocated,
capacityReport.allocation_stats.unallocated]] }
capacityReport.allocation_stats.unallocated]] }
className = {tableClassName} />
<controls.Table
@ -91,8 +91,8 @@ function(React, models, componentMixins, controls) {
className = {tableClassName} />
<a href='/api/capacity/csv' target='_blank' className='btn btn-info'>
<i className='icon-install'></i>
<span>{$.t('capacity_page.download_report')}</span>
<i className='icon-install'></i>
<span>{$.t('capacity_page.download_report')}</span>
</a>
</div>
);

View File

@ -62,10 +62,10 @@ function(React, utils, models, dialogViews) {
return (
<div className={'action-item-placeholder ' + this.props.className}>
<form className='environment-action-form'>
<h4>{this.props.title}</h4>
<div className='action-item-controls'>
{this.props.children}
</div>
<h4>{this.props.title}</h4>
<div className='action-item-controls'>
{this.props.children}
</div>
</form>
</div>
);

View File

@ -159,7 +159,7 @@ function(utils, models, viewMixins, commonViews, dialogViews, healthcheckTabTemp
},
initialize: function(options) {
_.defaults(this, options);
this.runTestsButton = new Backbone.Model({
this.runTestsButton = new Backbone.Model({
visible: true,
disabled: true
});
@ -394,7 +394,7 @@ function(utils, models, viewMixins, commonViews, dialogViews, healthcheckTabTemp
'.testset-select': {
observe: 'checked',
onSet: _.bind(function(value) {
this.tests.invoke('set', {checked: value});
this.tests.invoke('set', {checked: value});
}, this),
attributes: [{
name: 'disabled',

View File

@ -463,7 +463,7 @@ function(utils, models, commonViews, dialogViews, networkTabTemplate, networkTem
_.each(this.parameters.get('dns_nameservers'), function(nameserver, index) {
_.merge(this.bindings, this.composeRangeFieldBindings('dns_nameservers', index));
}, this);
_.merge(this.bindings, this.composeVlanBindings('fixed_networks_vlan_start'));
_.merge(this.bindings, this.composeVlanBindings('fixed_networks_vlan_start'));
},
render: function() {
this.$el.html(this.template({

View File

@ -837,7 +837,7 @@ function(utils, models, dialogViews, Screen, nodesManagementPanelTemplate, assig
formatStatusLabel: function(value) {
var operatingSystem;
try {
operatingSystem = this.node.collection.cluster.get('release').get('operating_system');
operatingSystem = this.node.collection.cluster.get('release').get('operating_system');
} catch (ignore) {}
operatingSystem = operatingSystem || 'OS';
var labels = {

View File

@ -122,7 +122,7 @@ function(utils, models, viewMixins, commonViews, dialogViews, settingsTabTemplat
var isGroupDisabled = _.bind(function(groupName) {
var groupData = this.settings.get(groupName + '.metadata');
if (groupData.enabled && (groupData.hasDependentRole || this.checkDependentSettings(groupName, 'metadata'))) {
return false;
return false;
}
return groupData.enabled === false || groupData.disabled;
}, this);
@ -307,7 +307,7 @@ function(utils, models, viewMixins, commonViews, dialogViews, settingsTabTemplat
},
updateSettings: function() {
this.settings.expandRestrictions();
_.each(this.settings.attributes, function(group, groupName) {
_.each(this.settings.attributes, function(group, groupName) {
_.each(group, function(setting, settingName) {
this.calculateSettingState(groupName, settingName);
}, this);

View File

@ -236,7 +236,7 @@ define(['jquery', 'underscore', 'react'], function($, _, React) {
controls.ProgressBar = React.createClass({
render: function() {
return (
<div className='progress-bar'>
<div className='progress-bar'>
<div className='progress progress-striped progress-success active'>
<div className='bar'/>
</div>

View File

@ -32,8 +32,8 @@ function(commonViews, loginPageTemplate) {
'keydown input': 'onKeyDown'
},
onKeyDown: function() {
this.$('.login-error-message').hide();
this.$('.login-btn').attr('disabled', false);
this.$('.login-error-message').hide();
this.$('.login-btn').attr('disabled', false);
},
login: function() {
this.$('.login-btn').attr('disabled', true);

View File

@ -91,4 +91,4 @@ function(React, utils, models, dialogs) {
});
return NotificationsPage;
});
});

View File

@ -52,7 +52,7 @@ function(React, controls) {
body={this.props.releases.map(this.getReleaseData)}
className='releases-table' />
:
<div className='alert'>{$.t('release_page.no_releases_message')}</div>
<div className='alert'>{$.t('release_page.no_releases_message')}</div>
}
</div>
</div>