<commit_before>// Depends on formset.js

(function($){
    $.fn.appsearch = function(opts){
        var options = $.extend({}, $.fn.appsearch.defaults, opts);
        var form = this;
        var _option_template = $("<option />")

        form.data('options', options);

        options.modelSelect.on('change.appsearch', function(){
            // Model has changed; trigger field list update
            var select = $(this);
            var value = select.val();
            if (value == '') {
                form.find('.constraint-form').slideUp('fast', function(){
                    $(this).find('.delete-row').click();
                })
            } else {
                form.trigger('update-field-list.appsearch');

                // Re-initialize the formset after stripping out the add/remove links
                form.find('.add-row,.delete-row').remove(); // formset.js
                form.find('.constraint-form').formset(options.formsetOptions); // formset.js
            }
        });
        form.find('.constraint-field select').on('change.appsearch', function(){
            // Field has changed; trigger operator list update for the target constraint
            var constraintForm = $(this).closest('.constraint-form');
            form.trigger('update-operator-list', [constraintForm]);
        });
        form.find('.constraint-operator select').on('change.appsearch', function(){
            var select = $(this);
            var value = select.val();
            var termInputs = select.closest('.constraint-form').find('.term');

            if (options.termlessOperators.indexOf(value) != -1) {
                // termless operator; hide inputs
                termInputs.slideUp('fast');
            } else {
                if (options.twoTermOperators.indexOf(value) != -1) {
                    // two-term operator; show both inputs
                    termInputs.slideDown('fast');
                } else {
                    // one-term operator; hide second input
                    termInputs.filter('.begin-term').slideDown('fast');
                    termInputs.filter('.end-term').slideUp('fast');
                }
            }
        });

        form.on('update-field-list.appsearch', function(e){
            // Default handler that tries to call a user-supplied function or else the default one
            (options.updateFieldList || function(){
                var modelSelect = form.find('#model-select-wrapper select')
                var modelValue = modelSelect.val();
                var choices = (options.getFields || $.fn.appsearch._getFields)(form, modelValue);

                // Remove all constraint forms but the first one.
                var constraintForms = form.find('.constraint-form');
                constraintForms.slice(1).slideUp('fast', function(){
                    $(this).find('.delete-row').click(); // formset.js
                });

                // 1 or 0 remaining constraint-form divs; make sure 1 exists
                var constraintForm = constraintForms.eq(0);
                if (constraintForm.size() == 0) {
                    form.find('.add-row').click(); // formset.js
                    constraintForm = form.find('.constraint-form');
                }

                // Set the field <option> choices
                var fieldSelect = constraintForm.find('.constraint-field select');
                fieldSelect.empty();
                for (var i = 0; i < choices.length; i++) {
                    var pair = choices[i];
                    fieldSelect.append(_option_template.clone().val(pair[0]).text(pair[1]));
                }

                // Ask for the operator list to update according to the form's field
                form.trigger('update-operator-list', [constraintForm]);
            })(e);
        });
        form.on('update-operator-list.appsearch', function(e, constraintForm){
            (options.updateOperatorList || function(e, constraintForm){
                var fieldSelect = constraintForm.find('.constraint-field select');

                var modelValue = options.modelSelect.val();
                var fieldValue = fieldSelect.val();
                var choices = (options.getOperators || $.fn.appsearch._getOperators)(form, modelValue, fieldValue);

                var operatorSelect = constraintForm.find('.constraint-operator select').empty();
                for (var i = 0; i < choices.length; i++) {
                    operatorSelect.append(_option_template.clone().val(choices[i]).text(choices[i]));
                }

                // Propagate change through the operator <select>, updating the term fields
                operatorSelect.change();
            })(e, constraintForm);
        });

        // Make the form available for chained calls
        return this;
    };

    $.fn.appsearch._getFields = function(form, modelValue){
        var choices = null;
        $.ajax(form.data('options').constraintFieldDataURL, {
            data: {'model': modelValue},
            async: false,
            success: function(response){ choices = response.choices; },
            error: function(){ choices = []; }
        });

        return choices;
    };
    $.fn.appsearch._getOperators = function(form, modelValue, fieldValue){
        var choices = null;
        $.ajax(form.data('options').constraintOperatorDataURL, {
            data: {'model': modelValue, 'field': fieldValue},
            async: false,
            success: function(response){ choices = response.choices; },
            error: function(){ choices = []; }
        });

        return choices;
    };

    $.fn.appsearch.defaults = {
        'constraintFieldDataURL': null,
        'constraintOperatorDataURL': null,
        'modelSelect': null,

        'modelSelectedCallback': null,
        'updateFieldList': null,
        'updateOperatorList': null,
        'constraintFormChanged': null,

        'getFields': null,
        'getOperators': null,

        'termlessOperators': ["exists", "doesn't exist"],
        'twoTermOperators': ["range"],

        'formsetOptions': null,
    };
})(jQuery);
<commit_msg>Add data format tip<commit_after>// Depends on formset.js

(function($){
    $.fn.appsearch = function(opts){
        var options = $.extend({}, $.fn.appsearch.defaults, opts);
        var form = this;
        var _option_template = $("<option />")

        form.data('options', options);

        options.modelSelect.on('change.appsearch', function(){
            // Model has changed; trigger field list update
            var select = $(this);
            var value = select.val();
            if (value == '') {
                form.find('.constraint-form').slideUp('fast', function(){
                    $(this).find('.delete-row').click();
                })
            } else {
                form.trigger('update-field-list.appsearch');

                // Re-initialize the formset after stripping out the add/remove links
                form.find('.add-row,.delete-row').remove(); // formset.js
                form.find('.constraint-form').formset(options.formsetOptions); // formset.js
            }
        });
        form.find('.constraint-field select').on('change.appsearch', function(){
            // Field has changed; trigger operator list update for the target constraint
            var select = $(this);
            var option = select.find(':selected');
            var constraintForm = select.closest('.constraint-form');
            form.trigger('update-operator-list', [constraintForm]);

            // Set the description text
            var fieldType = option.attr('data-type');
            var fieldText = option.text();
            var fieldValue = option.val();
            var descriptionBox = constraintForm.find('.description');
            form.trigger('set-field-description', [descriptionBox, fieldType, fieldText, fieldValue, constraintForm]);
        });
        form.find('.constraint-operator select').on('change.appsearch', function(){
            var select = $(this);
            var option = select.find(':selected');
            var value = select.val();

            var constraintForm = select.closest('.constraint-form')
            var termInputs = constraintForm.find('.term');

            if (options.termlessOperators.indexOf(value) != -1) {
                // termless operator; hide inputs
                termInputs.slideUp('fast');
            } else {
                if (options.twoTermOperators.indexOf(value) != -1) {
                    // two-term operator; show both inputs
                    termInputs.slideDown('fast');
                } else {
                    // one-term operator; hide second input
                    termInputs.filter('.begin-term').slideDown('fast');
                    termInputs.filter('.end-term').slideUp('fast');
                }
            }
        });

        form.on('update-field-list.appsearch', function(e){
            // Default handler that tries to call a user-supplied function or else the default one
            (options.updateFieldList || function(){
                var modelSelect = form.find('#model-select-wrapper select')
                var modelValue = modelSelect.val();
                var choices = (options.getFields || $.fn.appsearch._getFields)(form, modelValue);

                // Remove all constraint forms but the first one.
                var constraintForms = form.find('.constraint-form');
                constraintForms.slice(1).slideUp('fast', function(){
                    $(this).find('.delete-row').click(); // formset.js
                });

                // 1 or 0 remaining constraint-form divs; make sure 1 exists
                var constraintForm = constraintForms.eq(0);
                if (constraintForm.size() == 0) {
                    form.find('.add-row').click(); // formset.js
                    constraintForm = form.find('.constraint-form');
                }

                // Set the field <option> choices
                var fieldSelect = constraintForm.find('.constraint-field select');
                fieldSelect.empty();
                for (var i = 0; i < choices.length; i++) {
                    var info = choices[i];
                    var option = _option_template.clone().val(info[0]).text(info[1]);
                    option.attr('data-type', info[2]);
                    fieldSelect.append(option);
                }
                fieldSelect.change();

                // Ask for the operator list to update according to the form's field
                form.trigger('update-operator-list', [constraintForm]);
            })(e);
        });
        form.on('update-operator-list.appsearch', function(e, constraintForm){
            (options.updateOperatorList || function(e, constraintForm){
                var fieldSelect = constraintForm.find('.constraint-field select');

                var modelValue = options.modelSelect.val();
                var fieldValue = fieldSelect.val();
                var choices = (options.getOperators || $.fn.appsearch._getOperators)(form, modelValue, fieldValue);

                var operatorSelect = constraintForm.find('.constraint-operator select').empty();
                for (var i = 0; i < choices.length; i++) {
                    operatorSelect.append(_option_template.clone().val(choices[i]).text(choices[i]));
                }

                // Propagate change through the operator <select>, updating the term fields
                operatorSelect.change();
            })(e, constraintForm);
        });
        form.on('set-field-description.appsearch', function(e, descriptionBox, type, text, value, constraintForm){
            (options.setFieldDescription || function(){
                var description;
                if (type == "text") {
                    description = "Text";
                } else if (type == "date") {
                    description = "Date format: MM-DD-YYYY";
                } else if (type == "number") {
                    description = "Number";
                } else if (type == "boolean") {
                    description = "true or false"
                    // TODO: Change term input to <select> somewhere...
                } else {
                    console.warn("Unknown field type:", type);
                }

                descriptionBox.text(description);
            })(e, descriptionBox, type, text, value, constraintForm);
        });

        // Make the form available for chained calls
        return this;
    };

    $.fn.appsearch._getFields = function(form, modelValue){
        var choices = null;
        $.ajax(form.data('options').constraintFieldDataURL, {
            data: {'model': modelValue},
            async: false,
            success: function(response){ choices = response.choices; },
            error: function(){ choices = []; }
        });

        return choices;
    };
    $.fn.appsearch._getOperators = function(form, modelValue, fieldValue){
        var choices = null;
        $.ajax(form.data('options').constraintOperatorDataURL, {
            data: {'model': modelValue, 'field': fieldValue},
            async: false,
            success: function(response){ choices = response.choices; },
            error: function(){ choices = []; }
        });

        return choices;
    };

    $.fn.appsearch.defaults = {
        'constraintFieldDataURL': null,
        'constraintOperatorDataURL': null,
        'modelSelect': null,

        'modelSelectedCallback': null,
        'updateFieldList': null,
        'updateOperatorList': null,
        'constraintFormChanged': null,
        'setFieldDescription': null,

        'getFields': null,
        'getOperators': null,

        'termlessOperators': ["exists", "doesn't exist"],
        'twoTermOperators': ["range"],

        'formsetOptions': null,
    };
})(jQuery);
<|endoftext|>


