<commit_before>module.exports = {
    "env": {
        "node": "error",
    },
    "extends": "eslint:recommended",
    "rules": {
        "indent": ["error", 4, {"SwitchCase": 1}],
        "linebreak-style": [
            "error", "unix"
        ],
        "quotes": [
            "error", "double"
        ],
        "semi": [
            "error", "always"
        ],
        "comma-dangle": "error",
        "no-cond-assign": "error",
        "no-console": "off",
        "no-debugger": "error",
        "no-constant-condition": "error",
        "no-dupe-args": "error",
        "no-dupe-keys": "error",
        "no-duplicate-case": "error",
        "no-empty": "error",
        "no-empty-character-class": "error",
        "no-ex-assign": "error",
        "no-extra-boolean-cast": "error",
        "no-extra-parens": "error",
        "no-extra-semi": "error",
        "no-func-assign": "error",
        "no-inner-declarations": "error",
        "no-invalid-regexp": "error",
        "no-irregular-whitespace": "warn",
        "no-negated-in-lhs": "error",
        "no-obj-calls": "error",
        "no-regex-spaces": "error",
        "no-sparse-arrays": "error",
        "no-unexpected-multiline": "error",
        "no-unreachable": "error",
        "use-isnan": "error",
        "valid-jsdoc": "error",
        "valid-typeof": "error",
        "accessor-pairs": "error",
        "array-callback-return": "error",
        "block-scoped-var": "error",
        "complexity": "error",
        "consistent-return": "off",
        //"curly": "error",
        "default-case": "off",
        "dot-location": ["error", "property"],
        "dot-notation": "error",
        "eqeqeq": "error",
        "guard-for-in": "error",
        "no-alert": "error",
        "no-caller": "error",
        "no-case-declarations": "error",
        "no-div-regex": "error",
        "no-else-return": "error",
        "no-empty-function": "error",
        "no-empty-pattern": "error",
        "no-eq-null": "error",
        "no-eval": "error",
        "no-extend-native": "error",
        "no-extra-bind": "error",
        "no-extra-label": "error",
        "no-fallthrough": "warn",
        "no-floating-decimal": "error",
        "no-implicit-coercion": "error",
        "no-implicit-globals": "warn",
        "no-implied-eval": "error",
        "no-invalid-this": "error",
        "no-iterator": "error",
        "no-labels": "error",
        "no-lone-blocks": "error",
        "no-loop-func": "error",
        "no-magic-numbers": ["error", { "ignore": [-1, 0, 1, 2, 5, 100, 1000] }],
        "no-multi-spaces": "error",
        "no-multi-str": "warn",
        "no-native-reassign": "error",
        "no-new": "error",
        "no-new-func": "error",
        "no-new-wrappers": "error",
        "no-octal": "error",
        "no-octal-escape": "error",
        "no-param-reassign": "error",
        "no-proto": "error",
        "no-redeclare": "error",
        "no-return-assign": "error",
        "no-script-url": "error",
        "no-self-assign": "error",
        "no-self-compare": "error",
        "no-sequences": "error",
        "no-throw-literal": "error",
        "no-unmodified-loop-condition": "error",
        "no-unused-expressions": "error",
        "no-unused-labels": "error",
        "no-useless-call": "error",
        "no-useless-concat": "error",
        "no-useless-escape": "error",
        "no-void": "error",
        "no-warning-comments": "error",
        "no-with": "error",
        "radix": "error",
        "vars-on-top": "off",
        "wrap-iife": "error",
        "yoda": "error",
        "strict": "error",
        "init-declarations": "error",
        "no-catch-shadow": "error",
        "no-delete-var": "error",
        "no-label-var": "error",
        "no-restricted-globals": "error",
        "no-shadow": "error",
        "no-shadow-restricted-names": "error",
        "no-undef": "error",
        "no-undef-init": "error",
        "no-undefined": "error",
        "no-unused-vars": "error",
        "no-use-before-define": "error",
        "callback-return": "error",
        "global-require": "error",
        "handle-callback-err": "error",
        "no-mixed-requires": "error",
        "no-new-require": "error",
        "no-path-concat": "error",
        "no-process-env": "warn",
        "no-process-exit": "error",
        "no-restricted-modules": "error",
        "no-sync": "error",
        "array-bracket-spacing": "error",
        "block-spacing": "error",
        "brace-style": "error",
        "camelcase": "error",
        "comma-spacing": "error",
        "comma-style": "error",
        "computed-property-spacing": "error",
        "consistent-this": "error",
        "eol-last": "error",
        "func-names": "off",
        "func-style": "error",
        "id-blacklist": "error",
        "id-length": "error",
        "id-match": "error",
        "jsx-quotes": "error",
        "key-spacing": "error",
        "keyword-spacing": "error",
        "lines-around-comment": "error",
        "max-depth": "error",
        "max-len": "off",
        "max-nested-callbacks": "error",
        "max-params": ["error", 4],
        "max-statements": "error",
        "max-statements-per-line": "error",
        "new-cap": "error",
        "new-parens": "error",
        "newline-after-var": "off",
        "newline-before-return": "off",
        "newline-per-chained-call": "error",
        "no-array-constructor": "error",
        "no-bitwise": "error",
        "no-continue": "error",
        "no-inline-comments": "error",
        "no-lonely-if": "error",
        "no-mixed-spaces-and-tabs": "error",
        "no-multiple-empty-lines": "error",
        "no-negated-condition": "error",
        "no-nested-ternary": "error",
        "no-new-object": "error",
        "no-plusplus": "warn",
        "no-restricted-syntax": "error",
        "no-spaced-func": "error",
        "no-ternary": "off",
        "no-trailing-spaces": "error",
        "no-underscore-dangle": "error",
        "no-unneeded-ternary": "warn",
        "no-whitespace-before-property": "error",
        "object-curly-spacing": "error",
        "one-var": "off",
        "one-var-declaration-per-line": "error",
        "operator-assignment": "error",
        "operator-linebreak": "error",
        "padded-blocks": "off",
        "quote-props": "off",
        "require-jsdoc": ["error", {
            "require": {
                "FunctionDeclaration": false,
                "MethodDefinition": true,
                "ClassDeclaration": true
            }
        }],
        "semi-spacing": "error",
        "sort-imports": "error",
        "sort-vars": "error",
        "space-before-blocks": "error",
        "space-before-function-paren": "off",
        "space-in-parens": "error",
        "space-infix-ops": "error",
        "space-unary-ops": "error",
        "spaced-comment": "error",
        "wrap-regex": "error",
    }
};
<commit_msg>update eslint<commit_after>module.exports = {
  env: {
    node: true
  },
  parserOptions: {
    ecmaVersion: 2017,
    sourceType: 'module',
  },
  extends: 'eslint:recommended',
  rules: {
    indent: ['error', 2, {
      SwitchCase: 1
    }],
    'linebreak-style': [
      'error', 'unix'
    ],
    quotes: [
      'error', 'single'
    ],
    semi: [
      'error', 'never'
    ],
    'comma-dangle': 'error',
    'no-cond-assign': 'error',
    'no-console': 'off',
    'no-debugger': 'error',
    'no-constant-condition': 'error',
    'no-dupe-args': 'error',
    'no-dupe-keys': 'error',
    'no-duplicate-case': 'error',
    'no-empty': 'error',
    'no-empty-character-class': 'error',
    'no-ex-assign': 'error',
    'no-extra-boolean-cast': 'error',
    'no-extra-parens': 'error',
    'no-extra-semi': 'error',
    'no-func-assign': 'error',
    'no-inner-declarations': 'error',
    'no-invalid-regexp': 'error',
    'no-irregular-whitespace': 'warn',
    'no-negated-in-lhs': 'error',
    'no-obj-calls': 'error',
    'no-regex-spaces': 'error',
    'no-sparse-arrays': 'error',
    'no-unexpected-multiline': 'error',
    'no-unreachable': 'error',
    'use-isnan': 'error',
    'valid-jsdoc': 'error',
    'valid-typeof': 'error',
    'accessor-pairs': 'error',
    'array-callback-return': 'error',
    'block-scoped-var': 'error',
    complexity: 'error',
    'consistent-return': 'off',
    //curly: 'error',
    'default-case': 'off',
    'dot-location': ['error', 'property'],
    'dot-notation': 'error',
    eqeqeq: 'error',
    'guard-for-in': 'error',
    'no-alert': 'error',
    'no-caller': 'error',
    'no-case-declarations': 'error',
    'no-div-regex': 'error',
    'no-else-return': 'error',
    'no-empty-function': 'error',
    'no-empty-pattern': 'error',
    'no-eq-null': 'error',
    'no-eval': 'error',
    'no-extend-native': 'error',
    'no-extra-bind': 'error',
    'no-extra-label': 'error',
    'no-fallthrough': 'warn',
    'no-floating-decimal': 'error',
    'no-implicit-coercion': 'error',
    'no-implicit-globals': 'warn',
    'no-implied-eval': 'error',
    'no-invalid-this': 'error',
    'no-iterator': 'error',
    'no-labels': 'error',
    'no-lone-blocks': 'error',
    // 'no-loop-func': 'error',
    'no-magic-numbers': ['error', {
      ignore: [-1, 0, 1, 2, 5, 100, 1000]
    }],
    'no-multi-spaces': 'error',
    'no-multi-str': 'warn',
    'no-native-reassign': 'error',
    'no-new': 'error',
    'no-new-func': 'error',
    'no-new-wrappers': 'error',
    'no-octal': 'error',
    'no-octal-escape': 'error',
    'no-param-reassign': 'error',
    'no-proto': 'error',
    'no-redeclare': 'error',
    'no-return-assign': 'error',
    'no-script-url': 'error',
    'no-self-assign': 'error',
    'no-self-compare': 'error',
    'no-sequences': 'error',
    'no-throw-literal': 'error',
    'no-unmodified-loop-condition': 'error',
    'no-unused-expressions': 'error',
    'no-unused-labels': 'error',
    'no-useless-call': 'error',
    'no-useless-concat': 'error',
    'no-useless-escape': 'error',
    'no-void': 'error',
    'no-warning-comments': 'error',
    'no-with': 'error',
    radix: 'error',
    'vars-on-top': 'off',
    'wrap-iife': 'error',
    yoda: 'error',
    'init-declarations': 'error',
    'no-catch-shadow': 'error',
    'no-delete-var': 'error',
    'no-label-var': 'error',
    'no-restricted-globals': 'error',
    'no-shadow': 'error',
    'no-shadow-restricted-names': 'error',
    'no-undef': 'error',
    'no-undef-init': 'error',
    'no-undefined': 'error',
    'no-unused-vars': 'error',
    'no-use-before-define': 'error',
    'callback-return': 'error',
    'global-require': 'error',
    'handle-callback-err': 'error',
    'no-mixed-requires': 'error',
    'no-new-require': 'error',
    'no-path-concat': 'error',
    'no-process-env': 'warn',
    'no-process-exit': 'error',
    'no-restricted-modules': 'error',
    'no-sync': 'error',
    'array-bracket-spacing': 'error',
    'block-spacing': 'error',
    'brace-style': 'error',
    camelcase: 'error',
    'comma-spacing': 'error',
    'comma-style': 'error',
    'computed-property-spacing': 'error',
    'consistent-this': 'error',
    'eol-last': 'error',
    'func-names': 'off',
    // 'func-style': 'error',
    'id-blacklist': 'error',
    // 'id-length': 'error',
    'id-match': 'error',
    'jsx-quotes': 'error',
    'key-spacing': 'error',
    'keyword-spacing': 'error',
    'lines-around-comment': 'error',
    'max-depth': 'error',
    'max-len': 'off',
    'max-nested-callbacks': 'error',
    'max-params': ['error', 4],
    // 'max-statements': 'error',
    // 'max-statements-per-line': 'error',
    'new-cap': 'error',
    'new-parens': 'error',
    'newline-after-var': 'off',
    'newline-before-return': 'off',
    'newline-per-chained-call': 'error',
    'no-array-constructor': 'error',
    'no-bitwise': 'error',
    'no-continue': 'error',
    'no-inline-comments': 'error',
    'no-lonely-if': 'error',
    'no-mixed-spaces-and-tabs': 'error',
    'no-multiple-empty-lines': 'error',
    'no-negated-condition': 'error',
    'no-nested-ternary': 'error',
    'no-new-object': 'error',
    'no-plusplus': 'warn',
    'no-restricted-syntax': 'error',
    'no-spaced-func': 'error',
    'no-ternary': 'off',
    'no-trailing-spaces': 'error',
    'no-underscore-dangle': 'error',
    'no-unneeded-ternary': 'warn',
    'no-whitespace-before-property': 'error',
    'object-curly-spacing': ['error', 'always'],
    'one-var': 'off',
    'one-var-declaration-per-line': 'error',
    'operator-assignment': 'error',
    'operator-linebreak': 'error',
    'padded-blocks': 'off',
    'quote-props': 'off',
    'require-jsdoc': ['error', {
      require: {
        FunctionDeclaration: false,
        MethodDefinition: true,
        ClassDeclaration: true
      }
    }],
    'semi-spacing': 'error',
    'sort-imports': 'error',
    'sort-vars': 'error',
    'space-before-blocks': 'error',
    'space-before-function-paren': 'off',
    'space-in-parens': 'error',
    'space-infix-ops': 'error',
    'space-unary-ops': 'error',
    'spaced-comment': 'error',
    'wrap-regex': 'error',
  }
};<|endoftext|>


