Enable 'no-sync' eslint rule

Change-Id: I39baf9b4c06da7f565273d034384b77c1196627b
Implements: blueprint converge-to-eslint-config-openstack
This commit is contained in:
Vitaly Kramskikh 2016-01-21 22:55:25 +03:00
parent 446c8838a7
commit f97a7e3883
5 changed files with 18 additions and 14 deletions

View File

@ -11,7 +11,6 @@
no-warning-comments: 0 # we're ok with FIXMEs
no-undefined: 0 # we're ok with using undefined
no-process-env: 0 # we use it in a few places and are ok with it
no-sync: 0 # it affects our browser code with Sync in function names, like "onModelSync"
# to be fixed and enabled
eqeqeq: 0

View File

@ -39,9 +39,12 @@ var jison = require('gulp-jison');
var validateTranslations = require('./gulp/i18n').validate;
gulp.task('i18n:validate', function() {
var tranlations = JSON.parse(fs.readFileSync('static/translations/core.json'));
var locales = argv.locales ? argv.locales.split(',') : null;
validateTranslations(tranlations, locales);
fs.readFile('static/translations/core.json', function(err, data) {
if (err) throw err;
var tranlations = JSON.parse(data);
var locales = argv.locales ? argv.locales.split(',') : null;
validateTranslations(tranlations, locales);
});
});
var seleniumProcess = null;

View File

@ -179,7 +179,7 @@ class App {
return this.version.fetch()
.then(() => {
this.user.set({authenticated: !this.version.get('auth_required')});
this.patchBackboneSync();
this.overrideBackboneSyncMethod();
if (this.version.get('auth_required')) {
_.extend(this.keystoneClient, this.user.pick('token'));
return this.keystoneClient.authenticate()
@ -243,9 +243,9 @@ class App {
_.defer(() => this.navigate('login', {trigger: true, replace: true}));
}
patchBackboneSync() {
var originalSync = Backbone.sync;
if (originalSync.patched) return;
overrideBackboneSyncMethod() {
var originalSyncMethod = Backbone.sync;
if (originalSyncMethod.patched) return;
Backbone.sync = function(method, model, options = {}) {
// our server doesn't support PATCH, so use PUT instead
if (method == 'patch') {
@ -258,7 +258,7 @@ class App {
.then(() => {
options.headers = options.headers || {};
options.headers['X-Auth-Token'] = app.keystoneClient.token;
return originalSync.call(this, method, model, options);
return originalSyncMethod.call(this, method, model, options);
})
.fail((response) => {
if (response && response.status == 401) {
@ -266,7 +266,7 @@ class App {
}
});
}
return originalSync.call(this, method, model, options);
return originalSyncMethod.call(this, method, model, options);
};
Backbone.sync.patched = true;
}

View File

@ -302,7 +302,7 @@ var VmWareTab = React.createClass({
componentDidMount() {
this.clusterId = this.props.cluster.id;
this.model = this.props.cluster.get('vcenter');
this.model.on('sync', this.onModelSync, this);
this.model.on('sync', this.onModelSync, this); // eslint-disable-line no-sync
this.defaultModel = this.props.cluster.get('vcenter_defaults');
this.defaultsJson = JSON.stringify(this.defaultModel.toJSON());
this.setState({model: this.model, defaultModel: this.defaultModel});
@ -313,7 +313,7 @@ var VmWareTab = React.createClass({
networking_parameters: this.props.cluster.get('networkConfiguration').get('networking_parameters')
});
this.onModelSync();
this.onModelSync(); // eslint-disable-line no-sync
dispatcher.on('vcenter_model_update', () => {
if (this.isMounted()) {
this.forceUpdate();

View File

@ -30,8 +30,10 @@ define(['intern/dojo/node!fs'], function(fs) {
var filename = testOrSuite.id + ' - ' + new Date().toTimeString();
filename = filename.replace(/[\s\*\?\\\/]/g, '_');
filename = targetDir + '/' + filename + '.png';
fs.writeFileSync(filename, buffer);
console.log('Saved screenshot to', filename); // eslint-disable-line no-console
fs.writeFile(filename, buffer, function(err) {
if (err) throw err;
console.log('Saved screenshot to', filename); // eslint-disable-line no-console
});
});
}
},