<commit_before>var eventproxy = require('eventproxy');
var superagent = require('superagent');
var cheerio = require('cheerio');
var url = require('url');

var cnodeUrl = 'https://cnodejs.org/';

superagent.get(cnodeUrl)
  .end(function(err, res){
	  if (err) {
	  	 	return console.error(err);
	  	 }
	  	 var topicUrls = [];
	  	 var $ = cheerio.load(res.text);

	  	 $('#topic_list .topic_title').each(function(idx, element){
	  	 	var $element = $(element);

	  	 	var href = url.resolve(cnodeUrl, $element.attr('href'));
	  	 	topicUrls.push(href);
	  	 });

	  	 console.log(topicUrls);

  	  var ep = new eventproxy();

	  ep.after('topic_html',topicUrls.length, function(topics){
	  	topics = topics.map(function(topicPair){
	  		var topicUrl =  topicPair[0];
	  		var topicHtml = topicPair[1];
	  		var $ = cheerio.load(topicHtml);
	  		return({
	  			title: $('.topic_full_title').text().trim(),
	  			href: topicUrl,
	  			comment1: $('.reply_content').eq(0).text().trim(),
	  		});
	  	});

	  	console.log('final:');
	  	console.log(topics);
	  });

	  topicUrls.forEach(function(topicUrl){
	  	superagent.get(topicUrl)
	  	  .end(function(err, res){
	  	  	console.log('fetch ' + topicUrl + ' successful');
	  	  	ep.emit('topic_html', [topicUrl, res.text]);
	  	  });
	  });
  });

<commit_msg>divide request into 3 in each bunch<commit_after>var eventproxy = require('eventproxy');
var superagent = require('superagent');
var cheerio = require('cheerio');
var url = require('url');

var cnodeUrl = 'https://cnodejs.org/';

superagent.get(cnodeUrl)
  .end(function(err, res){
	  if (err) {
	  	 	return console.error(err);
	  	 }
	  var topicUrls = [];
	  var $ = cheerio.load(res.text);

	  $('#topic_list .topic_title').each(function(idx, element){
	  	var $element = $(element);

	 	var href = url.resolve(cnodeUrl, $element.attr('href'));
	    topicUrls.push(href);
	 });

	  console.log(topicUrls);

  	  var ep = new eventproxy();
  	  // var epAll = new eventproxy();

  	  var  size = 3;

  	  var result = []

  	  var originalSize = topicUrls.length;

  	  ep.after('bunch',Math.ceil(topicUrls.length/size), function(topicAys){
  	  	  console.log('bunch');
  	  	  console.log(topicAys);
  	  });

  	  fetchCommentsForUrls(topicUrls, result);

  	//   while(topicUrls.length > 0){
  	//   	tempUrls = topicUrls.splice(0,size);

  	//     ep.after('topic_html',tempUrls.length, function(topics){
	  // 	   topics = topics.map(function(topicPair){
	  // 		var topicUrl =  topicPair[0];
	  // 		var topicHtml = topicPair[1];
	  // 		var $ = cheerio.load(topicHtml);
	  // 		return({
	  // 			title: $('.topic_full_title').text().trim(),
	  // 			href: topicUrl,
	  // 			comment1: $('.reply_content').eq(0).text().trim(),
	  // 		});
	  // 	});

	  // 	console.log('final:');
	  // 	console.log(topics);
	  //   result = result.concat(topics);
   //      ep.emit('bunch', topics);

	  // });

	  // tempUrls.forEach(function(topicUrl){
	  // 	superagent.get(topicUrl)
	  // 	  .end(function(err, res){
	  // 	  	console.log('fetch ' + topicUrl + ' successful');
	  // 	  	ep.emit('topic_html', [topicUrl, res.text]);
	  // 	  });
	  // });
  	 // }

  });

function fetchCommentsForUrls(topicUrls, result){
    if (topicUrls.length == 0) {
    	return ;
    }

    var size = 3;
    var ep = new eventproxy();

    var  tempUrls = topicUrls.splice(0,size);

    ep.after('topic_html',tempUrls.length, function(topics){
	  	   topics = topics.map(function(topicPair){
	  		var topicUrl =  topicPair[0];
	  		var topicHtml = topicPair[1];
	  		var $ = cheerio.load(topicHtml);
	  		return({
	  			title: $('.topic_full_title').text().trim(),
	  			href: topicUrl,
	  			comment1: $('.reply_content').eq(0).text().trim(),
	  		});
	  	});

	  	console.log('final:');
	  	console.log(topics);
        ep.emit('bunch', topics);

        result = result.concat(topics);

        if (topicUrls.length > 0) {
        	fetchCommentsForUrls(topicUrls, result);
        }else{
        	console.log('result');
        	console.log(result);
        }

	  });

	  tempUrls.forEach(function(topicUrl){
	  	superagent.get(topicUrl)
	  	  .end(function(err, res){
	  	  	console.log('fetch ' + topicUrl + ' successful');
	  	  	ep.emit('topic_html', [topicUrl, res.text]);
	  	  });
	  });
};

<|endoftext|>