<commit_before>module.exports = {
    plugins: [
        "matrix-org",
    ],
    extends: [
        "plugin:matrix-org/babel",
    ],
    env: {
        browser: true,
        node: true,
    },
    rules: {
        "no-var": ["warn"],
        "prefer-rest-params": ["warn"],
        "prefer-spread": ["warn"],
        "one-var": ["warn"],
        "padded-blocks": ["warn"],
        "no-extend-native": ["warn"],
        "camelcase": ["warn"],
        "no-multi-spaces": ["error", { "ignoreEOLComments": true }],
        "space-before-function-paren": ["error", {
            "anonymous": "never",
            "named": "never",
            "asyncArrow": "always",
        }],
        "arrow-parens": "off",
        "prefer-promise-reject-errors": "off",
        "quotes": "off",
        "indent": "off",
        "no-constant-condition": "off",
        "no-async-promise-executor": "off",
        // We use a `logger` intermediary module
        "no-console": "error",

        // restrict EventEmitters to force callers to use TypedEventEmitter
        "no-restricted-imports": ["error", "events"],
    },
    overrides: [{
        files: [
            "**/*.ts",
        ],
        extends: [
            "plugin:matrix-org/typescript",
        ],
        rules: {
            // TypeScript has its own version of this
            "@babel/no-invalid-this": "off",

            // We're okay being explicit at the moment
            "@typescript-eslint/no-empty-interface": "off",
            // We disable this while we're transitioning
            "@typescript-eslint/no-explicit-any": "off",
            // We'd rather not do this but we do
            "@typescript-eslint/ban-ts-comment": "off",
            // We're okay with assertion errors when we ask for them
            "@typescript-eslint/no-non-null-assertion": "off",

            "quotes": "off",
            // We use a `logger` intermediary module
            "no-console": "error",
        },
    }],
};
<commit_msg>Document where new linting rules go (#2573)<commit_after>module.exports = {
    plugins: [
        "matrix-org",
    ],
    extends: [
        "plugin:matrix-org/babel",
    ],
    env: {
        browser: true,
        node: true,
    },
    // NOTE: These rules are frozen and new rules should not be added here.
    // New changes belong in https://github.com/matrix-org/eslint-plugin-matrix-org/
    rules: {
        "no-var": ["warn"],
        "prefer-rest-params": ["warn"],
        "prefer-spread": ["warn"],
        "one-var": ["warn"],
        "padded-blocks": ["warn"],
        "no-extend-native": ["warn"],
        "camelcase": ["warn"],
        "no-multi-spaces": ["error", { "ignoreEOLComments": true }],
        "space-before-function-paren": ["error", {
            "anonymous": "never",
            "named": "never",
            "asyncArrow": "always",
        }],
        "arrow-parens": "off",
        "prefer-promise-reject-errors": "off",
        "quotes": "off",
        "indent": "off",
        "no-constant-condition": "off",
        "no-async-promise-executor": "off",
        // We use a `logger` intermediary module
        "no-console": "error",

        // restrict EventEmitters to force callers to use TypedEventEmitter
        "no-restricted-imports": ["error", "events"],
    },
    overrides: [{
        files: [
            "**/*.ts",
        ],
        extends: [
            "plugin:matrix-org/typescript",
        ],
        rules: {
            // TypeScript has its own version of this
            "@babel/no-invalid-this": "off",

            // We're okay being explicit at the moment
            "@typescript-eslint/no-empty-interface": "off",
            // We disable this while we're transitioning
            "@typescript-eslint/no-explicit-any": "off",
            // We'd rather not do this but we do
            "@typescript-eslint/ban-ts-comment": "off",
            // We're okay with assertion errors when we ask for them
            "@typescript-eslint/no-non-null-assertion": "off",

            "quotes": "off",
            // We use a `logger` intermediary module
            "no-console": "error",
        },
    }],
};
<|endoftext|>


<commit_before>let GitHubApi = require("github");
let Promise = require('bluebird');

class GithubSync {
    /**
     * In order to work as an NPM module this class has to be called with specific parameters
     * @param {Object} options - GitHub
     * @param {string} user - GitHub repository user
     * @param {string} repo - GitHub repository name
     * @param {string} token - GitHub personal access token
     */
    constructor(options = {}, user, repo, token) {
        this.options = options;
        this.user = user;
        this.repo = repo;
        this.token = token;
        this.github = new GitHubApi(this.options);
        this.labels = [];
        /**
         * Async calls to delete labels will be logged to this array
         * @type {Array}
         */
        this._deletedLabels = [];
        /**
         * Async calls to create labels will be logged to this array
         * @type {Array}
         */
        this._createdLabels = [];

        this.authenticate();
    }

    /**
     * Get GitHubApi module connect options
     * @returns {Object}
     */
    get options() {
        return this._options;
    }

    /**
     * Get GitHub repository username
     * @returns {String}
     */
    get user() {
        return this._user;
    }

    /**
     * Get GitHub repository name
     * @returns {String}
     */
    get repo() {
        return this._repo;
    }

    /**
     * Get GitHub repository token
     * @returns {String}
     */
    get token() {
        return this._token;
    }

    /**
     * Get GitHubApi module
     * @returns {GitHubApi|module.exports}
     */
    get github() {
        return this._github;
    }

    /**
     * Get GitHub repository labels
     * @returns {Array}
     */
    get labels() {
        return this._labels;
    }

    /**
     * Get GitHubApi repository deleted labels
     * @returns {Array}
     */
    get deletedLabels() {
        return this._deletedLabels;
    }

    /**
     * Get GitHubApi repository created labels
     * @returns {Array}
     */
    get createdLabels() {
        return this._createdLabels;
    }

    /**
     * Set GitHubApi module connect options
     * @param {Object} object
     */
    set options(object) {
        this._options = object;
    }

    /**
     * Set GitHubApi repository username
     * @param {String} repoUrlUser
     */
    set user(repoUrlUser) {
        this._user = repoUrlUser;
    }

    /**
     * Set GitHubApi repository name
     * @param {String} repoUrlName
     */
    set repo(repoUrlName) {
        this._repo = repoUrlName;
    }

    /**
     * Set GitHubApi OAuth2 personal access token
     * @param {String} personalAccessToken
     */
    set token(personalAccessToken) {
        this._token = personalAccessToken;
    }

    /**
     * Set GitHubApi Client
     * @param {GitHubApi|module.exports} Client
     */
    set github(Client) {
        this._github = Client;
    }

    /**
     * Set GitHubApi repository labels
     * @param {Array} labels
     */
    set labels(labels) {
        this._labels = labels;
    }

    /**
     * Push GitHubApi repository deleted label
     * @param {Object} label
     */
    set deletedLabel(label) {
        this._deletedLabels.push(label);
    }

    /**
     * Push GitHubApi repository created label
     * @param {Object} label
     */
    set createdLabel(label) {
        this._createdLabels.push(label);
    }

    /**
     * We only do this once
     */
    authenticate() {
        this.github.authenticate({
            type: "oauth",
            token: this.token
        });
    }

    /**
     * Get GitHubApi repository labels from remote
     * @async
     * @param {Boolean} meta
     * @returns {Promise}
     */
    getLabels(meta = false) {
        return this.github.issues.getLabels({
            user: this.user,
            repo: this.repo
        }).then((response) => {
            if (true !== meta) {
                delete response["meta"];
            }

            this.labels = response;

            return this.labels;
        });
    }

    /**
     * Delete GitHubApi repository label from remote
     * @async
     * @param {Object} label
     * @returns {Promise}
     */
    deleteLabel(label) {
        return this.github.issues.deleteLabel({
            user: this.user,
            repo: this.repo,
            name: label.name
        }).then((response) => {
            label.status = 'success';

            return response;
        }).catch((error) => {
            label.status = 'error';

            return error.message;
        }).lastly(() => {
            this.deletedLabel = label;

            return label;
        });
    }

    /**
     * Delete GitHubApi repository labels from remote
     * @async
     * @param {Array} labels
     * @returns {Promise}
     */
    deleteLabels(labels) {
        return Promise.all(labels).map((label) => {
            return this.deleteLabel(label);
        });
    }

    /**
     * Create GitHubApi repository label on remote
     * @async
     * @param {Object} label
     * @returns {Promise}
     */
    createLabel(label) {
        return this.github.issues.createLabel({
            user: this.user,
            repo: this.repo,
            name: label.name,
            color: label.color
        }).then((response) => {
            label.status = 'success';

            return response;
        }).catch((response) => {
            let error = JSON.parse(response);
            let code = error["errors"][0].code;

            if (code === "already_exists") {
                label.status = 'duplicate';
            } else {
                label.status = 'error';
            }

            return error;
        }).lastly(() => {
            this.createdLabel = label;
        });
    }

    /**
     * Create GitHubApi repository labels on remote
     * @async
     * @param {Array} labels
     * @returns {Promise}
     */
    createLabels(labels) {
        return Promise.all(labels).map((label) => {
            return this.createLabel(label);
        });
    }

    /**
     * Delete all GitHubApi repository labels on remote
     * @async
     * @returns {Promise}
     */
    purgeLabels() {
        return this.getLabels().then((labels) => {
            return Promise.all(labels).map((label) => {
                return this.deleteLabel(label);
            });
        });
    }
}

module.exports = GithubSync;
<commit_msg>feat(github): added async import labels function<commit_after>let GitHubApi = require("github");
let Promise = require('bluebird');

class GithubSync {
    /**
     * In order to work as an NPM module this class has to be called with specific parameters
     * @param {Object} options - GitHub
     * @param {string} user - GitHub repository user
     * @param {string} repo - GitHub repository name
     * @param {string} token - GitHub personal access token
     */
    constructor(options = {}, user, repo, token) {
        this.options = options;
        this.user = user;
        this.repo = repo;
        this.token = token;
        this.github = new GitHubApi(this.options);
        /**
         * Async calls to this.getLabels() get logged here
         * @type {Array}
         */
        this.labels = [];
        /**
         * Async calls to this.deleteLabels() get logged here
         * @type {Array}
         */
        this._deletedLabels = [];
        /**
         * Async calls to this.createLabels() get logged here
         * @type {Array}
         */
        this._createdLabels = [];

        this.authenticate();
    }

    /**
     * Get GitHubApi module connect options
     * @returns {Object}
     */
    get options() {
        return this._options;
    }

    /**
     * Get GitHub repository username
     * @returns {String}
     */
    get user() {
        return this._user;
    }

    /**
     * Get GitHub repository name
     * @returns {String}
     */
    get repo() {
        return this._repo;
    }

    /**
     * Get GitHub repository token
     * @returns {String}
     */
    get token() {
        return this._token;
    }

    /**
     * Get GitHubApi module
     * @returns {GitHubApi|module.exports}
     */
    get github() {
        return this._github;
    }

    /**
     * Get GitHub repository labels
     * @returns {Array}
     */
    get labels() {
        return this._labels;
    }

    /**
     * Get GitHubApi repository deleted labels
     * @returns {Array}
     */
    get deletedLabels() {
        return this._deletedLabels;
    }

    /**
     * Get GitHubApi repository created labels
     * @returns {Array}
     */
    get createdLabels() {
        return this._createdLabels;
    }

    /**
     * Set GitHubApi module connect options
     * @param {Object} object
     */
    set options(object) {
        this._options = object;
    }

    /**
     * Set GitHubApi repository username
     * @param {String} repoUrlUser
     */
    set user(repoUrlUser) {
        this._user = repoUrlUser;
    }

    /**
     * Set GitHubApi repository name
     * @param {String} repoUrlName
     */
    set repo(repoUrlName) {
        this._repo = repoUrlName;
    }

    /**
     * Set GitHubApi OAuth2 personal access token
     * @param {String} personalAccessToken
     */
    set token(personalAccessToken) {
        this._token = personalAccessToken;
    }

    /**
     * Set GitHubApi Client
     * @param {GitHubApi|module.exports} Client
     */
    set github(Client) {
        this._github = Client;
    }

    /**
     * Set GitHubApi repository labels
     * @param {Array} labels
     */
    set labels(labels) {
        this._labels = labels;
    }

    /**
     * Push GitHubApi repository deleted label
     * @param {Object} label
     */
    set deletedLabel(label) {
        this._deletedLabels.push(label);
    }

    /**
     * Push GitHubApi repository created label
     * @param {Object} label
     */
    set createdLabel(label) {
        this._createdLabels.push(label);
    }

    /**
     * We only do this once
     */
    authenticate() {
        this.github.authenticate({
            type: "oauth",
            token: this.token
        });
    }

    /**
     * Get GitHubApi repository labels from remote
     * @async
     * @param {Boolean} meta
     * @returns {Promise}
     */
    getLabels(meta = false) {
        return this.github.issues.getLabels({
            user: this.user,
            repo: this.repo
        }).then((response) => {
            if (true !== meta) {
                delete response["meta"];
            }

            this.labels = response;

            return this.labels;
        });
    }

    /**
     * Delete GitHubApi repository label from remote
     * @async
     * @param {Object} label
     * @returns {Promise}
     */
    deleteLabel(label) {
        return this.github.issues.deleteLabel({
            user: this.user,
            repo: this.repo,
            name: label.name
        }).then((response) => {
            label.status = 'success';

            return response;
        }).catch((error) => {
            label.status = 'error';

            return error.message;
        }).lastly(() => {
            this.deletedLabel = label;

            return label;
        });
    }

    /**
     * Delete GitHubApi repository labels from remote
     * @async
     * @param {Array} labels
     * @returns {Promise}
     */
    deleteLabels(labels) {
        return Promise.all(labels).map((label) => {
            return this.deleteLabel(label);
        });
    }

    /**
     * Create GitHubApi repository label on remote
     * @async
     * @param {Object} label
     * @returns {Promise}
     */
    createLabel(label) {
        return this.github.issues.createLabel({
            user: this.user,
            repo: this.repo,
            name: label.name,
            color: label.color
        }).then((response) => {
            label.status = 'success';

            return response;
        }).catch((response) => {
            let error = JSON.parse(response);
            let code = error["errors"][0].code;

            if (code === "already_exists") {
                label.status = 'duplicate';
            } else {
                label.status = 'error';
            }

            return error;
        }).lastly(() => {
            this.createdLabel = label;
        });
    }

    /**
     * Create GitHubApi repository labels on remote
     * @async
     * @param {Array} labels
     * @returns {Promise}
     */
    createLabels(labels) {
        return Promise.all(labels).map((label) => {
            return this.createLabel(label);
        });
    }

    /**
     * Delete all GitHubApi repository labels on remote
     * @async
     * @returns {Promise}
     */
    purgeLabels() {
        return this.getLabels().then((labels) => {
            return Promise.all(labels).map((label) => {
                return this.deleteLabel(label);
            });
        });
    }

    /**
     * Import all GitHubApi repository labels on remote while optionally removing all the others
     * @async
     * @param {Array} labels
     * @param {Boolean} purge
     * @returns {Promise}
     */
    importLabels(labels, purge = true) {
        return Promise.resolve(true === purge ? this.purgeLabels() : true).then(() => {
            return this.createLabels(labels);
        });
    }
}

module.exports = GithubSync;
<|endoftext|>


<commit_before>module.exports = {
    "env": {
        "es6": true,
        "node": true,
		"mocha": true
    },
    "extends": "eslint:recommended",
	"plugins": [
		"mocha"
	],
    "rules": {
		"mocha/no-exclusive-tests": "error",
        "accessor-pairs": "error",
        "array-bracket-spacing": [
            "error",
            "never"
        ],
        "array-callback-return": "error",
        "arrow-body-style": "off",
        "arrow-parens": "off",
        "arrow-spacing": [
            "error",
            {
                "after": true,
                "before": true
            }
        ],
        "block-scoped-var": "error",
        "block-spacing": ["error", "always"],
        "brace-style": "off",
        "callback-return": "off",
        "camelcase": "off",
        "class-methods-use-this": "off",
        "comma-dangle": "off",
        "comma-spacing": ["error", {"before": false, "after": true}],
        "comma-style": [
            "error",
            "last"
        ],
        "complexity": "off",
        "computed-property-spacing": [
            "error",
            "never"
        ],
        "consistent-return": "error",
        "consistent-this": ["error", "self"],
        "curly": "error",
        "default-case": "error",
        "dot-location": [
            "error",
            "property"
        ],
        "dot-notation": "off",
        "eol-last": ["error", "always"],
        "eqeqeq": ["error", "always"],
        "func-call-spacing": "error",
        "func-name-matching": "off",
        "func-names": "off",
        "func-style": "off",
        "generator-star-spacing": "error",
        "global-require": "off",
        "guard-for-in": "off",
        "handle-callback-err": "error",
        "id-blacklist": "error",
        "id-length": "off",
        "id-match": "error",
        "indent": ["error", "tab"],
        "init-declarations": "off",
        "jsx-quotes": "error",
        "key-spacing": ["error", {"beforeColon": false, "afterColon": true}],
        "keyword-spacing": ["error", {"before": true, "after": true}],
        "line-comment-position": "off",
        "linebreak-style": [
            "error",
            "unix"
        ],
        "lines-around-comment": "off",
        "lines-around-directive": "error",
        "max-depth": "error",
        "max-len": "off",
        "max-lines": "off",
        "max-nested-callbacks": "error",
        "max-params": "off",
        "max-statements": "off",
        "max-statements-per-line": "off",
        "multiline-ternary": "off",
        "new-parens": "off",
        "newline-after-var": ["error", "always"],
        "newline-before-return": "error",
        "newline-per-chained-call": "off",
        "no-alert": "error",
        "no-array-constructor": "error",
        "no-bitwise": "error",
        "no-caller": "error",
        "no-catch-shadow": "error",
        "no-cond-assign": [
            "error",
            "except-parens"
        ],
        "no-confusing-arrow": "error",
        "no-constant-condition": [
            "error",
            {
                "checkLoops": false
            }
        ],
        "no-continue": "off",
        "no-div-regex": "error",
        "no-duplicate-imports": "error",
        "no-else-return": "off",
        "no-empty-function": "off",
        "no-eq-null": "error",
        "no-eval": "error",
        "no-extend-native": "error",
        "no-extra-bind": "error",
        "no-extra-label": "error",
        "no-extra-parens": "off",
        "no-floating-decimal": "error",
        "no-implicit-globals": "error",
        "no-implied-eval": "error",
        "no-inline-comments": "off",
        "no-invalid-this": "error",
        "no-iterator": "error",
        "no-label-var": "error",
        "no-labels": "error",
        "no-lone-blocks": "error",
        "no-lonely-if": "error",
        "no-loop-func": "off",
        "no-magic-numbers": "off",
        "no-mixed-operators": "error",
        "no-mixed-requires": "error",
        "no-multi-spaces": "error",
        "no-multi-str": "error",
        "no-multiple-empty-lines": "error",
        "no-native-reassign": "error",
        "no-negated-condition": "off",
        "no-negated-in-lhs": "error",
        "no-nested-ternary": "error",
        "no-new": "error",
        "no-new-func": "off",
        "no-new-object": "error",
        "no-new-require": "error",
        "no-new-wrappers": "error",
        "no-octal-escape": "error",
        "no-param-reassign": "error",
        "no-path-concat": "error",
        "no-plusplus": "off",
        "no-process-env": "error",
        "no-process-exit": "error",
        "no-proto": "error",
        "no-prototype-builtins": "off",
        "no-restricted-globals": "error",
        "no-restricted-imports": "error",
        "no-restricted-modules": "error",
        "no-restricted-properties": "error",
        "no-restricted-syntax": "error",
        "no-return-assign": "error",
        "no-return-await": "error",
        "no-script-url": "error",
        "no-self-compare": "error",
        "no-sequences": "error",
        "no-shadow": "off",
        "no-shadow-restricted-names": "error",
        "no-spaced-func": "error",
        "no-sync": "off",
        "no-tabs": "off",
        "no-template-curly-in-string": "error",
        "no-ternary": "off",
        "no-throw-literal": "error",
        "no-trailing-spaces": "error",
        "no-undef-init": "error",
        "no-undefined": "off",
        "no-underscore-dangle": "off",
        "no-unmodified-loop-condition": "error",
        "no-unneeded-ternary": "error",
        "no-unused-expressions": "error",
        "no-use-before-define": "error",
        "no-useless-call": "off",
        "no-useless-computed-key": "error",
        "no-useless-concat": "error",
        "no-useless-constructor": "off",
        "no-useless-escape": "error",
        "no-useless-rename": "error",
        "no-useless-return": "error",
        "no-var": "off",
        "no-void": "error",
        "no-warning-comments": "off",
        "no-whitespace-before-property": "error",
        "no-with": "error",
		"no-unused-vars": ["error", { "vars": "all", "args": "none" }],
        "object-curly-newline": "off",
        "object-curly-spacing": "off",
        "object-property-newline": [
            "error",
            {
                "allowMultiplePropertiesPerLine": true
            }
        ],
        "object-shorthand": "off",
        "one-var": ["error", "never"],
        "one-var-declaration-per-line": "off",
        "operator-assignment": "off",
        "operator-linebreak": "off",
        "padded-blocks": "off",
        "prefer-arrow-callback": "off",
        "prefer-const": "error",
        "prefer-numeric-literals": "error",
        "prefer-reflect": "off",
        "prefer-rest-params": "error",
        "prefer-spread": "error",
        "prefer-template": "off",
        "quote-props": "off",
        "quotes": ["error", "single"],
        "radix": [
            "error",
            "as-needed"
        ],
        "require-jsdoc": "off",
        "rest-spread-spacing": [
            "error",
            "never"
        ],
        "semi": ["error", "always"],
        "semi-spacing": "off",
        "sort-imports": "error",
        "sort-keys": "off",
        "sort-vars": "off",
        "space-before-blocks": "error",
        "space-before-function-paren": "off",
        "space-in-parens": [
            "error",
            "never"
        ],
        "space-infix-ops": "error",
        "space-unary-ops": [
            "error",
            {
                "nonwords": false,
                "words": false
            }
        ],
        "spaced-comment": "off",
        "strict": ["error", "global"],
        "symbol-description": "error",
        "template-curly-spacing": "error",
        "unicode-bom": [
            "error",
            "never"
        ],
        "valid-jsdoc": "off",
        "vars-on-top": "off",
        "wrap-regex": "error",
        "yield-star-spacing": "error",
        "yoda": [
            "error",
            "never"
        ]
    }
};<commit_msg>Formatting<commit_after>module.exports = {
	"env": {
		"es6": true,
		"node": true,
		"mocha": true
	},
	"extends": "eslint:recommended",
	"plugins": [
		"mocha"
	],
	"rules": {
		"mocha/no-exclusive-tests": "error",
		"accessor-pairs": "error",
		"array-bracket-spacing": [
			"error",
			"never"
		],
		"array-callback-return": "error",
		"arrow-body-style": "off",
		"arrow-parens": "off",
		"arrow-spacing": [
			"error",
			{
				"after": true,
				"before": true
			}
		],
		"block-scoped-var": "error",
		"block-spacing": ["error", "always"],
		"brace-style": "off",
		"callback-return": "off",
		"camelcase": "off",
		"class-methods-use-this": "off",
		"comma-dangle": "off",
		"comma-spacing": ["error", {"before": false, "after": true}],
		"comma-style": [
			"error",
			"last"
		],
		"complexity": "off",
		"computed-property-spacing": [
			"error",
			"never"
		],
		"consistent-return": "error",
		"consistent-this": ["error", "self"],
		"curly": "error",
		"default-case": "error",
		"dot-location": [
			"error",
			"property"
		],
		"dot-notation": "off",
		"eol-last": ["error", "always"],
		"eqeqeq": ["error", "always"],
		"func-call-spacing": "error",
		"func-name-matching": "off",
		"func-names": "off",
		"func-style": "off",
		"generator-star-spacing": "error",
		"global-require": "off",
		"guard-for-in": "off",
		"handle-callback-err": "error",
		"id-blacklist": "error",
		"id-length": "off",
		"id-match": "error",
		"indent": ["error", "tab"],
		"init-declarations": "off",
		"jsx-quotes": "error",
		"key-spacing": ["error", {"beforeColon": false, "afterColon": true}],
		"keyword-spacing": ["error", {"before": true, "after": true}],
		"line-comment-position": "off",
		"linebreak-style": [
			"error",
			"unix"
		],
		"lines-around-comment": "off",
		"lines-around-directive": "error",
		"max-depth": "error",
		"max-len": "off",
		"max-lines": "off",
		"max-nested-callbacks": "error",
		"max-params": "off",
		"max-statements": "off",
		"max-statements-per-line": "off",
		"multiline-ternary": "off",
		"new-parens": "off",
		"newline-after-var": ["error", "always"],
		"newline-before-return": "error",
		"newline-per-chained-call": "off",
		"no-alert": "error",
		"no-array-constructor": "error",
		"no-bitwise": "error",
		"no-caller": "error",
		"no-catch-shadow": "error",
		"no-cond-assign": [
			"error",
			"except-parens"
		],
		"no-confusing-arrow": "error",
		"no-constant-condition": [
			"error",
			{
				"checkLoops": false
			}
		],
		"no-continue": "off",
		"no-div-regex": "error",
		"no-duplicate-imports": "error",
		"no-else-return": "off",
		"no-empty-function": "off",
		"no-eq-null": "error",
		"no-eval": "error",
		"no-extend-native": "error",
		"no-extra-bind": "error",
		"no-extra-label": "error",
		"no-extra-parens": "off",
		"no-floating-decimal": "error",
		"no-implicit-globals": "error",
		"no-implied-eval": "error",
		"no-inline-comments": "off",
		"no-invalid-this": "error",
		"no-iterator": "error",
		"no-label-var": "error",
		"no-labels": "error",
		"no-lone-blocks": "error",
		"no-lonely-if": "error",
		"no-loop-func": "off",
		"no-magic-numbers": "off",
		"no-mixed-operators": "error",
		"no-mixed-requires": "error",
		"no-multi-spaces": "error",
		"no-multi-str": "error",
		"no-multiple-empty-lines": "error",
		"no-native-reassign": "error",
		"no-negated-condition": "off",
		"no-negated-in-lhs": "error",
		"no-nested-ternary": "error",
		"no-new": "error",
		"no-new-func": "off",
		"no-new-object": "error",
		"no-new-require": "error",
		"no-new-wrappers": "error",
		"no-octal-escape": "error",
		"no-param-reassign": "error",
		"no-path-concat": "error",
		"no-plusplus": "off",
		"no-process-env": "error",
		"no-process-exit": "error",
		"no-proto": "error",
		"no-prototype-builtins": "off",
		"no-restricted-globals": "error",
		"no-restricted-imports": "error",
		"no-restricted-modules": "error",
		"no-restricted-properties": "error",
		"no-restricted-syntax": "error",
		"no-return-assign": "error",
		"no-return-await": "error",
		"no-script-url": "error",
		"no-self-compare": "error",
		"no-sequences": "error",
		"no-shadow": "off",
		"no-shadow-restricted-names": "error",
		"no-spaced-func": "error",
		"no-sync": "off",
		"no-tabs": "off",
		"no-template-curly-in-string": "error",
		"no-ternary": "off",
		"no-throw-literal": "error",
		"no-trailing-spaces": "error",
		"no-undef-init": "error",
		"no-undefined": "off",
		"no-underscore-dangle": "off",
		"no-unmodified-loop-condition": "error",
		"no-unneeded-ternary": "error",
		"no-unused-expressions": "error",
		"no-use-before-define": "error",
		"no-useless-call": "off",
		"no-useless-computed-key": "error",
		"no-useless-concat": "error",
		"no-useless-constructor": "off",
		"no-useless-escape": "error",
		"no-useless-rename": "error",
		"no-useless-return": "error",
		"no-var": "off",
		"no-void": "error",
		"no-warning-comments": "off",
		"no-whitespace-before-property": "error",
		"no-with": "error",
		"no-unused-vars": ["error", {"vars": "all", "args": "none"}],
		"object-curly-newline": "off",
		"object-curly-spacing": "off",
		"object-property-newline": [
			"error",
			{
				"allowMultiplePropertiesPerLine": true
			}
		],
		"object-shorthand": "off",
		"one-var": ["error", "never"],
		"one-var-declaration-per-line": "off",
		"operator-assignment": "off",
		"operator-linebreak": "off",
		"padded-blocks": "off",
		"prefer-arrow-callback": "off",
		"prefer-const": "error",
		"prefer-numeric-literals": "error",
		"prefer-reflect": "off",
		"prefer-rest-params": "error",
		"prefer-spread": "error",
		"prefer-template": "off",
		"quote-props": "off",
		"quotes": ["error", "single"],
		"radix": [
			"error",
			"as-needed"
		],
		"require-jsdoc": "off",
		"rest-spread-spacing": [
			"error",
			"never"
		],
		"semi": ["error", "always"],
		"semi-spacing": "off",
		"sort-imports": "error",
		"sort-keys": "off",
		"sort-vars": "off",
		"space-before-blocks": "error",
		"space-before-function-paren": "off",
		"space-in-parens": [
			"error",
			"never"
		],
		"space-infix-ops": "error",
		"space-unary-ops": [
			"error",
			{
				"nonwords": false,
				"words": false
			}
		],
		"spaced-comment": "off",
		"strict": ["error", "global"],
		"symbol-description": "error",
		"template-curly-spacing": "error",
		"unicode-bom": [
			"error",
			"never"
		],
		"valid-jsdoc": "off",
		"vars-on-top": "off",
		"wrap-regex": "error",
		"yield-star-spacing": "error",
		"yoda": [
			"error",
			"never"
		]
	}
};<|endoftext|>