<commit_before>module.exports = {
  parser: '@typescript-eslint/parser',
  env: {
    browser: true,
    node: true,
    es6: true
  },
  parserOptions: {
    ecmaVersion: 6,
    sourceType: 'module',
    ecmaFeatures: {
      jsx: true
    }
  },
  ignorePatterns: ['**/*.scss'],
  plugins: [
    'react',
    '@typescript-eslint'
  ],
  extends: [
    'eslint:recommended',
    'plugin:@typescript-eslint/recommended'
  ],
  rules: {
    '@typescript-eslint/array-type': [1, {default: 'array-simple'}],
    '@typescript-eslint/ban-types': 1,
    '@typescript-eslint/comma-dangle': [1, 'always-multiline'],
    '@typescript-eslint/comma-spacing': [1, { 'before': false, 'after': true }],
    '@typescript-eslint/consistent-type-definitions': [1, 'interface'],
    '@typescript-eslint/consistent-type-imports': [1, {prefer: 'type-imports'}],
    '@typescript-eslint/func-call-spacing': [1, 'never'],
    '@typescript-eslint/keyword-spacing': [1, {before: true, after: true}],
    '@typescript-eslint/member-delimiter-style': [1, {
      multiline: {delimiter: 'semi'},
      singleline: {delimiter: 'semi'}
    }],
    '@typescript-eslint/method-signature-style': [1, 'property'],
    '@typescript-eslint/naming-convention': [1,
      {selector: 'variableLike', format: ['camelCase', 'PascalCase']},
      {selector: 'memberLike', format: ['camelCase']},
      {selector: 'typeLike', format: ['PascalCase']},
      {selector: 'property', format: ['camelCase']},
      {selector: 'method', format: ['camelCase']}
    ],
    '@typescript-eslint/no-confusing-non-null-assertion': 1,
    '@typescript-eslint/no-dupe-class-members': 1,
    '@typescript-eslint/no-duplicate-imports': [1, { 'includeExports': true }],
    '@typescript-eslint/no-dynamic-delete': 1,
    '@typescript-eslint/no-empty-function': 1,
    '@typescript-eslint/no-empty-interface': 1,
    'no-empty-pattern': 1,
    '@typescript-eslint/no-explicit-any': 1,
    '@typescript-eslint/no-extra-parens': 1,
    '@typescript-eslint/no-extra-semi': 1,
    '@typescript-eslint/no-inferrable-types': 1,
    '@typescript-eslint/no-invalid-void-type': 1,
    '@typescript-eslint/no-loop-func': 1,
    '@typescript-eslint/no-parameter-properties': 1,
    '@typescript-eslint/no-shadow': 1,
    '@typescript-eslint/no-this-alias': 1,
    '@typescript-eslint/no-unused-expressions': 1,
    '@typescript-eslint/no-unused-vars': 1,
    '@typescript-eslint/no-use-before-define': 1,
    '@typescript-eslint/no-useless-constructor': 1,
    '@typescript-eslint/no-var-requires': 1,
    '@typescript-eslint/object-curly-spacing': 1,
    '@typescript-eslint/prefer-enum-initializers': 1,
    '@typescript-eslint/prefer-optional-chain': 1,
    '@typescript-eslint/quotes': ['warn', 'single', {'avoidEscape': true}],
    '@typescript-eslint/semi': 1,
    '@typescript-eslint/sort-type-union-intersection-members': 1,
    '@typescript-eslint/space-before-function-paren': [1, {
      anonymous: 'always',
      named: 'never',
      asyncArrow: 'never'
    }],
    '@typescript-eslint/type-annotation-spacing': [1, {before: false, after: true}],
    '@typescript-eslint/unified-signatures': 1,
    'arrow-body-style': [1, 'as-needed', {'requireReturnForObjectLiteral': true}],
    'arrow-parens': [1, 'always'],
    'arrow-spacing': 1,
    'block-spacing': [1, 'never'],
    'brace-style': [1, '1tbs', {'allowSingleLine': true}],
    'comma-dangle': 'off',
    'comma-spacing': 'off',
    'curly': 1,
    'eol-last': [1, 'always'],
    'eqeqeq': 1,
    'func-call-spacing': 'off',
    'jsx-quotes': ['warn', 'prefer-single'],
    'key-spacing': [1, { 'beforeColon': false, 'afterColon': true, 'mode': 'strict' }],
    'max-nested-callbacks': [1, 6],
    'no-case-declarations': 1,
    'no-confusing-arrow': 1,
    'no-console': 1,
    'no-control-regex': 0,
    'no-debugger': 1,
    'no-duplicate-imports': 'off',
    'no-extend-native': 1,
    'no-extra-bind': 1,
    'no-extra-boolean-cast': 1,
    'no-extra-semi': 1,
    'no-fallthrough': 1,
    'no-inner-declarations': 1,
    'no-irregular-whitespace': 1,
    'no-lonely-if': 1,
    'no-mixed-spaces-and-tabs': 1,
    'no-multi-spaces': 1,
    'no-multiple-empty-lines': [1, {'max': 2, 'maxEOF': 1}],
    'no-prototype-builtins': 1,
    'no-trailing-spaces': 1,
    'no-undef-init': 1,
    'no-undef': 1,
    'no-unexpected-multiline': 1,
    'no-unused-expressions': 'off',
    'no-useless-escape': 1,
    'no-useless-rename': 1,
    'no-var': 1,
    'no-whitespace-before-property': 1,
    'one-var': ['warn', 'never'],
    'prefer-const': 1,
    'prefer-spread': 1,
    'quotes': 'off',
    'react/jsx-boolean-value': 1,
    'react/jsx-no-undef': 2,
    'react/jsx-sort-prop-types': 0,
    'react/jsx-sort-props': 0,
    'react/jsx-uses-react': 2,
    'react/jsx-uses-vars': 2,
    'react/no-did-mount-set-state': 0,
    'react/no-did-update-set-state': 2,
    'react/no-multi-comp': 0,
    'react/no-unknown-property': 0,
    'react/prop-types': 0,
    'react/react-in-jsx-scope': 2,
    'react/self-closing-comp': 2,
    'react/wrap-multilines': 0,
    'semi-spacing': [1, {'before': false, 'after': true}],
    'semi-style': [1, 'last'],
    'semi': 'off',
    'space-before-function-paren': 'off',
    'space-in-parens': [1, 'never'],
    'space-infix-ops': 1,
    'strict': 1,
  },
  globals: {
    inject: false,
    module: false,
    describe: false,
    it: false,
    before: false,
    beforeEach: false,
    after: false,
    afterEach: false,
    expect: false,
    window: false,
    document: false,
    Parse: false,
    chai: true,
    t: 'readonly',
    $: 'readonly',
    ga: 'readonly'
  }
}
<commit_msg>remove broken(?) rules<commit_after>module.exports = {
  parser: '@typescript-eslint/parser',
  env: {
    browser: true,
    node: true,
    es6: true
  },
  parserOptions: {
    ecmaVersion: 6,
    sourceType: 'module',
    ecmaFeatures: {
      jsx: true
    }
  },
  ignorePatterns: ['**/*.scss'],
  plugins: [
    'react',
    '@typescript-eslint'
  ],
  extends: [
    'eslint:recommended',
    'plugin:@typescript-eslint/recommended'
  ],
  rules: {
    '@typescript-eslint/array-type': [1, {default: 'array-simple'}],
    '@typescript-eslint/ban-types': 1,
    '@typescript-eslint/comma-dangle': [1, 'always-multiline'],
    '@typescript-eslint/comma-spacing': [1, { 'before': false, 'after': true }],
    '@typescript-eslint/consistent-type-definitions': [1, 'interface'],
    '@typescript-eslint/consistent-type-imports': [1, {prefer: 'type-imports'}],
    '@typescript-eslint/func-call-spacing': [1, 'never'],
    '@typescript-eslint/keyword-spacing': [1, {before: true, after: true}],
    '@typescript-eslint/member-delimiter-style': [1, {
      multiline: {delimiter: 'semi'},
      singleline: {delimiter: 'semi'}
    }],
    '@typescript-eslint/method-signature-style': [1, 'property'],
    '@typescript-eslint/naming-convention': [1,
      {selector: 'variableLike', format: ['camelCase', 'PascalCase']},
      {selector: 'memberLike', format: ['camelCase']},
      {selector: 'typeLike', format: ['PascalCase']},
      {selector: 'property', format: ['camelCase']},
      {selector: 'method', format: ['camelCase']}
    ],
    '@typescript-eslint/no-confusing-non-null-assertion': 1,
    '@typescript-eslint/no-dupe-class-members': 1,
    '@typescript-eslint/no-duplicate-imports': [1, { 'includeExports': true }],
    '@typescript-eslint/no-dynamic-delete': 1,
    '@typescript-eslint/no-empty-function': 1,
    '@typescript-eslint/no-empty-interface': 1,
    'no-empty-pattern': 1,
    '@typescript-eslint/no-explicit-any': 1,
    '@typescript-eslint/no-extra-parens': 1,
    '@typescript-eslint/no-extra-semi': 1,
    '@typescript-eslint/no-inferrable-types': 1,
    '@typescript-eslint/no-invalid-void-type': 1,
    '@typescript-eslint/no-loop-func': 1,
    '@typescript-eslint/no-parameter-properties': 1,
    '@typescript-eslint/no-shadow': 1,
    '@typescript-eslint/no-this-alias': 1,
    '@typescript-eslint/no-unused-expressions': 1,
    '@typescript-eslint/no-unused-vars': 1,
    '@typescript-eslint/no-use-before-define': 1,
    '@typescript-eslint/no-useless-constructor': 1,
    '@typescript-eslint/no-var-requires': 1,
    '@typescript-eslint/object-curly-spacing': 1,
    '@typescript-eslint/prefer-enum-initializers': 1,
    '@typescript-eslint/prefer-optional-chain': 1,
    '@typescript-eslint/quotes': ['warn', 'single', {'avoidEscape': true}],
    '@typescript-eslint/semi': 1,
    '@typescript-eslint/sort-type-union-intersection-members': 1,
    '@typescript-eslint/space-before-function-paren': [1, {
      anonymous: 'always',
      named: 'never',
      asyncArrow: 'never'
    }],
    '@typescript-eslint/type-annotation-spacing': [1, {before: false, after: true}],
    '@typescript-eslint/unified-signatures': 1,
    'arrow-body-style': [1, 'as-needed', {'requireReturnForObjectLiteral': true}],
    'arrow-parens': [1, 'always'],
    'arrow-spacing': 1,
    'block-spacing': [1, 'never'],
    'brace-style': [1, '1tbs', {'allowSingleLine': true}],
    'comma-dangle': 'off',
    'comma-spacing': 'off',
    'curly': 1,
    'eol-last': [1, 'always'],
    'eqeqeq': 1,
    'func-call-spacing': 'off',
    'jsx-quotes': ['warn', 'prefer-single'],
    'key-spacing': [1, { 'beforeColon': false, 'afterColon': true, 'mode': 'strict' }],
    'max-nested-callbacks': [1, 6],
    'no-case-declarations': 1,
    'no-confusing-arrow': 1,
    'no-console': 1,
    'no-control-regex': 0,
    'no-debugger': 1,
    'no-duplicate-imports': 'off',
    'no-extend-native': 1,
    'no-extra-bind': 1,
    'no-extra-boolean-cast': 1,
    'no-extra-semi': 1,
    'no-fallthrough': 1,
    'no-inner-declarations': 1,
    'no-irregular-whitespace': 1,
    'no-lonely-if': 1,
    'no-mixed-spaces-and-tabs': 1,
    'no-multi-spaces': 1,
    'no-multiple-empty-lines': [1, {'max': 2, 'maxEOF': 1}],
    'no-nonoctal-decimal-escape': 'off',
    'no-prototype-builtins': 1,
    'no-trailing-spaces': 1,
    'no-undef-init': 1,
    'no-undef': 1,
    'no-unexpected-multiline': 1,
    'no-unsafe-optional-chaining': 'off',
    'no-unused-expressions': 'off',
    'no-useless-backreference': 'off',
    'no-useless-escape': 1,
    'no-useless-rename': 1,
    'no-var': 1,
    'no-whitespace-before-property': 1,
    'one-var': ['warn', 'never'],
    'prefer-const': 1,
    'prefer-spread': 1,
    'quotes': 'off',
    'react/jsx-boolean-value': 1,
    'react/jsx-no-undef': 2,
    'react/jsx-sort-prop-types': 0,
    'react/jsx-sort-props': 0,
    'react/jsx-uses-react': 2,
    'react/jsx-uses-vars': 2,
    'react/no-did-mount-set-state': 0,
    'react/no-did-update-set-state': 2,
    'react/no-multi-comp': 0,
    'react/no-unknown-property': 0,
    'react/prop-types': 0,
    'react/react-in-jsx-scope': 2,
    'react/self-closing-comp': 2,
    'react/wrap-multilines': 0,
    'semi-spacing': [1, {'before': false, 'after': true}],
    'semi-style': [1, 'last'],
    'semi': 'off',
    'space-before-function-paren': 'off',
    'space-in-parens': [1, 'never'],
    'space-infix-ops': 1,
    'strict': 1,
  },
  globals: {
    inject: false,
    module: false,
    describe: false,
    it: false,
    before: false,
    beforeEach: false,
    after: false,
    afterEach: false,
    expect: false,
    window: false,
    document: false,
    Parse: false,
    chai: true,
    t: 'readonly',
    $: 'readonly',
    ga: 'readonly'
  }
}
<|endoftext|>