<commit_before>/**
 * @license
 * Copyright 2019 The FOAM Authors. All Rights Reserved.
 * http://www.apache.org/licenses/LICENSE-2.0
 */

foam.CLASS({
  package: 'foam.comics.v2',
  name: 'DAOBrowserView',
  extends: 'foam.u2.View',
  requires: [
    'foam.comics.SearchMode',
    'foam.u2.ActionView',
    'foam.u2.dialog.Popup',
    'foam.u2.layout.Cols',
    'foam.u2.layout.Rows',
    'foam.u2.search.Toolbar',
    'foam.u2.view.ScrollTableView',
    'foam.u2.view.TabChoiceView',
    'foam.comics.v2.DAOControllerConfig'
  ],

  documentation: `
    A scrolling table view customized for the inline DAOController
    with canned queries and a searchbar
  `,

  css: `
    ^export {
      margin-left: 16px;
    }

    ^export img {
      margin-right: 0;
    }

    ^top-bar {
      border-bottom: solid 1px #e7eaec;
      align-items: center;
    }

    ^query-bar {
      padding: 24px 16px;
      align-items: center;
      justify-content: flex-end;
    }

    ^toolbar {
      flex-grow: 1;
    }

    ^browse-view-container {
      margin: auto;
      border-bottom: solid 1px #e7eaec;
      margin: 0px 0px 72px 0px;
      box-sizing: border-box;
    }

    ^canned-queries {
      padding: 0 16px;
    }

    /*
      TODO: Don't manually target these classes like this.
     */
    ^ .foam-u2-view-ScrollTableView-table {
      width: 100%;
    }

    ^ .foam-u2-view-ScrollTableView-scrollbarContainer {
      height: 424px;
    }

    ^ .foam-u2-view-TableView th {
      background: #ffffff
    }

    ^ .foam-u2-view-TableView td {
      padding-left: 16px;
    }

    ^ .foam-u2-view-SimpleSearch {
      flex-grow: 1;
    }

    ^ .foam-u2-view-SimpleSearch .foam-u2-search-TextSearchView .foam-u2-tag-Input {
      width: 100%;
    }
  `,

  imports: [
    'stack?'
  ],
  exports: [
    'dblclick',
    'filteredTableColumns',
    'config.dao as dao',
    'config.searchColumns as searchColumns'
  ],
  properties: [
    {
      class: 'StringArray',
      name: 'filteredTableColumns'
    },
    {
      class: 'foam.dao.DAOProperty',
      name: 'data'
    },
    {
      class: 'FObjectProperty',
      of: 'foam.comics.v2.DAOControllerConfig',
      name: 'config',
      factory: function() {
        return this.DAOControllerConfig.create({ dao: this.data });
      }
    },
    {
      name: 'cls',
      expression: function(config) {
        return config.cls_;
      }
    },
    {
      class: 'foam.mlang.predicate.PredicateProperty',
      name: 'cannedPredicate',
      expression: function(config$cannedQueries) {
        return config$cannedQueries && config$cannedQueries.length
          ? config$cannedQueries[0].predicate
          : foam.mlang.predicate.True.create();
      }
    },
    {
      class: 'foam.mlang.predicate.PredicateProperty',
      name: 'predicates',
      expression: function(config$cannedQueries) {
        return config$cannedQueries && config$cannedQueries.length
          ? config$cannedQueries[0].predicate
          : foam.mlang.predicate.True.create();
      }
    },
    {
      class: 'foam.dao.DAOProperty',
      name: 'predicatedDAO',
      expression: function(config, predicates) {
        return config.dao$proxy.where(predicates);
      }
    }
  ],
  actions: [
    {
      name: 'export',
      label: '',
      icon: 'images/export-arrow-icon.svg',
      code: function() {
        this.add(this.Popup.create().tag({
          class: 'foam.u2.ExportModal',
          exportData: this.predicatedDAO$proxy
        }));
      }
    }
  ],
  methods: [
    function dblclick(obj) {
      if ( ! this.stack ) return;
      this.stack.push({
        class: 'foam.comics.v2.DAOSummaryView',
        data: obj,
        config: this.config,
        of: this.config.of
      });
    },
    function initE() {
      var self = this;
      this.addClass(this.myClass());
      this.SUPER();
      this
        .add(this.slot(function(data, config$cannedQueries, config$defaultColumns) {
          return self.E()
            .start(self.Rows)
              .callIf(config$cannedQueries.length >= 1, function() {
                this
                  .start(self.Cols)
                    .addClass(self.myClass('top-bar'))
                    .start(self.Cols)
                      .callIf(config$cannedQueries.length > 1, function() {
                        this
                          .start(self.TabChoiceView, {
                            choices: config$cannedQueries.map(o => [o.predicate, o.label]),
                            data$: self.predicates$
                          })
                            .addClass(self.myClass('canned-queries'))
                          .end();
                      })
                    .end()
                  .end();
              })
              .start(self.Cols).addClass(self.myClass('query-bar'))
                .startContext({ data: self.config })
                  .callIf(self.config.searchMode === self.SearchMode.SIMPLE, function() {
                    // Clears predicate when returning to view
                    self.config.predicate = undefined;
                    this
                      .add(self.config.cls_.PREDICATE.clone().copyFrom({
                        view: { class: 'foam.u2.view.SimpleSearch', showCount: false }
                      }));
                  })
                .endContext()
                .startContext({data: self})
                  .start(self.EXPORT, {
                    buttonStyle: foam.u2.ButtonStyle.SECONDARY
                  })
                    .addClass(self.myClass('export'))
                  .end()
                .endContext()
              .end()
              .start(self.ScrollTableView, {
                data: self.predicatedDAO$proxy,
                enableDynamicTableHeight: false,
                columns: config$defaultColumns
              })
                .addClass(self.myClass('browse-view-container'))
              .end()
            .end();
        }));
    }
  ]
});
<commit_msg>Fix up binding to predicates.<commit_after>/**
 * @license
 * Copyright 2019 The FOAM Authors. All Rights Reserved.
 * http://www.apache.org/licenses/LICENSE-2.0
 */

foam.CLASS({
  package: 'foam.comics.v2',
  name: 'DAOBrowserView',
  extends: 'foam.u2.View',
  requires: [
    'foam.comics.SearchMode',
    'foam.comics.v2.DAOControllerConfig',
    'foam.u2.ActionView',
    'foam.u2.dialog.Popup',
    'foam.u2.layout.Cols',
    'foam.u2.layout.Rows',
    'foam.u2.search.Toolbar',
    'foam.u2.view.ScrollTableView',
    'foam.u2.view.SimpleSearch',
    'foam.u2.view.TabChoiceView',
  ],

  implements: [
    'foam.mlang.Expressions'
  ],

  documentation: `
    A scrolling table view customized for the inline DAOController
    with canned queries and a searchbar
  `,

  css: `
    ^export {
      margin-left: 16px;
    }

    ^export img {
      margin-right: 0;
    }

    ^top-bar {
      border-bottom: solid 1px #e7eaec;
      align-items: center;
    }

    ^query-bar {
      padding: 24px 16px;
      align-items: center;
      justify-content: flex-end;
    }

    ^toolbar {
      flex-grow: 1;
    }

    ^browse-view-container {
      margin: auto;
      border-bottom: solid 1px #e7eaec;
      margin: 0px 0px 72px 0px;
      box-sizing: border-box;
    }

    ^canned-queries {
      padding: 0 16px;
    }

    /*
      TODO: Don't manually target these classes like this.
     */
    ^ .foam-u2-view-ScrollTableView-table {
      width: 100%;
    }

    ^ .foam-u2-view-ScrollTableView-scrollbarContainer {
      height: 424px;
    }

    ^ .foam-u2-view-TableView th {
      background: #ffffff
    }

    ^ .foam-u2-view-TableView td {
      padding-left: 16px;
    }

    ^ .foam-u2-view-SimpleSearch {
      flex-grow: 1;
    }

    ^ .foam-u2-view-SimpleSearch .foam-u2-search-TextSearchView .foam-u2-tag-Input {
      width: 100%;
    }
  `,

  imports: [
    'stack?'
  ],
  exports: [
    'dblclick',
    'filteredTableColumns',
    'config.dao as dao',
    'config.searchColumns as searchColumns'
  ],
  properties: [
    {
      class: 'StringArray',
      name: 'filteredTableColumns'
    },
    {
      class: 'foam.dao.DAOProperty',
      name: 'data'
    },
    {
      class: 'FObjectProperty',
      of: 'foam.comics.v2.DAOControllerConfig',
      name: 'config',
      factory: function() {
        return this.DAOControllerConfig.create({ dao: this.data });
      }
    },
    {
      name: 'cls',
      expression: function(config) {
        return config.cls_;
      }
    },
    {
      class: 'foam.mlang.predicate.PredicateProperty',
      name: 'cannedPredicate',
      expression: function(config$cannedQueries) {
        return config$cannedQueries && config$cannedQueries.length
          ? config$cannedQueries[0].predicate
          : foam.mlang.predicate.True.create();
      }
    },
    {
      class: 'foam.mlang.predicate.PredicateProperty',
      name: 'searchPredicate',
      expression: function() {
        return foam.mlang.predicate.True.create();
      }
    },
    {
      class: 'foam.dao.DAOProperty',
      name: 'predicatedDAO',
      expression: function(config, cannedPredicate, searchPredicate) {
        return config.dao$proxy.where(this.AND(cannedPredicate, searchPredicate));
      }
    }
  ],
  actions: [
    {
      name: 'export',
      label: '',
      icon: 'images/export-arrow-icon.svg',
      code: function() {
        this.add(this.Popup.create().tag({
          class: 'foam.u2.ExportModal',
          exportData: this.predicatedDAO$proxy
        }));
      }
    }
  ],
  methods: [
    function dblclick(obj) {
      if ( ! this.stack ) return;
      this.stack.push({
        class: 'foam.comics.v2.DAOSummaryView',
        data: obj,
        config: this.config,
        of: this.config.of
      });
    },
    function initE() {
      var self = this;
      this.addClass(this.myClass());
      this.SUPER();
      this
        .add(this.slot(function(data, config$cannedQueries, config$defaultColumns) {
          return self.E()
            .start(self.Rows)
              .callIf(config$cannedQueries.length >= 1, function() {
                this
                  .start(self.Cols)
                    .addClass(self.myClass('top-bar'))
                    .start(self.Cols)
                      .callIf(config$cannedQueries.length > 1, function() {
                        this
                          .start(self.TabChoiceView, {
                            choices: config$cannedQueries.map(o => [o.predicate, o.label]),
                            data$: self.cannedPredicate$
                          })
                            .addClass(self.myClass('canned-queries'))
                          .end();
                      })
                    .end()
                  .end();
              })
              .start(self.Cols).addClass(self.myClass('query-bar'))
                .startContext({
                  data: self.config,
                  controllerMode: foam.u2.ControllerMode.EDIT
                })
                  .callIf(self.config.searchMode === self.SearchMode.SIMPLE, function() {
                    this.tag(self.SimpleSearch, {
                      showCount: false,
                      data$: self.searchPredicate$
                    });
                  })
                .endContext()
                .startContext({data: self})
                  .start(self.EXPORT, {
                    buttonStyle: foam.u2.ButtonStyle.SECONDARY
                  })
                    .addClass(self.myClass('export'))
                  .end()
                .endContext()
              .end()
              .start(self.ScrollTableView, {
                data: self.predicatedDAO$proxy,
                enableDynamicTableHeight: false,
                columns: config$defaultColumns
              })
                .addClass(self.myClass('browse-view-container'))
              .end()
            .end();
        }));
    }
  ]
});
<|endoftext|>


<commit_before>// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the GNU Affero General Public License v3.0.
// See the LICENCE file in the repository root for full licence text.

module.exports = {
  env: {
    es2017: true,
    node: true,
  },
  extends: [
    "eslint:recommended",
  ],
  overrides: [{
    env: {
      browser: true,
      node: false,
    },
    extends: [
      "plugin:@typescript-eslint/recommended",
      "plugin:@typescript-eslint/recommended-requiring-type-checking",
      "plugin:react/recommended",
      "plugin:react-hooks/recommended",
    ],
    files: ["resources/assets/lib/**/*.{js,jsx,ts,tsx}"],
    parser: "@typescript-eslint/parser",
    parserOptions: {
      project: "tsconfig.json",
      sourceType: "module",
    },
    plugins: [
      "eslint-plugin-react",
      "@typescript-eslint",
    ],
    rules: {
      "@typescript-eslint/array-type": [
        "error",
        {
          default: "array",
        },
      ],
      "@typescript-eslint/consistent-type-assertions": "error",
      "@typescript-eslint/consistent-type-definitions": "error",
      "@typescript-eslint/dot-notation": "error",
      "@typescript-eslint/explicit-member-accessibility": [
        "error",
        {
          accessibility: "no-public",
        },
      ],
      "@typescript-eslint/explicit-module-boundary-types": "off",
      "@typescript-eslint/indent": [
        "error",
        2,
        {
          FunctionDeclaration: {
            parameters: "first",
          },
          FunctionExpression: {
            parameters: "first",
          },
          SwitchCase: 1,
        },
      ],
      "@typescript-eslint/member-delimiter-style": [
        "error",
        {
          multiline: {
            delimiter: "semi",
            requireLast: true,
          },
          singleline: {
            delimiter: "semi",
            requireLast: false,
          },
        },
      ],
      "@typescript-eslint/member-ordering": [
        "error",
        {
          default: [
            "public-static-field",
            "protected-static-field",
            "private-static-field",

            "public-instance-field",
            "protected-instance-field",
            "private-instance-field",

            "public-constructor",
            "protected-constructor",
            "private-constructor",

            "public-static-method",
            "protected-static-method",
            "private-static-method",

            "public-instance-method",
            "protected-instance-method",
            "private-instance-method",
          ],
        },
      ],
      "@typescript-eslint/naming-convention": "off",
      "@typescript-eslint/no-explicit-any": "off",
      "@typescript-eslint/no-parameter-properties": "off",
      "@typescript-eslint/no-unsafe-assignment": "warn",
      "@typescript-eslint/no-unsafe-call": "warn",
      "@typescript-eslint/no-unsafe-member-access": "warn",
      "@typescript-eslint/no-unsafe-return": "warn",
      "@typescript-eslint/no-unused-expressions": "error",
      "@typescript-eslint/no-use-before-define": "off",
      "@typescript-eslint/prefer-for-of": "error",
      "@typescript-eslint/prefer-function-type": "error",
      "@typescript-eslint/quotes": [
        "error",
        "single",
        { avoidEscape: true },
      ],
      "@typescript-eslint/restrict-template-expressions": [
        "error",
        {
          allowAny: false,
          allowBoolean: true,
          allowNullish: true,
          allowNumber: true,
        },
      ],
      "@typescript-eslint/semi": [
        "error",
        "always",
      ],
      "@typescript-eslint/type-annotation-spacing": "error",
      "@typescript-eslint/unbound-method": "warn", // TODO: some calls are intentionally unbounded...
      "@typescript-eslint/unified-signatures": "error",
      "no-fallthrough": "off",
      "no-invalid-this": "off",
      "react-hooks/exhaustive-deps": "error",
      "react/jsx-boolean-value": "error",
      "react/jsx-curly-spacing": [
        "error",
        {
          when: "never",
        },
      ],
      "react/jsx-equals-spacing": [
        "error",
        "never",
      ],
      "react/jsx-max-props-per-line": ["error", { when: "multiline" }],
      "react/jsx-no-bind": "error",
      "react/jsx-sort-props": ["error", { reservedFirst: true }],
      "react/jsx-wrap-multilines": "error",
      "react/no-deprecated": "warn",
      "react/no-unsafe": "off",
      "react/self-closing-comp": "error",
    },
    settings: {
      react: {
        version: "detect",
      },
    },
  }],
  parserOptions: {
    sourceType: "module",
  },
  plugins: [
    "eslint-plugin-jsdoc",
    "eslint-plugin-import",
  ],
  rules: {
    "arrow-body-style": "error",
    "arrow-parens": [
      "error",
      "always",
    ],
    "brace-style": [
      "error",
      "1tbs",
    ],
    "comma-dangle": [
      "error",
      "always-multiline",
    ],
    "complexity": "off",
    "curly": [
      "error",
      "multi-line",
    ],
    "eol-last": "error",
    "eqeqeq": [
      "error",
      "smart",
    ],
    "guard-for-in": "error",
    "id-blacklist": [
      "error",
      "any",
      "Number",
      "number",
      "String",
      "string",
      "Boolean",
      "boolean",
      "Undefined",
      "undefined",
    ],
    "id-match": "error",
    "import/order": "error",
    "jsdoc/check-alignment": "error",
    "jsdoc/check-indentation": "error",
    "jsdoc/newline-after-description": "error",
    "max-classes-per-file": [
      "error",
      1,
    ],
    "max-len": "off",
    "new-parens": "error",
    "no-bitwise": "error",
    "no-caller": "error",
    "no-console": "warn",
    "no-eval": "error",
    "no-multiple-empty-lines": "error",
    "no-new-wrappers": "error",
    "no-shadow": [
      "error",
      {
        hoist: "all",
      },
    ],
    "no-throw-literal": "error",
    "no-trailing-spaces": "error",
    "no-undef-init": "error",
    "no-underscore-dangle": "error",
    "no-unsafe-finally": "error",
    "object-shorthand": "error",
    "one-var": [
      "error",
      "never",
    ],
    "quote-props": [
      "error",
      "consistent-as-needed",
    ],
    "radix": "error",
    "sort-keys": "error",
    "space-before-function-paren": [
      "error",
      {
        anonymous: "never",
        asyncArrow: "always",
        named: "never",
      },
    ],
    "spaced-comment": [
      "error",
      "always",
      {
        markers: [
          "/",
        ],
      },
    ],
  },
};
<commit_msg>key sort should be case insensitive<commit_after>// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the GNU Affero General Public License v3.0.
// See the LICENCE file in the repository root for full licence text.