<commit_before>define( 'argumenta/widgets/Argument',
[
    "require-jquery",
    "argumenta/widgets/Base",
    "text!./Argument/template.html.mustache",
    "argumenta/widgets/Proposition",
    "argumenta/sandbox"
],
function( $, Base, Template, Proposition, Sandbox ) {

    /**
     * @class Argument
     *
     * Widget options may be set in a combination of four ways:
     *
     *   1. As a module default on the prototype.
     *   2. As instance options.
     *   3. As individual custom `data-<option>` attributes in HTML.
     *   4. As bundle of JSON properties in a `data-<moduleID>` HTML attribute.
     *
     * Example JS for module defaults:
     *
     *     Argument.prototype.defaultOptions = {option: value};
     *
     * Example JS for instance options:
     *
     *     var argument = new Argument({
     *         sha1: <sha1>,
     *         show_propositions: true
     *     });
     *
     * Example HTML with individual attributes:
     *
     *     <div class="argument-widget"
     *          data-sha1="<sha1>"
     *          data-show_propositions="true" >
     *

     *
     * Example HTML with options bundle in a `data-<moduleID>` attribute:
     *
     *     <div class="argument-widget"
     *          data-argument="{sha1: <sha1>, show_propositions: true}" >
     *

     *
     * @param opts {Object} Argument widget options.
     * @param opts.show_propositions {Boolean} Whether to show propositions initially.
     * @param opts.propositions {Array<Object>} An array of argument propositions data.
     * @note Propositions may be set as options, or loaded via AJAX.
     */
    var Argument = Base.module( {

        moduleID: 'Argument',
        template: Template,

        defaults: {
            show_propositions: true
        },

        init: function( options ) {
            var self = this;
            self.initArgument( options );
        },

        prototype: {

            // Inits this argument widget.
            initArgument: function() {
                var self = this;
                self.propositionWidgets = [];
                self.propositionsVisible = false;
                self._initData();
            },

            // Gets the object type.
            getType: function() {
                return this.options.object_type;
            },

            // Gets the object sha1.
            getSha1: function() {
                return this.options.sha1;
            },

            // Sets propositions data, and inits elements.
            setPropositions: function( props ) {
                var self = this;
                self.propositions = props;
                self._initPropositionElements();
            },

            // Gets child proposition widgets.
            getPropositionWidgets: function() {
                var self = this;
                return self.propositionWidgets;
            },

            // Toggles argument details for widget.
            toggleArgumentDetails: function() {
                var self = this;
                self.togglePropositions();
            },

            // Toggle propositions for widget.
            togglePropositions: function() {
                var self = this;
                if ( self.propositions ) {
                    self.container.children(".propositions-container").toggle( 300 );
                    self.propositionsVisible = !self.propositionsVisible;
                }
                else {
                    self._initPropositions();
                }
            },

            // Binds UI events, extending Base behavior.
            _bindUI: function() {
                var self = this;

                // Save reference to inner container and menu.
                self.container = self.element.children(".argument-container");
                self.main = self.container.children(".argument-main");
                self.menu = self.container.find('.argument-menu').first();
                self.deleteButton = self.menu.find('.action-delete');

                // Click behavior for menu.
                self.menu.on('click', function( event ) {
                    self.element.temporaryClass('menu-just-clicked', 300);
                });

                // Click behavior for `Delete Repo`.
                self.deleteButton.on('click', function( event ) {
                    var name = self.options.commit.committer;
                    var repo = self.options.repo;
                    var base = self.options.base_url;
                    var path = '/' + name + '/' + repo + '.json';
                    var url  = base + path;
                    var settings = {
                        type: 'DELETE'
                      , url: url
                    };
                    var success = function( data, textStatus, jqXHR ) {
                        Sandbox.notify( data.message );
                        self.element.remove();
                    };
                    var error = function( data ) {
                        Sandbox.error(data);
                    };
                    $.ajax(settings).done(success).fail(error);
                });

                // Click behavior for main panel.
                self.container.children(".argument-main").on('click', function( event ) {

                    // Don't expand on mouse release after drag.
                    if ( self.element.hasClass('ui-state-just-dragged') )
                        return;

                    // Don't expand on mouse release after menu click.
                    if ( self.element.hasClass('menu-just-clicked') )
                        return;

                    // Toggle details on click.
                    self.toggleArgumentDetails();
                } );

                // Make draggable.
                self.element.draggable( {
                    helper: 'clone',
                    appendTo: $('.drag-container')[0] || $('body'),
                    revert: true,
                    cancel: 'span, input',
                    handle: self.container.children(".argument-main"),
                    cursor: 'move',

                    start: function(event, ui) {
                        // Prevent other actions on drag.
                        ui.helper.addClass('ui-state-just-dragged argument-widget-drag');

                        // Fix clone size.
                        ui.helper.css( {
                            'height': self.element.height() + 'px',
                            'width': self.element.width() + 'px'
                        } );

                        // Hide original.
                        self.element.css('visibility', "hidden");
                    },

                    stop: function(event, ui) {
                        // Prevent other actions on drag, then cleanup.
                        setTimeout(function() {
                            ui.helper.removeClass('ui-state-just-dragged');
                        }, 300);

                        // Reveal original.
                        self.element.css('visibility', "");
                    }
                } );
            },

            // Inits widget data.
            _initData: function() {
                var self = this;
                if ( !self.options.title ||
                     !self.options.premises ||
                     !self.options.conclusion )
                {
                    self._loadDataBySha1();
                }
                else if ( self.options.show_propositions === true ) {
                    self._initPropositions();
                }
            },

            // Loads argument data by SHA-1.
            _loadDataBySha1: function() {
                var self = this;
                var sha1 = self.options.sha1;
                var base = self.options.base_url;
                var path = '/arguments/' + sha1 + '.json';
                var url  = base + path;
                var success = function( data ) {
                    $.extend(self.options, data.argument);
                    self.options.commit = data.commit;
                    self._refresh();
                    if ( self.options.show_propositions === true ) {
                        self._initPropositions();
                    }
                };
                var error = function( data ) {
                    Sandbox.error(data);
                };
                $.ajax(url).done(success).fail(error);
            },

            // Inits propositions data and elements.
            _initPropositions: function() {
                var self = this;

                if ( self.options.propositions ) {
                    self.setPropositions( self.options.propositions );
                }
                else {
                    var sha1 = this.options.sha1;
                    var base = self.options.base_url;
                    var path = '/arguments/' + sha1 + '/propositions.json';
                    var url  = base + path;
                    var success = function( data ) {
                        self.setPropositions( data.propositions );
                    }
                    var error = function( data ) {
                        Sandbox.error(data);
                    }
                    $.ajax(url).done(success).fail(error);
                }
            },

            // Inits proposition elements.
            _initPropositionElements: function() {
                var self = this;
                var container = self.container.children('.propositions-container');

                // Clear any current propositions.
                container.empty();
                self.propositionWidgets.length = 0;

                for ( var i=0, len=self.propositions.length; i<len; i++ ) {
                    var p = self.propositions[i];

                    // The proposition index for its role in this argument;
                    // a numeral for premise position, or 'C' for a conclusion.
                    var index = (i < len-1) ? i+1 : 'C';

                    // Extend proposition data with its argument index.
                    p = $.extend( {}, p, { 'index': index } );

                    // Create a widget from the proposition data.
                    var proposition = new Proposition( p );

                    // Append the proposition and save a reference.
                    container.append( proposition.element );
                    self.propositionWidgets.push( proposition );
                }
                self.propositionsVisible = true;
            },

            // Gets view options for template, extending Base behavior.
            _getViewOptions: function() {
                var self = this;
                var viewOptions = {
                    partial_sha1: self.options.sha1.substr(0, 20),
                    argument_desc: 'Argument: ' + self.options.title,
                    details_desc: 'Argument details\r\nSHA1: ' + self.options.sha1
                };
                return $.extend( viewOptions, self.options );
            }
        },

        static: {
        }
    } );

    return Argument;
} );
<commit_msg>Animate initialization of argument propositions.<commit_after>define( 'argumenta/widgets/Argument',
[
    "require-jquery",
    "argumenta/widgets/Base",
    "text!./Argument/template.html.mustache",
    "argumenta/widgets/Proposition",
    "argumenta/sandbox"
],
function( $, Base, Template, Proposition, Sandbox ) {

    /**
     * @class Argument
     *
     * Widget options may be set in a combination of four ways:
     *
     *   1. As a module default on the prototype.
     *   2. As instance options.
     *   3. As individual custom `data-<option>` attributes in HTML.
     *   4. As bundle of JSON properties in a `data-<moduleID>` HTML attribute.
     *
     * Example JS for module defaults:
     *
     *     Argument.prototype.defaultOptions = {option: value};
     *
     * Example JS for instance options:
     *
     *     var argument = new Argument({
     *         sha1: <sha1>,
     *         show_propositions: true
     *     });
     *
     * Example HTML with individual attributes:
     *
     *     <div class="argument-widget"
     *          data-sha1="<sha1>"
     *          data-show_propositions="true" >
     *

     *
     * Example HTML with options bundle in a `data-<moduleID>` attribute:
     *
     *     <div class="argument-widget"
     *          data-argument="{sha1: <sha1>, show_propositions: true}" >
     *

     *
     * @param opts {Object} Argument widget options.
     * @param opts.show_propositions {Boolean} Whether to show propositions initially.
     * @param opts.propositions {Array<Object>} An array of argument propositions data.
     * @note Propositions may be set as options, or loaded via AJAX.
     */
    var Argument = Base.module( {

        moduleID: 'Argument',
        template: Template,

        defaults: {
            show_propositions: true
        },

        init: function( options ) {
            var self = this;
            self.initArgument( options );
        },

        prototype: {

            // Inits this argument widget.
            initArgument: function() {
                var self = this;
                self.propositionWidgets = [];
                self.propositionsVisible = false;
                self._initData();
            },

            // Gets the object type.
            getType: function() {
                return this.options.object_type;
            },

            // Gets the object sha1.
            getSha1: function() {
                return this.options.sha1;
            },

            // Sets propositions data, and inits elements.
            setPropositions: function( props ) {
                var self = this;
                self.propositions = props;
                self._initPropositionElements();
            },

            // Gets child proposition widgets.
            getPropositionWidgets: function() {
                var self = this;
                return self.propositionWidgets;
            },

            // Toggles argument details for widget.
            toggleArgumentDetails: function() {
                var self = this;
                self.togglePropositions();
            },

            // Toggle propositions for widget.
            togglePropositions: function() {
                var self = this;
                if ( self.propositions ) {
                    self.container.children(".propositions-container").toggle( 300 );
                    self.propositionsVisible = !self.propositionsVisible;
                }
                else {
                    self._initPropositions();
                }
            },

            // Binds UI events, extending Base behavior.
            _bindUI: function() {
                var self = this;

                // Save reference to inner container and menu.
                self.container = self.element.children(".argument-container");
                self.main = self.container.children(".argument-main");
                self.menu = self.container.find('.argument-menu').first();
                self.deleteButton = self.menu.find('.action-delete');

                // Click behavior for menu.
                self.menu.on('click', function( event ) {
                    self.element.temporaryClass('menu-just-clicked', 300);
                });

                // Click behavior for `Delete Repo`.
                self.deleteButton.on('click', function( event ) {
                    var name = self.options.commit.committer;
                    var repo = self.options.repo;
                    var base = self.options.base_url;
                    var path = '/' + name + '/' + repo + '.json';
                    var url  = base + path;
                    var settings = {
                        type: 'DELETE'
                      , url: url
                    };
                    var success = function( data, textStatus, jqXHR ) {
                        Sandbox.notify( data.message );
                        self.element.remove();
                    };
                    var error = function( data ) {
                        Sandbox.error(data);
                    };
                    $.ajax(settings).done(success).fail(error);
                });

                // Click behavior for main panel.
                self.container.children(".argument-main").on('click', function( event ) {

                    // Don't expand on mouse release after drag.
                    if ( self.element.hasClass('ui-state-just-dragged') )
                        return;

                    // Don't expand on mouse release after menu click.
                    if ( self.element.hasClass('menu-just-clicked') )
                        return;

                    // Toggle details on click.
                    self.toggleArgumentDetails();
                } );

                // Make draggable.
                self.element.draggable( {
                    helper: 'clone',
                    appendTo: $('.drag-container')[0] || $('body'),
                    revert: true,
                    cancel: 'span, input',
                    handle: self.container.children(".argument-main"),
                    cursor: 'move',

                    start: function(event, ui) {
                        // Prevent other actions on drag.
                        ui.helper.addClass('ui-state-just-dragged argument-widget-drag');

                        // Fix clone size.
                        ui.helper.css( {
                            'height': self.element.height() + 'px',
                            'width': self.element.width() + 'px'
                        } );

                        // Hide original.
                        self.element.css('visibility', "hidden");
                    },

                    stop: function(event, ui) {
                        // Prevent other actions on drag, then cleanup.
                        setTimeout(function() {
                            ui.helper.removeClass('ui-state-just-dragged');
                        }, 300);

                        // Reveal original.
                        self.element.css('visibility', "");
                    }
                } );
            },

            // Inits widget data.
            _initData: function() {
                var self = this;
                if ( !self.options.title ||
                     !self.options.premises ||
                     !self.options.conclusion )
                {
                    self._loadDataBySha1();
                }
                else if ( self.options.show_propositions === true ) {
                    self._initPropositions();
                }
            },

            // Loads argument data by SHA-1.
            _loadDataBySha1: function() {
                var self = this;
                var sha1 = self.options.sha1;
                var base = self.options.base_url;
                var path = '/arguments/' + sha1 + '.json';
                var url  = base + path;
                var success = function( data ) {
                    $.extend(self.options, data.argument);
                    self.options.commit = data.commit;
                    self._refresh();
                    if ( self.options.show_propositions === true ) {
                        self._initPropositions();
                    }
                };
                var error = function( data ) {
                    Sandbox.error(data);
                };
                $.ajax(url).done(success).fail(error);
            },

            // Inits propositions data and elements.
            _initPropositions: function() {
                var self = this;

                if ( self.options.propositions ) {
                    self.setPropositions( self.options.propositions );
                }
                else {
                    var sha1 = this.options.sha1;
                    var base = self.options.base_url;
                    var path = '/arguments/' + sha1 + '/propositions.json';
                    var url  = base + path;
                    var success = function( data ) {
                        self.setPropositions( data.propositions );
                    }
                    var error = function( data ) {
                        Sandbox.error(data);
                    }
                    $.ajax(url).done(success).fail(error);
                }
            },

            // Inits proposition elements.
            _initPropositionElements: function() {
                var self = this;
                var container = self.container.children('.propositions-container');

                // Hide container.
                container.hide();

                // Clear any current propositions.
                container.empty();
                self.propositionWidgets.length = 0;

                // Create the new proposition elements.
                for ( var i=0, len=self.propositions.length; i<len; i++ ) {
                    var p = self.propositions[i];

                    // The proposition index for its role in this argument;
                    // a numeral for premise position, or 'C' for a conclusion.
                    var index = (i < len-1) ? i+1 : 'C';

                    // Extend proposition data with its argument index.
                    p = $.extend( {}, p, { 'index': index } );

                    // Create a widget from the proposition data.
                    var proposition = new Proposition( p );

                    // Append the proposition and save a reference.
                    container.append( proposition.element );
                    self.propositionWidgets.push( proposition );
                }
                // Reveal container.
                container.show(250);
                self.propositionsVisible = true;
            },

            // Gets view options for template, extending Base behavior.
            _getViewOptions: function() {
                var self = this;
                var viewOptions = {
                    partial_sha1: self.options.sha1.substr(0, 20),
                    argument_desc: 'Argument: ' + self.options.title,
                    details_desc: 'Argument details\r\nSHA1: ' + self.options.sha1
                };
                return $.extend( viewOptions, self.options );
            }
        },

        static: {
        }
    } );

    return Argument;
} );
<|endoftext|>