module.exports = {
  env: {
    es2017: true,
    node: true,
  },
  extends: [
    "eslint:recommended",
  ],
  overrides: [{
    env: {
      browser: true,
      node: false,
    },
    extends: [
      "plugin:@typescript-eslint/recommended",
      "plugin:@typescript-eslint/recommended-requiring-type-checking",
      "plugin:react/recommended",
      "plugin:react-hooks/recommended",
    ],
    files: ["resources/assets/lib/**/*.{js,jsx,ts,tsx}"],
    parser: "@typescript-eslint/parser",
    parserOptions: {
      project: "tsconfig.json",
      sourceType: "module",
    },
    plugins: [
      "eslint-plugin-react",
      "@typescript-eslint",
    ],
    rules: {
      "@typescript-eslint/array-type": [
        "error",
        {
          default: "array",
        },
      ],
      "@typescript-eslint/consistent-type-assertions": "error",
      "@typescript-eslint/consistent-type-definitions": "error",
      "@typescript-eslint/dot-notation": "error",
      "@typescript-eslint/explicit-member-accessibility": [
        "error",
        {
          accessibility: "no-public",
        },
      ],
      "@typescript-eslint/explicit-module-boundary-types": "off",
      "@typescript-eslint/indent": [
        "error",
        2,
        {
          FunctionDeclaration: {
            parameters: "first",
          },
          FunctionExpression: {
            parameters: "first",
          },
          SwitchCase: 1,
        },
      ],
      "@typescript-eslint/member-delimiter-style": [
        "error",
        {
          multiline: {
            delimiter: "semi",
            requireLast: true,
          },
          singleline: {
            delimiter: "semi",
            requireLast: false,
          },
        },
      ],
      "@typescript-eslint/member-ordering": [
        "error",
        {
          default: [
            "public-static-field",
            "protected-static-field",
            "private-static-field",

            "public-instance-field",
            "protected-instance-field",
            "private-instance-field",

            "public-constructor",
            "protected-constructor",
            "private-constructor",

            "public-static-method",
            "protected-static-method",
            "private-static-method",

            "public-instance-method",
            "protected-instance-method",
            "private-instance-method",
          ],
        },
      ],
      "@typescript-eslint/naming-convention": "off",
      "@typescript-eslint/no-explicit-any": "off",
      "@typescript-eslint/no-parameter-properties": "off",
      "@typescript-eslint/no-unsafe-assignment": "warn",
      "@typescript-eslint/no-unsafe-call": "warn",
      "@typescript-eslint/no-unsafe-member-access": "warn",
      "@typescript-eslint/no-unsafe-return": "warn",
      "@typescript-eslint/no-unused-expressions": "error",
      "@typescript-eslint/no-use-before-define": "off",
      "@typescript-eslint/prefer-for-of": "error",
      "@typescript-eslint/prefer-function-type": "error",
      "@typescript-eslint/quotes": [
        "error",
        "single",
        { avoidEscape: true },
      ],
      "@typescript-eslint/restrict-template-expressions": [
        "error",
        {
          allowAny: false,
          allowBoolean: true,
          allowNullish: true,
          allowNumber: true,
        },
      ],
      "@typescript-eslint/semi": [
        "error",
        "always",
      ],
      "@typescript-eslint/type-annotation-spacing": "error",
      "@typescript-eslint/unbound-method": "warn", // TODO: some calls are intentionally unbounded...
      "@typescript-eslint/unified-signatures": "error",
      "no-fallthrough": "off",
      "no-invalid-this": "off",
      "react-hooks/exhaustive-deps": "error",
      "react/jsx-boolean-value": "error",
      "react/jsx-curly-spacing": [
        "error",
        {
          when: "never",
        },
      ],
      "react/jsx-equals-spacing": [
        "error",
        "never",
      ],
      "react/jsx-max-props-per-line": ["error", { when: "multiline" }],
      "react/jsx-no-bind": "error",
      "react/jsx-sort-props": ["error", { reservedFirst: true }],
      "react/jsx-wrap-multilines": "error",
      "react/no-deprecated": "warn",
      "react/no-unsafe": "off",
      "react/self-closing-comp": "error",
    },
    settings: {
      react: {
        version: "detect",
      },
    },
  }],
  parserOptions: {
    sourceType: "module",
  },
  plugins: [
    "eslint-plugin-jsdoc",
    "eslint-plugin-import",
  ],
  rules: {
    "arrow-body-style": "error",
    "arrow-parens": [
      "error",
      "always",
    ],
    "brace-style": [
      "error",
      "1tbs",
    ],
    "comma-dangle": [
      "error",
      "always-multiline",
    ],
    "complexity": "off",
    "curly": [
      "error",
      "multi-line",
    ],
    "eol-last": "error",
    "eqeqeq": [
      "error",
      "smart",
    ],
    "guard-for-in": "error",
    "id-blacklist": [
      "error",
      "any",
      "Number",
      "number",
      "String",
      "string",
      "Boolean",
      "boolean",
      "Undefined",
      "undefined",
    ],
    "id-match": "error",
    "import/order": "error",
    "jsdoc/check-alignment": "error",
    "jsdoc/check-indentation": "error",
    "jsdoc/newline-after-description": "error",
    "max-classes-per-file": [
      "error",
      1,
    ],
    "max-len": "off",
    "new-parens": "error",
    "no-bitwise": "error",
    "no-caller": "error",
    "no-console": "warn",
    "no-eval": "error",
    "no-multiple-empty-lines": "error",
    "no-new-wrappers": "error",
    "no-shadow": [
      "error",
      {
        hoist: "all",
      },
    ],
    "no-throw-literal": "error",
    "no-trailing-spaces": "error",
    "no-undef-init": "error",
    "no-underscore-dangle": "error",
    "no-unsafe-finally": "error",
    "object-shorthand": "error",
    "one-var": [
      "error",
      "never",
    ],
    "quote-props": [
      "error",
      "consistent-as-needed",
    ],
    "radix": "error",
    "sort-keys": ["error", "asc", { caseSensitive: false }],
    "space-before-function-paren": [
      "error",
      {
        anonymous: "never",
        asyncArrow: "always",
        named: "never",
      },
    ],
    "spaced-comment": [
      "error",
      "always",
      {
        markers: [
          "/",
        ],
      },
    ],
  },
};
<|endoftext|>


<commit_before>var Promise = require('bluebird');

function warnIfNotInitialized() {
  this.handled = true;
  this.result = null;
  this.error = "resolution function called before promise initialization. Did you inherit from the parent class without calling the super constructor?";
}

/**
 * Represents an event that has occurred on a model.
 *
 * This is an event Emitted by the model, not the emitter itself.
 *
 * @private For use internally in the Model and handlers class only.
 *
 * @param {string} type The event type. "save" (C), "get" (R), "save" (U), or "delete" (D)... Also "purge" and "all"
 * @param {Object} target The event target, either the model class (get/all/purge), or the instance (save/delete)
 * @param {variable} data Any relevant data. Varies from call to call. (E.g. the ID(s) for get events.)
 */
function ModelEvent(type, target, data) {
  this.type = type;
  this.target = target;
  this.data = data;

  var evt = this;
  this.promise = new Promise(function(resolve, reject) {
    /* There's probably a better way to do this... */
    evt._resolve = resolve;
    evt._reject = reject;
  });
}

ModelEvent.prototype = {
  /**
   * The event type, get, save, etc.
   *
   * @member {string} type
   */
  type: null,

  /**
   * The target object: the Class for static methods like get, and the instance for instance methods like save.
   *
   * @member {Object} target
   */
  target: null,

  /**
   * Any data required to process the event, for example the ID in the case of a get.
   *
   * @member data
   */
  data: null,

  /**
   * The event result, if the event handler was successful.
   *
   * @member result
   */
  result: null,

  /**
   * The event error, if the event handler failed.
   *
   * @member result
   */
  error: null,

  /**
   * The promise object, to allow alternate means of handling results/errors.
   *
   * @member {Promise} promise
   */
  promise: null,

  /**
   * Denotes that this event has been handled, either success or failure.
   *
   *  @member {boolean} handled
   */
  handled: false,

  /**
   * A reference to the promise resolver function
   *
   * @private
   * @member {function} _resolve
   */
  _resolve: warnIfNotInitialized,
  /**
   * A reference to the promise rejection function
   *
   * @private
   * @member {function} _reject
   */
  _reject: warnIfNotInitialized,

  /**
   * Mark this event as successful with a given result. (Promise resolved.)
   *
   * @param result
   */
  success: function(result) {
    if (this.handled) return;

    this.handled = true;
    this.result = result;
    this._resolve(result);
  },

  /**
   * Mark this event as a failure with a given error. (Promise rejected.)
   *
   * @param error
   */
  failure: function(error) {
    if (this.handled) return;

    this.handled = true;
    this.error = error;
    this._reject(error);
  }
};

module.exports = ModelEvent;<commit_msg>Add a docblock. No real notable changes.<commit_after>var Promise = require('bluebird');

/**
 * Default behavior for internal _reject and _resolve methods, before Promise is initialized.
 *
 * Causes the event to be a failure.
 */
function warnIfNotInitialized() {
  this.handled = true;
  this.result = null;
  this.error = "resolution function called before promise initialization. Did you inherit from the parent class without calling the super constructor?";
}

/**
 * Represents an event that has occurred on a model.
 *
 * This is an event Emitted by the model, not the emitter itself.
 *
 * @private For use internally in the Model and handlers class only.
 *
 * @param {string} type The event type. "save" (C), "get" (R), "save" (U), or "delete" (D)... Also "purge" and "all"
 * @param {Object} target The event target, either the model class (get/all/purge), or the instance (save/delete)
 * @param {variable} data Any relevant data. Varies from call to call. (E.g. the ID(s) for get events.)
 */
function ModelEvent(type, target, data) {
  this.type = type;
  this.target = target;
  this.data = data;

  var evt = this;
  this.promise = new Promise(function(resolve, reject) {
    /* There's probably a better way to do this... */
    evt._resolve = resolve;
    evt._reject = reject;
  });
}

ModelEvent.prototype = {
  /**
   * The event type, get, save, etc.
   *
   * @member {string} type
   */
  type: null,

  /**
   * The target object: the Class for static methods like get, and the instance for instance methods like save.
   *
   * @member {Object} target
   */
  target: null,

  /**
   * Any data required to process the event, for example the ID in the case of a get.
   *
   * @member data
   */
  data: null,

  /**
   * The event result, if the event handler was successful.
   *
   * @member result
   */
  result: null,

  /**
   * The event error, if the event handler failed.
   *
   * @member result
   */
  error: null,

  /**
   * The promise object, to allow alternate means of handling results/errors.
   *
   * @member {Promise} promise
   */
  promise: null,

  /**
   * Denotes that this event has been handled, either success or failure.
   *
   *  @member {boolean} handled
   */
  handled: false,

  /**
   * A reference to the promise resolver function
   *
   * @private
   * @member {function} _resolve
   */
  _resolve: warnIfNotInitialized,
  /**
   * A reference to the promise rejection function
   *
   * @private
   * @member {function} _reject
   */
  _reject: warnIfNotInitialized,

  /**
   * Mark this event as successful with a given result. (Promise resolved.)
   *
   * @param result
   */
  success: function(result) {
    if (this.handled) return;

    this.handled = true;
    this.result = result;
    this._resolve(result);
  },

  /**
   * Mark this event as a failure with a given error. (Promise rejected.)
   *
   * @param error
   */
  failure: function(error) {
    if (this.handled) return;

    this.handled = true;
    this.error = error;
    this._reject(error);
  }
};

module.exports = ModelEvent;<|endoftext|>


<commit_before>module.exports = {
  "parser": "babel-eslint",
  "env": {
    "browser": true,
    "jest": true,
    "node": true,
    "es6": true
  },
  "extends": ["eslint:recommended", "plugin:react/recommended"],
  "parserOptions": {
    "ecmaFeatures": {
      "experimentalObjectRestSpread": true,
      "jsx": true
    },
    "sourceType": "module"
  },
  "plugins": [
    "react", "flowtype"
  ],
  "settings": {
    "react": {
      "version": "16.6",
      "flowVersion": "0.84"
    }
  },
  "rules": {
    "flowtype/define-flow-type": 1,
    "flowtype/require-valid-file-annotation": ["error", "always"],

    "react/no-unescaped-entities": ["off"],

    "indent": ["error", 2],
    "linebreak-style": ["error", "unix"],
    "quotes": ["error", "single", "avoid-escape"],
    "semi": ["error", "always"],
    "no-var": ["error"],
    "brace-style": ["error"],
    "array-bracket-spacing": ["error", "never"],
    "block-spacing": ["error", "always"],
    "no-spaced-func": ["error"],
    "no-whitespace-before-property": ["error"],
    "space-before-blocks": ["error", "always"],
    "keyword-spacing": ["error"]
  }
};
<commit_msg>Update eslintrc<commit_after>module.exports = {
  "parser": "babel-eslint",
  "env": {
    "browser": true,
    "jest": true,
    "node": true,
    "es6": true
  },
  "extends": ["eslint:recommended", "plugin:react/recommended"],
  "parserOptions": {
    "ecmaFeatures": {
      "experimentalObjectRestSpread": true,
      "jsx": true
    },
    "sourceType": "module"
  },
  "plugins": [
    "react", "flowtype"
  ],
  "settings": {
    "react": {
      "version": "16.6",
      "flowVersion": "0.85"
    }
  },
  "rules": {
    "flowtype/define-flow-type": 1,
    "flowtype/require-valid-file-annotation": ["error", "always"],

    "react/no-unescaped-entities": ["off"],

    "indent": ["error", 2],
    "linebreak-style": ["error", "unix"],
    "quotes": ["error", "single", "avoid-escape"],
    "semi": ["error", "always"],
    "no-var": ["error"],
    "brace-style": ["error"],
    "array-bracket-spacing": ["error", "never"],
    "block-spacing": ["error", "always"],
    "no-spaced-func": ["error"],
    "no-whitespace-before-property": ["error"],
    "space-before-blocks": ["error", "always"],
    "keyword-spacing": ["error"]
  }
};
<|endoftext|>


<commit_before>module.exports = {
  root: true,
  env: {
    es6: true,
    browser: true,
    node: true,
  },
  extends: 'eslint:recommended',
  parser: 'babel-eslint',
  parserOptions: {
    ecmaVersion: 7,
    sourceType: 'module',
    ecmaFeatures: {
      jsx: true,
      experimentalObjectRestSpread: true,
    }
  },
  plugins: [
    'babel',
    'react',
    'mocha',
    'material-ui',
    "import",
    "flowtype"
  ],
  rules: {
    'array-bracket-spacing': ['error', 'never'],
    'arrow-spacing': 'error',
    'arrow-parens': 'error',
    'block-spacing': ['error', 'always'],
    'brace-style': 'error',
    'comma-dangle': ['error', 'always-multiline'],
    'comma-spacing': ['error', {before: false, after: true}],
    'comma-style': ['error', 'last'],
    'computed-property-spacing': ['error', 'never'],
    'consistent-this': ['error', 'self'],
    'consistent-return': 'off',
    'dot-notation': 'error',
    'dot-location': ['error', 'property'],
    'eqeqeq': ['error', 'smart'],
    'eol-last': 'error',
    'indent': ['error', 2, {SwitchCase: 1}],
    'id-blacklist': ['error', 'e'],
    'jsx-quotes': ['error', 'prefer-double'],
    'keyword-spacing': 'error',
    'key-spacing': 'error',
    'max-len': ['error', 120, 4],
    'new-cap': ['off', {capIsNew: true, newIsCap: true}],
    'no-unused-expressions': 'error',
    'no-unused-vars': 'error',
    'no-shadow': 'off',
    'no-spaced-func': 'error',
    'no-multiple-empty-lines': 'error',
    'no-multi-spaces': 'error',
    'no-undef': 'error',
    'no-empty-pattern': 'error',
    'no-dupe-keys': 'error',
    'no-dupe-args': 'error',
    'no-duplicate-case': 'error',
    'no-cond-assign': 'error',
    'no-extra-semi': 'error',
    'no-extra-boolean-cast': 'error',
    'no-trailing-spaces': 'error',
    'no-underscore-dangle': 'error',
    'no-unneeded-ternary': 'error',
    'no-unreachable': 'error',
    'no-var': 'error',
    'one-var': ['error', 'never'],
    'operator-linebreak': ['error', 'after'],
    'padded-blocks': ['error', 'never'],
    'prefer-arrow-callback': 'off',
    'prefer-const': 'error',
    'prefer-template': 'error',
    'quotes': ['error', 'single', 'avoid-escape'],
    'semi': ['error', 'always'],
    'space-before-blocks': ['error', 'always'],
    'space-before-function-paren': ['error', 'never'],
    'space-infix-ops': 'error',
    'space-unary-ops': ['error', { words: true, nonwords: false }],
    'spaced-comment': 'error',
    'yoda': 'error',
    'babel/object-curly-spacing': ['error', 'never'],
    'generator-star-spacing': 'error',
    'babel/no-await-in-loop': 'error',
    'flowtype/object-type-delimiter': 'error',
    'react/display-name': 'error',
    'react/jsx-boolean-value': ['error', 'always'],
    'react/jsx-closing-bracket-location': 'error',
    'react/jsx-curly-spacing': 'error',
    'react/jsx-equals-spacing': 'error',
    'react/jsx-filename-extension': ['error', {extensions: ['.js']}],
    'react/jsx-first-prop-new-line': ['error', 'multiline'],
    'react/jsx-handler-names': 'error',
    'react/jsx-indent': ['error', 2],
    'react/jsx-indent-props': ['error', 2],
    'react/jsx-max-props-per-line': ['error', {maximum: 3}],
    'react/jsx-no-comment-textnodes': 'error',
    'react/jsx-no-duplicate-props': 'error',
    'react/jsx-no-undef': 'error',
    'react/jsx-pascal-case': 'error',
    'react/jsx-space-before-closing': 'error',
    'react/jsx-uses-react': 'error',
    'react/jsx-uses-vars': 'error',
    'react/jsx-wrap-multilines': 'error',
    'react/no-danger': 'error',
    'react/no-deprecated': 'error',
    'react/no-did-mount-set-state': 'error',
    'react/no-did-update-set-state': 'error',
    'react/no-direct-mutation-state': 'error',
    'react/no-multi-comp': 'off',
    'react/no-render-return-value': 'error',
    'react/no-is-mounted': 'error',
    'react/no-unknown-property': 'error',
    'react/prefer-arrow-callback': 'off',
    'react/prefer-es6-class': 'error',
    'react/prop-types': 'error',
    'react/react-in-jsx-scope': 'error',
    'import/extensions': 'error',
    'react/require-render-return': 'error',
    'react/self-closing-comp': 'error',
    'react/sort-comp': 'error',
    'react/sort-prop-types': 'error',
    'material-ui/docgen-ignore-before-comment': 'error',
    'mocha/handle-done-callback': 'error',
    'mocha/no-exclusive-tests': 'error',
    'mocha/no-global-tests': 'error',
    'mocha/no-pending-tests': 'error',
    'mocha/no-skipped-tests': 'error',
    'strict': 'off',
    'no-case-declarations': 'off',
    'react/jsx-key': 'off',
    'react/jsx-no-bind': 'off',
    'react/jsx-no-literals': 'off',
    'react/jsx-no-target-blank': 'off',
    'react/jsx-sort-props': 'off',
    'react/no-set-state': 'off',
    'react/no-string-refs': 'warn',
    'react/forbid-prop-types': 'off',
    'react/prefer-stateless-function': 'off',
    'react/require-optimization': 'off',
    'mocha/no-synchronous-tests': 'off',
    'mocha/valid-suite-description': 'off',
    'mocha/valid-test-description': 'off',
    'babel/object-shorthand': 'off',
    'babel/new-cap': 'off',
  },
};
<commit_msg>update eslint rules<commit_after>module.exports = {
  root: true,
  env: {
    es6: true,
    browser: true,
    node: true,
  },
  extends: 'eslint:recommended',
  parser: 'babel-eslint',
  parserOptions: {
    ecmaVersion: 7,
    sourceType: 'module',
    ecmaFeatures: {
      jsx: true,
      experimentalObjectRestSpread: true,
    }
  },
  plugins: [
    'babel',
    'react',
    'mocha',
    'material-ui',
    "import",
    "flowtype"
  ],
  rules: {
    'array-bracket-spacing': ['error', 'never'],
    'arrow-spacing': 'error',
    'arrow-parens': 'error',
    'block-spacing': ['error', 'always'],
    'comma-dangle': ['error', 'always-multiline'],
    'comma-spacing': ['error', {before: false, after: true}],
    'comma-style': ['error', 'last'],
    'computed-property-spacing': ['error', 'never'],
    'consistent-this': ['error', 'self'],
    'consistent-return': 'off',
    'dot-notation': 'error',
    'dot-location': ['error', 'property'],
    'eqeqeq': ['error', 'smart'],
    'eol-last': 'error',
    'indent': ['error', 2, {SwitchCase: 1}],
    'jsx-quotes': ['error', 'prefer-double'],
    'keyword-spacing': 'error',
    'key-spacing': 'error',
    'max-len': ['error', 120, 4],
    'new-cap': ['off', {capIsNew: true, newIsCap: true}],
    'no-unused-expressions': 'error',
    'no-unused-vars': 'error',
    'no-shadow': 'off',
    'no-spaced-func': 'error',
    'no-multiple-empty-lines': 'error',
    'no-multi-spaces': 'error',
    'no-undef': 'error',
    'no-empty-pattern': 'error',
    'no-dupe-keys': 'error',
    'no-dupe-args': 'error',
    'no-duplicate-case': 'error',
    'no-cond-assign': 'error',
    'no-extra-semi': 'error',
    'no-extra-boolean-cast': 'error',
    'no-trailing-spaces': 'error',
    'no-underscore-dangle': 'error',
    'no-unneeded-ternary': 'error',
    'no-unreachable': 'error',
    'no-var': 'error',
    'one-var': ['error', 'never'],
    'operator-linebreak': ['error', 'after'],
    'padded-blocks': ['error', 'never'],
    'prefer-arrow-callback': 'off',
    'prefer-const': 'error',
    'prefer-template': 'error',
    'quotes': ['error', 'single', 'avoid-escape'],
    'semi': ['error', 'always'],
    'space-before-blocks': ['error', 'always'],
    'space-before-function-paren': ['error', 'never'],
    'space-infix-ops': 'error',
    'space-unary-ops': ['error', { words: true, nonwords: false }],
    'spaced-comment': 'error',
    'yoda': 'error',
    'generator-star-spacing': 'error',
    'babel/no-await-in-loop': 'error',
    'flowtype/object-type-delimiter': 'error',
    'react/display-name': 'error',
    'react/jsx-closing-bracket-location': 'error',
    'react/jsx-curly-spacing': 'error',
    'react/jsx-equals-spacing': 'error',
    'react/jsx-filename-extension': ['error', {extensions: ['.js']}],
    'react/jsx-first-prop-new-line': ['error', 'multiline'],
    'react/jsx-indent': ['error', 2],
    'react/jsx-indent-props': ['error', 2],
    'react/jsx-max-props-per-line': ['error', {maximum: 4}],
    'react/jsx-no-comment-textnodes': 'error',
    'react/jsx-no-duplicate-props': 'error',
    'react/jsx-no-undef': 'error',
    'react/jsx-pascal-case': 'error',
    'react/jsx-space-before-closing': 'error',
    'react/jsx-uses-react': 'error',
    'react/jsx-uses-vars': 'error',
    'react/jsx-wrap-multilines': 'error',
    'react/no-danger': 'error',
    'react/no-deprecated': 'error',
    'react/no-did-mount-set-state': 'error',
    'react/no-did-update-set-state': 'error',
    'react/no-direct-mutation-state': 'error',
    'react/no-multi-comp': 'off',
    'react/no-render-return-value': 'error',
    'react/no-is-mounted': 'error',
    'react/no-unknown-property': 'error',
    'react/prefer-arrow-callback': 'off',
    'react/prefer-es6-class': 'error',
    'react/prop-types': 'error',
    'react/react-in-jsx-scope': 'error',
    'import/extensions': 'error',
    'react/require-render-return': 'error',
    'react/self-closing-comp': 'error',
    'react/sort-comp': 'error',
    'material-ui/docgen-ignore-before-comment': 'error',
    'mocha/handle-done-callback': 'error',
    'mocha/no-exclusive-tests': 'error',
    'mocha/no-global-tests': 'error',
    'mocha/no-pending-tests': 'error',
    'mocha/no-skipped-tests': 'error',
    'strict': 'off',
    'no-case-declarations': 'off',
    'react/jsx-key': 'off',
    'react/jsx-no-bind': 'off',
    'react/jsx-no-literals': 'off',
    'react/jsx-no-target-blank': 'off',
    'react/jsx-sort-props': 'off',
    'react/no-set-state': 'off',
    'react/no-string-refs': 'warn',
    'react/forbid-prop-types': 'off',
    'react/prefer-stateless-function': 'off',
    'react/require-optimization': 'off',
    'mocha/no-synchronous-tests': 'off',
    'mocha/valid-suite-description': 'off',
    'mocha/valid-test-description': 'off',
    'babel/object-shorthand': 'off',
    'babel/new-cap': 'off',
  },
};
<|endoftext|>