<commit_before>const OFF = 0;
const WARN = 1;
const ERROR = 2;

module.exports = {
  'env': {
    'es6': true,
    'node': true,
    'mocha': true,
    'browser': true
  },
  'extends': 'eslint:recommended',
  'parser': 'babel-eslint',
  'parserOptions': {
    'sourceType': 'module'
  },
  'plugins': [
    'no-class'
  ],
  'rules': {
    // Possible Errors
    'no-extra-parens': [ERROR, 'all', {
      'conditionalAssign': false,
      'returnAssign': false,
      'nestedBinaryExpressions': false
    }],
    'no-template-curly-in-string': [ERROR],

    // Best Practices
    'accessor-pairs': [ERROR],
    'complexity': [ERROR, 20],
    'curly': [ERROR],
    'dot-location': [ERROR, 'property'],
    'dot-notation': [ERROR],
    'eqeqeq': [ERROR, 'smart'],
    'no-caller': [ERROR],
    'no-else-return': [ERROR],
    'no-extend-native': [ERROR],
    'no-extra-bind': [ERROR],
    'no-floating-decimal': [ERROR],
    'no-implied-eval': [ERROR],
    'no-iterator': [ERROR],
    'no-labels': [ERROR],
    'no-lone-blocks': [ERROR],
    'no-multi-str': [ERROR],
    'no-new': [ERROR],
    'no-new-func': [ERROR],
    'no-new-wrappers': [ERROR],
    'no-octal-escape': [ERROR],
    'no-param-reassign': [ERROR],
    'no-proto': [ERROR],
    'no-return-assign': [ERROR],
    'no-self-compare': [ERROR],
    'no-sequences': [ERROR],
    'no-throw-literal': [ERROR],
    'no-unmodified-loop-condition': [ERROR],
    'no-useless-call': [ERROR],
    'no-useless-escape': [ERROR],
    'no-void': [ERROR],
    'no-with': [ERROR],
    'wrap-iife': [ERROR, 'any'],
    'yoda': [ERROR],

    // Strict Mode
    'strict': [ERROR],

    // Variables
    'no-label-var': [ERROR],
    'no-shadow-restricted-names': [ERROR],
    'no-undef-init': [ERROR],

    // Stylistic Issues
    'array-bracket-spacing': [ERROR, 'never'],
    'block-spacing': [ERROR],
    'brace-style': [ERROR, '1tbs', {
      'allowSingleLine': true
    }],
    'camelcase': [ERROR, {
      'properties': 'never'
    }],
    'comma-spacing': [ERROR, {
      'before': false,
      'after': true
    }],
    'comma-style': [ERROR],
    'computed-property-spacing': [ERROR, 'never'],
    'consistent-this': [ERROR, 'self'],
    'eol-last': [ERROR],
    'func-call-spacing': [ERROR, 'never'],
    'func-name-matching': [ERROR],
    'indent': [ERROR, 2, {
      'SwitchCase': 1,
      'MemberExpression': 'off'
    }],
    'key-spacing': [ERROR, {
      'beforeColon': false,
      'afterColon': true,
      'mode': 'minimum'
    }],
    'keyword-spacing': [ERROR],
    'max-len': [ERROR, 120],
    'max-lines': [ERROR, {
      'max': 300,
      'skipBlankLines': true,
      'skipComments': true
    }],
    'no-lonely-if': [ERROR],
    'no-multiple-empty-lines': [ERROR, {
      max: 1
    }],
    'no-new-object': [ERROR],
    'no-tabs': [ERROR],
    'no-trailing-spaces': [ERROR],
    'no-unneeded-ternary': [ERROR],
    'no-whitespace-before-property': [ERROR],
    'object-property-newline': [ERROR, {
      'allowMultiplePropertiesPerLine': true
    }],
    'one-var': [ERROR, {
      'initialized': 'never'
    }],
    'operator-linebreak': [ERROR],
    'padded-blocks': [ERROR, 'never'],
    'quotes': [ERROR, 'single'],
    'semi': [ERROR],
    'semi-spacing': [ERROR],
    'space-before-blocks': [ERROR],
    'space-before-function-paren': [ERROR, {
      'anonymous': 'always',
      'named': 'never',
      'asyncArrow': 'ignore'
    }],
    'space-in-parens': [ERROR, 'never'],
    'space-infix-ops': [ERROR],
    'space-unary-ops': [ERROR , {
      'words': true,
      'nonwords': false
    }],
    'spaced-comment': [ERROR, 'always', {
      'line': {
        'markers': ['/'],
        'exceptions': ['-', '+']
      },
      'block': {
        'markers': ['!'],
        'exceptions': ['*'],
        'balanced': true
      }
    }],

    // ECMAScript 6
    'arrow-parens': [ERROR, 'always'],
    'arrow-spacing': [ERROR],
    'generator-star-spacing': [ERROR, {
      'before': false,
      'after': true
    }],
    'no-duplicate-imports': [ERROR],
    'no-useless-computed-key': [ERROR],
    'no-useless-rename': [ERROR],
    'no-var': [ERROR],
    'object-shorthand': [ERROR],
    'prefer-arrow-callback': [ERROR],
    'prefer-const': [ERROR],
    'prefer-numeric-literals': [ERROR],
    'prefer-rest-params': [ERROR],
    'prefer-spread': [ERROR],
    'rest-spread-spacing': [ERROR],
    'template-curly-spacing': [ERROR],
    'yield-star-spacing': [ERROR],

    // Plugin rules
    'no-class/no-class': [ERROR]
  }
};
<commit_msg>Removed eslint indent rule because prettier is handling that (and they're incompatible)<commit_after>const OFF = 0;
const WARN = 1;
const ERROR = 2;

module.exports = {
  'env': {
    'es6': true,
    'node': true,
    'mocha': true,
    'browser': true
  },
  'extends': 'eslint:recommended',
  'parser': 'babel-eslint',
  'parserOptions': {
    'sourceType': 'module'
  },
  'plugins': [
    'no-class'
  ],
  'rules': {
    // Possible Errors
    'no-extra-parens': [ERROR, 'all', {
      'conditionalAssign': false,
      'returnAssign': false,
      'nestedBinaryExpressions': false
    }],
    'no-template-curly-in-string': [ERROR],

    // Best Practices
    'accessor-pairs': [ERROR],
    'complexity': [ERROR, 20],
    'curly': [ERROR],
    'dot-location': [ERROR, 'property'],
    'dot-notation': [ERROR],
    'eqeqeq': [ERROR, 'smart'],
    'no-caller': [ERROR],
    'no-else-return': [ERROR],
    'no-extend-native': [ERROR],
    'no-extra-bind': [ERROR],
    'no-floating-decimal': [ERROR],
    'no-implied-eval': [ERROR],
    'no-iterator': [ERROR],
    'no-labels': [ERROR],
    'no-lone-blocks': [ERROR],
    'no-multi-str': [ERROR],
    'no-new': [ERROR],
    'no-new-func': [ERROR],
    'no-new-wrappers': [ERROR],
    'no-octal-escape': [ERROR],
    'no-param-reassign': [ERROR],
    'no-proto': [ERROR],
    'no-return-assign': [ERROR],
    'no-self-compare': [ERROR],
    'no-sequences': [ERROR],
    'no-throw-literal': [ERROR],
    'no-unmodified-loop-condition': [ERROR],
    'no-useless-call': [ERROR],
    'no-useless-escape': [ERROR],
    'no-void': [ERROR],
    'no-with': [ERROR],
    'wrap-iife': [ERROR, 'any'],
    'yoda': [ERROR],

    // Strict Mode
    'strict': [ERROR],

    // Variables
    'no-label-var': [ERROR],
    'no-shadow-restricted-names': [ERROR],
    'no-undef-init': [ERROR],

    // Stylistic Issues
    'array-bracket-spacing': [ERROR, 'never'],
    'block-spacing': [ERROR],
    'brace-style': [ERROR, '1tbs', {
      'allowSingleLine': true
    }],
    'camelcase': [ERROR, {
      'properties': 'never'
    }],
    'comma-spacing': [ERROR, {
      'before': false,
      'after': true
    }],
    'comma-style': [ERROR],
    'computed-property-spacing': [ERROR, 'never'],
    'consistent-this': [ERROR, 'self'],
    'eol-last': [ERROR],
    'func-call-spacing': [ERROR, 'never'],
    'func-name-matching': [ERROR],
    'indent': [OFF],
    'key-spacing': [ERROR, {
      'beforeColon': false,
      'afterColon': true,
      'mode': 'minimum'
    }],
    'keyword-spacing': [ERROR],
    'max-len': [ERROR, 120],
    'max-lines': [ERROR, {
      'max': 300,
      'skipBlankLines': true,
      'skipComments': true
    }],
    'no-lonely-if': [ERROR],
    'no-multiple-empty-lines': [ERROR, {
      max: 1
    }],
    'no-new-object': [ERROR],
    'no-tabs': [ERROR],
    'no-trailing-spaces': [ERROR],
    'no-unneeded-ternary': [ERROR],
    'no-whitespace-before-property': [ERROR],
    'object-property-newline': [ERROR, {
      'allowMultiplePropertiesPerLine': true
    }],
    'one-var': [ERROR, {
      'initialized': 'never'
    }],
    'operator-linebreak': [ERROR],
    'padded-blocks': [ERROR, 'never'],
    'quotes': [ERROR, 'single'],
    'semi': [ERROR],
    'semi-spacing': [ERROR],
    'space-before-blocks': [ERROR],
    'space-before-function-paren': [ERROR, {
      'anonymous': 'always',
      'named': 'never',
      'asyncArrow': 'ignore'
    }],
    'space-in-parens': [ERROR, 'never'],
    'space-infix-ops': [ERROR],
    'space-unary-ops': [ERROR , {
      'words': true,
      'nonwords': false
    }],
    'spaced-comment': [ERROR, 'always', {
      'line': {
        'markers': ['/'],
        'exceptions': ['-', '+']
      },
      'block': {
        'markers': ['!'],
        'exceptions': ['*'],
        'balanced': true
      }
    }],

    // ECMAScript 6
    'arrow-parens': [ERROR, 'as-needed'],
    'arrow-spacing': [ERROR],
    'generator-star-spacing': [ERROR, {
      'before': false,
      'after': true
    }],
    'no-duplicate-imports': [ERROR],
    'no-useless-computed-key': [ERROR],
    'no-useless-rename': [ERROR],
    'no-var': [ERROR],
    'object-shorthand': [ERROR],
    'prefer-arrow-callback': [ERROR],
    'prefer-const': [ERROR],
    'prefer-numeric-literals': [ERROR],
    'prefer-rest-params': [ERROR],
    'prefer-spread': [ERROR],
    'rest-spread-spacing': [ERROR],
    'template-curly-spacing': [ERROR],
    'yield-star-spacing': [ERROR],

    // Plugin rules
    'no-class/no-class': [ERROR]
  }
};
<|endoftext|>


<commit_before>var RomoSelectedOptionsList = function(focusElem) {
  this.elem      = undefined;
  this.focusElem = focusElem; // picker/select dropdown elem

  this.items = [];

  this.doInit();
  this._bindElem();
}

RomoSelectedOptionsList.prototype.doInit = function() {
  // override as needed
}

/*
Options are specified as a list of items.  Each 'option' item object
has display text and a value. They are compatible with the option list
dropdown option items.

Example:
[ { 'type': 'option', 'value': 'a', 'displayText': 'A' },
  { 'type': 'option', 'value': 'b', 'displayText': 'B' },
  { 'type': 'option', 'value': 'c', 'displayText': 'C' }
]
*/

RomoSelectedOptionsList.prototype.doSetItems = function(itemsList) {
  this.items = itemsList;
}

RomoSelectedOptionsList.prototype.doClearItems = function() {
  this.items = [];
}

RomoSelectedOptionsList.prototype.doAddItem = function(item) {
  if (!this._getItemValues().includes(item.value)) {
    this.items.push(item);
  }
}

RomoSelectedOptionsList.prototype.doRemoveItem = function(itemValue) {
  var index = this._getItemValues().indexOf(itemValue);
  if (index > -1) {
    this.items.splice(index, 1);
  }
}

RomoSelectedOptionsList.prototype.doRefreshUI = function() {
  var itemValues  = this._getItemValues();
  var uiListElem  = this.elem.find('.romo-selected-options-list-items');
  var uiItemElems = uiListElem.find('.romo-selected-options-list-item');
  var uiValues    = uiItemElems.get().map(function(uiItemNode) {
    return $(uiItemNode).data('romo-selected-options-list-value');
  });
  var rmNodes = uiItemElems.get().filter(function(uiItemNode) {
     return itemValues.indexOf($(uiItemNode).data('romo-selected-options-list-value')) === -1;
   });
  var addItems = this.items.filter(function(item) {
    return uiValues.indexOf(item.value) === -1;
  });
  rmNodes.forEach($.proxy(function(rmNode) {
    $(rmNode).remove();
  }, this));
  addItems.forEach($.proxy(function(addItem) {
    var addElem = this._buildItemElem(addItem);
    uiListElem.append(addElem);

    var listWidth       = parseInt(Romo.getComputedStyle(uiListElem[0], "width"), 10);
    var listLeftPad     = parseInt(Romo.getComputedStyle(uiListElem[0], "padding-left"), 10);
    var listRightPad    = parseInt(Romo.getComputedStyle(uiListElem[0], "padding-right"), 10);
    var itemBorderWidth = 1;
    var itemLeftPad     = parseInt(Romo.getComputedStyle(addElem[0], "padding-left"), 10);
    var itemRightPad    = parseInt(Romo.getComputedStyle(addElem[0], "padding-right"), 10);
    addElem.find('DIV').css('max-width', String(listWidth-listLeftPad-listRightPad-(2*itemBorderWidth)-itemLeftPad-itemRightPad)+'px');
  }, this));

  var focusElemWidth = parseInt(Romo.getComputedStyle(this.focusElem[0], "width"), 10);
  this.elem.css('width', String(focusElemWidth)+'px');

  var maxRows          = undefined;
  var uiListElemHeight = parseInt(Romo.getComputedStyle(uiListElem[0], "height"), 10);
  var firstItemNode    = uiListElem.find('.romo-selected-options-list-item')[0];
  if (firstItemNode !== undefined) {
    var itemHeight       = parseInt(Romo.getComputedStyle(firstItemNode, "height"), 10);
    var itemMarginBottom = parseInt(Romo.getComputedStyle(firstItemNode, "margin-bottom"), 10);
    var itemBorderWidth  = 1;
    var listTopPad       = parseInt(Romo.getComputedStyle(uiListElem[0], "padding-top"), 10);
    var listBottomPad    = parseInt(Romo.getComputedStyle(uiListElem[0], "padding-bottom"), 10);

    var maxRows   = this.focusElem.data('romo-selected-options-list-max-rows') || 0;
    var maxHeight = listTopPad+(itemHeight*maxRows)+(itemMarginBottom*(maxRows-1))+(2*itemBorderWidth*maxRows)+listBottomPad+(itemHeight/2);
  }
  if (maxRows !== undefined && (uiListElemHeight > maxHeight)) {
    this.elem.css({
      'height':     String(maxHeight)+'px',
      'overflow-y': 'auto'
    });
    var itemElems    = uiListElem.find('.romo-selected-options-list-item');
    var lastItemNode = itemElems[itemElems.length-1];
    this._scrollListTopToItem($(lastItemNode));
  } else {
    this.elem.css({
      'height':     String(uiListElemHeight)+'px',
      'overflow-y': undefined
    });
  }
}

/* private */

RomoSelectedOptionsList.prototype._bindElem = function() {
  this.elem = $('

');

  this.elem.on('click', $.proxy(function(e) {
    if (e !== undefined) {
      e.stopPropagation();
      e.preventDefault();
    }
    this.elem.trigger('romoSelectedOptionsList:listClick', [this]);
  }, this));

  this.doSetItems([]);
}

RomoSelectedOptionsList.prototype._buildItemElem = function(item) {
  var itemClass = this.focusElem.data('romo-selected-options-list-item-class') || '';
  var itemElem  = $('

');
  itemElem.append($('
'+(item.displayText || '')+'
'));
  itemElem.attr('data-romo-selected-options-list-value', (item.value || ''));
  itemElem.on('click', $.proxy(this._onItemClick, this));

  return itemElem;
}

RomoSelectedOptionsList.prototype._getItemValues = function() {
  return this.items.map(function(item) { return item.value; });
}

RomoSelectedOptionsList.prototype._onItemClick = function(e) {
  var itemElem = $(e.target);
  if (!itemElem.hasClass('romo-selected-options-list-item')) {
    var itemElem = itemElem.closest('.romo-selected-options-list-item');
  }
  if (itemElem[0] !== undefined) {
    var value = itemElem.data('romo-selected-options-list-value');
    this.elem.trigger('romoSelectedOptionsList:itemClick', [value, this]);
  }
}

RomoSelectedOptionsList.prototype._scrollListTopToItem = function(itemElem) {
  if (itemElem[0] !== undefined) {
    var scroll = this.elem;
    scroll.scrollTop(0);

    var scrollOffsetTop = scroll.offset().top;
    var selOffsetTop    = itemElem.offset().top;
    var selOffset       = itemElem.height() / 2;

    scroll.scrollTop(selOffsetTop - scrollOffsetTop - selOffset);
  }
}
<commit_msg>(hotfix) fix bug in calculating handling max height in sel opt list<commit_after>var RomoSelectedOptionsList = function(focusElem) {
  this.elem      = undefined;
  this.focusElem = focusElem; // picker/select dropdown elem

  this.items = [];

  this.doInit();
  this._bindElem();
}

RomoSelectedOptionsList.prototype.doInit = function() {
  // override as needed
}

/*
Options are specified as a list of items.  Each 'option' item object
has display text and a value. They are compatible with the option list
dropdown option items.

Example:
[ { 'type': 'option', 'value': 'a', 'displayText': 'A' },
  { 'type': 'option', 'value': 'b', 'displayText': 'B' },
  { 'type': 'option', 'value': 'c', 'displayText': 'C' }
]
*/

RomoSelectedOptionsList.prototype.doSetItems = function(itemsList) {
  this.items = itemsList;
}

RomoSelectedOptionsList.prototype.doClearItems = function() {
  this.items = [];
}

RomoSelectedOptionsList.prototype.doAddItem = function(item) {
  if (!this._getItemValues().includes(item.value)) {
    this.items.push(item);
  }
}

RomoSelectedOptionsList.prototype.doRemoveItem = function(itemValue) {
  var index = this._getItemValues().indexOf(itemValue);
  if (index > -1) {
    this.items.splice(index, 1);
  }
}

RomoSelectedOptionsList.prototype.doRefreshUI = function() {
  var itemValues  = this._getItemValues();
  var uiListElem  = this.elem.find('.romo-selected-options-list-items');
  var uiItemElems = uiListElem.find('.romo-selected-options-list-item');
  var uiValues    = uiItemElems.get().map(function(uiItemNode) {
    return $(uiItemNode).data('romo-selected-options-list-value');
  });
  var rmNodes = uiItemElems.get().filter(function(uiItemNode) {
     return itemValues.indexOf($(uiItemNode).data('romo-selected-options-list-value')) === -1;
   });
  var addItems = this.items.filter(function(item) {
    return uiValues.indexOf(item.value) === -1;
  });
  rmNodes.forEach($.proxy(function(rmNode) {
    $(rmNode).remove();
  }, this));
  addItems.forEach($.proxy(function(addItem) {
    var addElem = this._buildItemElem(addItem);
    uiListElem.append(addElem);

    var listWidth       = parseInt(Romo.getComputedStyle(uiListElem[0], "width"), 10);
    var listLeftPad     = parseInt(Romo.getComputedStyle(uiListElem[0], "padding-left"), 10);
    var listRightPad    = parseInt(Romo.getComputedStyle(uiListElem[0], "padding-right"), 10);
    var itemBorderWidth = 1;
    var itemLeftPad     = parseInt(Romo.getComputedStyle(addElem[0], "padding-left"), 10);
    var itemRightPad    = parseInt(Romo.getComputedStyle(addElem[0], "padding-right"), 10);
    addElem.find('DIV').css('max-width', String(listWidth-listLeftPad-listRightPad-(2*itemBorderWidth)-itemLeftPad-itemRightPad)+'px');
  }, this));

  var focusElemWidth = parseInt(Romo.getComputedStyle(this.focusElem[0], "width"), 10);
  this.elem.css('width', String(focusElemWidth)+'px');

  var maxRows          = undefined;
  var uiListElemHeight = parseInt(Romo.getComputedStyle(uiListElem[0], "height"), 10);
  var firstItemNode    = uiListElem.find('.romo-selected-options-list-item')[0];
  if (firstItemNode !== undefined) {
    var itemHeight       = parseInt(Romo.getComputedStyle(firstItemNode, "height"), 10);
    var itemMarginBottom = parseInt(Romo.getComputedStyle(firstItemNode, "margin-bottom"), 10);
    var itemBorderWidth  = 1;
    var listTopPad       = parseInt(Romo.getComputedStyle(uiListElem[0], "padding-top"), 10);
    var listBottomPad    = parseInt(Romo.getComputedStyle(uiListElem[0], "padding-bottom"), 10);

    var maxRows   = this.focusElem.data('romo-selected-options-list-max-rows') || 0;
    var maxHeight = listTopPad+(itemHeight*maxRows)+(itemMarginBottom*(maxRows-1))+(2*itemBorderWidth*maxRows)+listBottomPad+(itemHeight/2);
  }
  if (maxRows !== 0 && (uiListElemHeight > maxHeight)) {
    this.elem.css({
      'height':     String(maxHeight)+'px',
      'overflow-y': 'auto'
    });
    var itemElems    = uiListElem.find('.romo-selected-options-list-item');
    var lastItemNode = itemElems[itemElems.length-1];
    this._scrollListTopToItem($(lastItemNode));
  } else {
    this.elem.css({
      'height':     String(uiListElemHeight)+'px',
      'overflow-y': undefined
    });
  }
}

/* private */

RomoSelectedOptionsList.prototype._bindElem = function() {
  this.elem = $('

');

  this.elem.on('click', $.proxy(function(e) {
    if (e !== undefined) {
      e.stopPropagation();
      e.preventDefault();
    }
    this.elem.trigger('romoSelectedOptionsList:listClick', [this]);
  }, this));

  this.doSetItems([]);
}

RomoSelectedOptionsList.prototype._buildItemElem = function(item) {
  var itemClass = this.focusElem.data('romo-selected-options-list-item-class') || '';
  var itemElem  = $('

');
  itemElem.append($('
'+(item.displayText || '')+'
'));
  itemElem.attr('data-romo-selected-options-list-value', (item.value || ''));
  itemElem.on('click', $.proxy(this._onItemClick, this));

  return itemElem;
}

RomoSelectedOptionsList.prototype._getItemValues = function() {
  return this.items.map(function(item) { return item.value; });
}

RomoSelectedOptionsList.prototype._onItemClick = function(e) {
  var itemElem = $(e.target);
  if (!itemElem.hasClass('romo-selected-options-list-item')) {
    var itemElem = itemElem.closest('.romo-selected-options-list-item');
  }
  if (itemElem[0] !== undefined) {
    var value = itemElem.data('romo-selected-options-list-value');
    this.elem.trigger('romoSelectedOptionsList:itemClick', [value, this]);
  }
}

RomoSelectedOptionsList.prototype._scrollListTopToItem = function(itemElem) {
  if (itemElem[0] !== undefined) {
    var scroll = this.elem;
    scroll.scrollTop(0);

    var scrollOffsetTop = scroll.offset().top;
    var selOffsetTop    = itemElem.offset().top;
    var selOffset       = itemElem.height() / 2;

    scroll.scrollTop(selOffsetTop - scrollOffsetTop - selOffset);
  }
}
<|endoftext|>


<commit_before>module.exports = {
  plugins: ['prettier', 'chai-friendly'],
  extends: [
    'airbnb-base',
    'eslint:recommended',
    'plugin:prettier/recommended',
    'plugin:sonarjs/recommended',
    'plugin:chai-friendly/recommended',
  ],
  parser: 'babel-eslint',
  env: {
    es6: true,
    browser: true,
    commonjs: true,
    mocha: true,
  },
  globals: {
    process: true,
  },
  rules: {
    'consistent-return': 0,
    'no-underscore-dangle': 0,
    'import/prefer-default-export': 0,
    'func-names': 0,
    'no-param-reassign': 0,
    'prefer-destructuring': ['error', { object: true, array: false }],
    'max-classes-per-file': 0,
    'no-plusplus': 0,
    'no-unused-vars': ['error', { args: 'none' }],
    'sonarjs/cognitive-complexity': 0,
    'sonarjs/no-collapsible-if': 0,
    'sonarjs/no-duplicate-string': 0,
    'sonarjs/no-identical-functions': 0,
  },
};
<commit_msg>enable no-unused-vars eslint rule<commit_after>module.exports = {
  plugins: ['prettier', 'chai-friendly'],
  extends: [
    'airbnb-base',
    'eslint:recommended',
    'plugin:prettier/recommended',
    'plugin:sonarjs/recommended',
    'plugin:chai-friendly/recommended',
  ],
  parser: 'babel-eslint',
  env: {
    es6: true,
    browser: true,
    commonjs: true,
    mocha: true,
  },
  globals: {
    process: true,
  },
  rules: {
    'consistent-return': 0,
    'no-underscore-dangle': 0,
    'import/prefer-default-export': 0,
    'func-names': 0,
    'no-param-reassign': 0,
    'prefer-destructuring': ['error', { object: true, array: false }],
    'max-classes-per-file': 0,
    'no-plusplus': 0,
    'sonarjs/cognitive-complexity': 0,
    'sonarjs/no-collapsible-if': 0,
    'sonarjs/no-duplicate-string': 0,
    'sonarjs/no-identical-functions': 0,
  },
};
<|endoftext|>


<commit_before>
(function(){
    var t = klp.volunteer_modal = {};
    var modal_tpl;
    var $modal_wrapper;
    var $modal_overlay;
    t.init = function(){
        modal_tpl = swig.compile($("#tpl-volunteer-modal-map").html());
        $modal_wrapper = $("#modal_wrapper");
        $modal_overlay = $("#modal_overlay");
        $(document).on('click', ".js-trigger-volunteer-map", open_modal);
    };

    var open_modal = function(e){
        e.preventDefault();

        var date = $(this).data("date") || false;

        var ctx = {
            date: date
        }

        var html = modal_tpl(ctx);
        $modal_wrapper.append(html);
        var $modal = $modal_wrapper.find(".modal-volunteer.second-step");
        init_modal($modal);

        setTimeout(function(){
            $modal.addClass("show");
            $modal_overlay.addClass("show");
        },0);
    };

    var init_modal = function($modal){
        // var $input_data_location = $modal.find( "input[name=data_location]" );
        var $input_data_date = $modal.find( "input[name=data_date]" );
        var $input_data_type = $modal.find( "input[name=data_type]" );

        var $btn_close = $modal.find(".btn-modal-close");
        var $btn_back = $modal.find(".btn-modal-back");
        var $btn_next_step_date = $modal.find('.btn-next-step-date');
        var $btn_next_step_opportunities = $modal.find('.btn-next-step-opportunities');
        var $btn_next_step_login = $modal.find('.btn-next-step-login');
        var $btn_next_step_confirmation = $modal.find('.btn-next-step-confirmation');
        var $btn_next_step_submit = $modal.find('.btn-next-step-submit');
        var $datepicker_input = $modal.find('#datepicker-input');

        $datepicker_input.Zebra_DatePicker({
            always_visible: $modal.find('#datepicker-wrapper'),
            first_day_of_week: 0,
            show_clear_date: false,
            show_select_today: false,
            disabled_dates: ['1,3,4,5,12,13,14,22,24'],
            onSelect: onDateSelect,
            onClear: onDateClear
        });
        var datepicker = $datepicker_input.data('Zebra_DatePicker');

        function onDateSelect(date){
            $input_data_date.val(date);
            $btn_next_step_date.show();
        }
        function onDateClear(){
            $input_data_date.val("");
            $btn_next_step_date.hide();
        }

        $btn_next_step_date.on("click", function(e){
            show_next_step($modal, "opportunities");
            $btn_back.show();
            $btn_back.off();
            $btn_back.on("click", function(){
                show_prev_step($modal, "date");
                $btn_back.hide();
            });
        });

        $btn_next_step_opportunities.on("click", function(e){
            show_next_step($modal, "signup");
            $btn_back.show();
            $btn_back.off();
            $btn_back.on("click", function(){
                show_prev_step($modal, "opportunities");
                // $btn_back.hide();
            });
        });

        $btn_next_step_confirmation.on("click", function(e){
            show_next_step($modal, "confirmation");
            $btn_back.show();
            $btn_back.off();
            $btn_back.on("click", function(){
                show_prev_step($modal, "opportunities");
                // $btn_back.hide();
            });
        });

        $btn_next_step_login.on("click", function(e){
            show_next_step($modal, "login");
            $btn_back.off();
            $btn_back.on("click", function(){
                show_prev_step($modal, "signup");
            });
        });
        $btn_next_step_submit.on("click", function(e){
            show_next_step($modal, "submit");
            $btn_back.hide();
        });

        $btn_close.on("click", function(e){
            $modal.removeClass("show");
            $modal_overlay.removeClass("show");

            setTimeout(function(){
                $modal.remove();
            },300);
        });
    };

    var show_prev_step = function($modal, step_name){
        var $step_current = $modal.find(".step-item.visible");
        var $step_prev = $modal.find(".step-item[data-step-name='" + step_name +"']");

        $step_current.removeClass("fadein").addClass("move-right fadeout");
        $step_prev.removeClass("fadeut").addClass("move-left visible");

        // Hide current step
        setTimeout(function(){
            $step_current.removeClass("visible");
        },300);

        setTimeout(function(){
            $step_prev.addClass("fadein").removeClass("move-left");
        },10);
    };

    var show_next_step = function($modal, step_name){
        var $step_current = $modal.find(".step-item.visible");
        var $step_next = $modal.find(".step-item[data-step-name='" + step_name +"']");

        // Hide current step
        $step_current.removeClass("move-right fadein").addClass("fadeout move-left");
        setTimeout(function(){
            $step_current.removeClass("visible");
        },300);

        // Show next step
        $step_next.addClass("move-right visible");
        setTimeout(function(){
            $step_next.addClass("fadein").removeClass("move-right");
        },10);
    };

})();<commit_msg>#388: removed volunteer_modal.js<commit_after><|endoftext|>


<commit_before>module.exports = {
  parser: '@typescript-eslint/parser',
  env: {
    browser: true,
    node: true,
    commonjs: true,
    es6: true
  },
  extends: [
    'standard',
    'plugin:@typescript-eslint/recommended'
  ],
  plugins: [
    'import'
  ],
  parserOptions: {
    ecmaVersion: 2018,
    sourceType: 'module'
  },
  rules: {
    '@typescript-eslint/explicit-function-return-type': 0,
    '@typescript-eslint/indent': ['error', 2],
    '@typescript-eslint/no-this-alias': 0,
    '@typescript-eslint/no-use-before-define': 0,
    '@typescript-eslint/no-var-requires': 0,
    '@typescript-eslint/no-empty-interface': 0,
    '@typescript-eslint/no-explicit-any': 0,
    'comma-dangle': 0,
    'complexity': ['error', { max: 10 }],
    'import/extensions': ['error', 'always'],
    'no-console': ['error', { allow: ['warn', 'error', 'info'] }],
    'no-var': ['error'],
    'quotes': ['error', 'single', { 'avoidEscape': true, 'allowTemplateLiterals': true }],
  }
}
<commit_msg>chore: remove parserOptions, it's in eslint-config-standard<commit_after>module.exports = {
  parser: '@typescript-eslint/parser',
  env: {
    browser: true,
    node: true,
    commonjs: true,
    es6: true
  },
  extends: [
    'standard',
    'plugin:@typescript-eslint/recommended'
  ],
  plugins: [
    'import'
  ],
  rules: {
    '@typescript-eslint/explicit-function-return-type': 0,
    '@typescript-eslint/indent': ['error', 2],
    '@typescript-eslint/no-this-alias': 0,
    '@typescript-eslint/no-use-before-define': 0,
    '@typescript-eslint/no-var-requires': 0,
    '@typescript-eslint/no-empty-interface': 0,
    '@typescript-eslint/no-explicit-any': 0,
    'comma-dangle': 0,
    'complexity': ['error', { max: 10 }],
    'import/extensions': ['error', 'always'],
    'no-console': ['error', { allow: ['warn', 'error', 'info'] }],
    'no-var': ['error'],
    'quotes': ['error', 'single', { 'avoidEscape': true, 'allowTemplateLiterals': true }],
  }
}
<|endoftext|>


<commit_before>module.exports = {
  "env": {
    "browser": true,
    "node": true,
    "es6": true
  },
  "extends": "eslint:recommended",
  "parserOptions": {
    "sourceType": "module"
  },
  "rules": {
    "comma-dangle": [
      "error",
      "never"
    ],
    "indent": [
      "error",
      2
    ],
    "linebreak-style": [
      "error",
      "unix"
    ],
    "quotes": [
      "error",
      "double"
    ],
    "semi": [
      "error",
      "always"
    ],
    "no-console": [
      0
    ],
    "no-var": [
      "error"
    ]
  }
};
<commit_msg>increase switch case indent level<commit_after>module.exports = {
  "env": {
    "browser": true,
    "node": true,
    "es6": true
  },
  "extends": "eslint:recommended",
  "parserOptions": {
    "sourceType": "module"
  },
  "rules": {
    "comma-dangle": [
      "error",
      "never"
    ],
    "indent": [
      "error",
      2,
      { "SwitchCase": 1 }
    ],
    "linebreak-style": [
      "error",
      "unix"
    ],
    "quotes": [
      "error",
      "double"
    ],
    "semi": [
      "error",
      "always"
    ],
    "no-console": [
      0
    ],
    "no-var": [
      "error"
    ]
  }
};
<|endoftext|>


<commit_before>module.exports = {
  env: {
    es6: true,
    mocha: true,
    node: true
  },
  parserOptions: {
    ecmaVersion: 2017
  },
  rules: {
    "no-unused-vars": "warn"
  }
};
<commit_msg>ESLint:  Add "no-undef" rule.<commit_after>module.exports = {
  env: {
    es6: true,
    mocha: true,
    node: true
  },
  parserOptions: {
    ecmaVersion: 2017
  },
  rules: {
    "no-undef": "error",
    "no-unused-vars": "warn"
  }
};
<|endoftext|>


<commit_before>'use strict'

module.exports = {
  extends: [
    'eslint:recommended',
    'eslint-config-airbnb-base',
    'plugin:prettier/recommended',
  ],

  env: {
    jest: true,
  },

  globals: {
    RUN_TEST_AGAINST_AWS: true,
    TEST_BASE_URL: true,
  },

  parserOptions: {
    sourceType: 'script',
  },

  rules: {
    // overwrite airbnb-base options
    'no-underscore-dangle': 'off',
    // import buffer explicitly
    'no-restricted-globals': [
      'error',
      {
        name: 'Buffer',
        message: "Import 'Buffer' from 'buffer' module instead",
      },
    ],
    // until we switch to ES6 modules (which use 'strict mode' implicitly)
    strict: ['error', 'global'],

    // TODO FIXME turn off temporary, to make eslint pass
    'class-methods-use-this': 'off',
    'no-console': 'off',
    'no-restricted-syntax': 'off',
  },
}
<commit_msg>Add comment to eslint options<commit_after>'use strict'

module.exports = {
  extends: [
    'eslint:recommended',
    'eslint-config-airbnb-base',
    'plugin:prettier/recommended',
  ],

  env: {
    jest: true,
  },

  globals: {
    RUN_TEST_AGAINST_AWS: true,
    TEST_BASE_URL: true,
  },

  parserOptions: {
    sourceType: 'script',
  },

  rules: {
    // overwrite airbnb-base options
    // we use underscores to indicate private fields in classes
    'no-underscore-dangle': 'off',
    // import buffer explicitly
    'no-restricted-globals': [
      'error',
      {
        name: 'Buffer',
        message: "Import 'Buffer' from 'buffer' module instead",
      },
    ],
    // until we switch to ES6 modules (which use 'strict mode' implicitly)
    strict: ['error', 'global'],

    // TODO FIXME turn off temporary, to make eslint pass
    'class-methods-use-this': 'off',
    'no-console': 'off',
    'no-restricted-syntax': 'off',
  },
}
<|endoftext|>


<commit_before>module.exports = {
  "env": {
    "es6": true,
    "browser": true,
    "node": true
  },
  "plugins": ["babel", "react", "sorting"],
  "extends": ["eslint:recommended", "plugin:react/recommended"],
  "parser": "babel-eslint",
  "parserOptions": {
    "ecmaFeatures": {
      "experimentalObjectRestSpread": true,
      "impliedStrict": true,
      "jsx": true
    },
    "ecmaVersion": 2017,
    "sourceType": "module"
  },
  "rules": {
    "no-unused-vars": [1, { "vars": "local", "args": "after-used", "argsIgnorePattern": "^_", "varsIgnorePattern": "^_" }], // disallow declaration of variables that are not used in the code
    "react/prop-types": 0,
  }
}
<commit_msg>eslint: permite console.log para depurar, pero avisa<commit_after>module.exports = {
  "env": {
    "es6": true,
    "browser": true,
    "node": true
  },
  "plugins": ["babel", "react", "sorting"],
  "extends": ["eslint:recommended", "plugin:react/recommended"],
  "parser": "babel-eslint",
  "parserOptions": {
    "ecmaFeatures": {
      "experimentalObjectRestSpread": true,
      "impliedStrict": true,
      "jsx": true
    },
    "ecmaVersion": 2017,
    "sourceType": "module"
  },
  "rules": {
    "no-unused-vars": [1, { "vars": "local", "args": "after-used", "argsIgnorePattern": "^_", "varsIgnorePattern": "^_" }], // disallow declaration of variables that are not used in the code
    "react/prop-types": 0,
    "no-console": "warn"
  }
}
<|endoftext|>