<commit_before>module.exports = {
    "env": {
        "browser": true,
        "es6": true
    },
    "extends": "eslint:recommended",
    "rules": {
        "no-undef": 0,
        "indent": 2,
        "linebreak-style": [ "error", "unix" ],
        "semi": [ "error", "always" ],
        "no-console": 0,
        "react/jsx-uses-react": "error",
        "react/jsx-uses-vars": "error",

        "no-unused-vars": 0
    },
    "plugins": [
        "react"
    ],
    "parserOptions": {
        "sourceType": "module",
        "ecmaFeatures": {
            "jsx": true
        }
    }
};
<commit_msg>update eslintrc to be compat with cc (#11)<commit_after>module.exports = {
    "env": {
        "browser": true,
        "es6": true
    },
    "extends": "eslint:recommended",
    "rules": {
        "no-undef": 0,
        "indent": 2,
        "semi": 2,
        "no-console": 0,
        "react/jsx-uses-react": 2,
        "react/jsx-uses-vars": 2,
        "no-unused-vars": 0
    },
    "plugins": [
        "react"
    ],
    "parserOptions": {
        "sourceType": "module",
        "ecmaFeatures": {
            "jsx": true
        }
    }
};
<|endoftext|>


<commit_before>module.exports = {
  extends: 'airbnb-base',
  env: {
    'node': true,
  },
  root: true,
  rules: {
    'comma-dangle': ['error', 'always-multiline'],
    'import/order': ['error', {
      'groups': ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'],
    }],
    'indent': ['error', 2, {'SwitchCase': 1}],
    'max-len': ['error', 120, 4, {'ignoreComments': true, 'ignoreUrls': true}],
    'no-unused-vars': ['error', {'vars': 'all', 'args': 'none'}],
    'space-before-function-paren': ['error', 'never'],
    'space-in-parens': ['error', 'never'],
    'no-underscore-dangle': 'off',
    'no-param-reassign': 'off',
    'no-console': 'off',
    'no-warning-comments': ['warn', { 'terms': ['fixme'], 'location': 'start' }],

    // NOTE: Disabled to not do too many changes to original codebase:
    'consistent-return': 'off',
    'arrow-body-style': 'off',
    'object-curly-spacing': 'off',
    'padded-blocks': 'off',
    'arrow-parens': 'off',
    'import/extensions': 'off',
    'no-shadow': 'off',
    'array-callback-return': 'off',
    'no-else-return': 'off',
  }
}
<commit_msg>Turn off eslint indent rule because of prettier<commit_after>module.exports = {
  extends: 'airbnb-base',
  env: {
    'node': true,
  },
  root: true,
  rules: {
    'comma-dangle': ['error', 'always-multiline'],
    'import/order': ['error', {
      'groups': ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'],
    }],
    'indent': ['off', 2, {'SwitchCase': 1}],
    'max-len': ['error', 120, 4, {'ignoreComments': true, 'ignoreUrls': true}],
    'no-unused-vars': ['error', {'vars': 'all', 'args': 'none'}],
    'space-before-function-paren': ['error', 'never'],
    'space-in-parens': ['error', 'never'],
    'no-underscore-dangle': 'off',
    'no-param-reassign': 'off',
    'no-console': 'off',
    'no-warning-comments': ['warn', { 'terms': ['fixme'], 'location': 'start' }],

    // NOTE: Disabled to not do too many changes to original codebase:
    'consistent-return': 'off',
    'arrow-body-style': 'off',
    'object-curly-spacing': 'off',
    'padded-blocks': 'off',
    'arrow-parens': 'off',
    'import/extensions': 'off',
    'no-shadow': 'off',
    'array-callback-return': 'off',
    'no-else-return': 'off',
  }
}
<|endoftext|>


<commit_before>module.exports = {
  root: true,
  parserOptions: {
    ecmaVersion: 6,
  },
  extends: 'eslint:recommended',
  env: {
    browser: false,
    node: true,
  },
  globals: {
  },
  rules: {
    /*** Possible Errors ***/

    'no-console': 0,
    'no-template-curly-in-string': 2,
    'no-unsafe-negation': 2,

    /*** Best Practices ***/

    'curly': 2,
    'eqeqeq': 2,
    'guard-for-in': 0,
    'no-caller': 2,
    'no-eq-null': 2,
    'no-eval': 2,
    'no-multi-spaces': [2, {
      'exceptions': {
        'ObjectExpression': true,
        'Property': true,
      },
    }],
    'no-new': 0,
    'no-unused-expressions': [2, {
      allowShortCircuit: true,
      allowTernary: true,
    }],
    'wrap-iife': 0,
    'yoda': 2,

    /*** Strict Mode ***/

    'strict': [2, 'global'],

    /*** Variables ***/

    'no-undef': 2,
    'no-unused-vars': 2,
    'no-use-before-define': [2, 'nofunc'],

    /*** Stylistic Issues ***/

    'array-bracket-spacing': 2,
    'block-spacing': 2,
    'brace-style': [2, '1tbs', {
      'allowSingleLine': true,
    }],
    'camelcase': 2,
    'comma-dangle': [2, 'always-multiline'],
    'comma-spacing': 2,
    'comma-style': 2,
    'eol-last': 2,
    'func-call-spacing': 2,
    'indent': [2, 2, {
      'SwitchCase': 1,
      'VariableDeclarator': { 'var': 2, 'let': 2, 'const': 3 }
    }],
    'key-spacing': 2,
    'keyword-spacing': 2,
    'linebreak-style': [2, 'unix'],
    'new-cap': [2, {
      properties: false,
    }],
    'new-parens': 2,
    'no-array-constructor': 2,
    'no-bitwise': 2,
    'no-lonely-if': 2,
    'no-mixed-operators': 2,
    'no-plusplus': 0,
    'no-trailing-spaces': 2,
    'no-unneeded-ternary': 2,
    'no-whitespace-before-property': 2,
    'object-curly-spacing': [2, 'always'],
    'semi-spacing': 2,
    'semi': 2,
    'space-before-blocks': 2,
    'space-before-function-paren': [2, 'never'],
    'space-in-parens': 2,
    'space-infix-ops': 2,
    'space-unary-ops': 2,
    'quotes': [2, 'single'],
    'semi': [2, 'always'],
    'wrap-regex': 2,

    /*** ECMAScript 6 ***/

    'arrow-body-style': 2,
    'arrow-parens': [2, 'as-needed'],
    'arrow-spacing': 2,
    'no-confusing-arrow': [2, {
      'allowParens': true,
    }],
  },
};
<commit_msg>ESLint: Enable "no-useless-computed-key" rule<commit_after>module.exports = {
  root: true,
  parserOptions: {
    ecmaVersion: 6,
  },
  extends: 'eslint:recommended',
  env: {
    browser: false,
    node: true,
  },
  globals: {
  },
  rules: {
    /*** Possible Errors ***/

    'no-console': 0,
    'no-template-curly-in-string': 2,
    'no-unsafe-negation': 2,

    /*** Best Practices ***/

    'curly': 2,
    'eqeqeq': 2,
    'guard-for-in': 0,
    'no-caller': 2,
    'no-eq-null': 2,
    'no-eval': 2,
    'no-multi-spaces': [2, {
      'exceptions': {
        'ObjectExpression': true,
        'Property': true,
      },
    }],
    'no-new': 0,
    'no-unused-expressions': [2, {
      allowShortCircuit: true,
      allowTernary: true,
    }],
    'wrap-iife': 0,
    'yoda': 2,

    /*** Strict Mode ***/

    'strict': [2, 'global'],

    /*** Variables ***/

    'no-undef': 2,
    'no-unused-vars': 2,
    'no-use-before-define': [2, 'nofunc'],

    /*** Stylistic Issues ***/

    'array-bracket-spacing': 2,
    'block-spacing': 2,
    'brace-style': [2, '1tbs', {
      'allowSingleLine': true,
    }],
    'camelcase': 2,
    'comma-dangle': [2, 'always-multiline'],
    'comma-spacing': 2,
    'comma-style': 2,
    'eol-last': 2,
    'func-call-spacing': 2,
    'indent': [2, 2, {
      'SwitchCase': 1,
      'VariableDeclarator': { 'var': 2, 'let': 2, 'const': 3 }
    }],
    'key-spacing': 2,
    'keyword-spacing': 2,
    'linebreak-style': [2, 'unix'],
    'new-cap': [2, {
      properties: false,
    }],
    'new-parens': 2,
    'no-array-constructor': 2,
    'no-bitwise': 2,
    'no-lonely-if': 2,
    'no-mixed-operators': 2,
    'no-plusplus': 0,
    'no-trailing-spaces': 2,
    'no-unneeded-ternary': 2,
    'no-whitespace-before-property': 2,
    'object-curly-spacing': [2, 'always'],
    'semi-spacing': 2,
    'semi': 2,
    'space-before-blocks': 2,
    'space-before-function-paren': [2, 'never'],
    'space-in-parens': 2,
    'space-infix-ops': 2,
    'space-unary-ops': 2,
    'quotes': [2, 'single'],
    'semi': [2, 'always'],
    'wrap-regex': 2,

    /*** ECMAScript 6 ***/

    'arrow-body-style': 2,
    'arrow-parens': [2, 'as-needed'],
    'arrow-spacing': 2,
    'no-confusing-arrow': [2, {
      'allowParens': true,
    }],
    'no-useless-computed-key': 2,
  },
};
<|endoftext|>