Commit ffc29b78 authored by Eric Eastwood's avatar Eric Eastwood

Update formatting indent to 2 spaces.

Comply to Gitter code style.
parent 22381e3f
{
"env": {
"browser": 1,
"es6": true,
"amd": true,
"node": true
},
"ecmaFeatures": {
"arrowFunctions": true,
"blockBindings": true,
"classes": true,
"defaultParams": true,
"destructuring": true,
"forOf": true,
"generators": true,
"modules": true,
"objectLiteralComputedProperties": true,
"objectLiteralShorthandMethods": true,
"objectLiteralShorthandProperties": true,
"spread": true,
"templateStrings": true,
"unicodeCodePointEscapes": true,
"jsx": true
},
"plugins": [
"react"
],
"rules": {
//
//Possible Errors
//
"comma-dangle": 2, // disallow or enforce trailing commas
"no-dupe-args": 2, // disallow duplicate arguments in functions
"no-dupe-keys": 2, // disallow duplicate keys when creating object literals
"no-extra-semi": 2, // disallow unnecessary semicolons
"no-invalid-regexp": 2, // disallow invalid regular expression strings in the RegExp constructor
"no-regex-spaces": 2, // disallow multiple spaces in a regular expression literal
// Best Practices
//
"complexity": [1, 4],
"max-depth": [2, 3],
"no-extra-bind": 1, // disallow unnecessary function binding
"default-case": 2, // require default case in switch statements (off by default)
"dot-notation": 2, // encourages use of dot notation whenever possible
"eqeqeq": 2, // require the use of === and !==
"no-alert": 2, // disallow the use of alert, confirm, and prompt
"no-eval": 2, // disallow use of eval()
"no-implied-eval": 2, // disallow use of eval()-like methods
"no-loop-func": 1, // disallow creation of functions within loops
"no-redeclare": 2, // disallow declaring the same variable more then once
"no-return-assign": 2, // disallow use of assignment in return statement
"no-sequences": 2, // disallow use of comma operator
"no-with": 2, // disallow use of the with statement
"radix": 2, // require use of the second argument for parseInt() (off by default)
"wrap-iife": [2, "inside"], // require immediate function invocation to be wrapped in parentheses (off by default)
"yoda": 2, // require or disallow Yoda conditions
// Variables
//
"no-delete-var": 2, // disallow deletion of variables
"no-undef": 2, // disallow use of undeclared variables unless mentioned in a /*global */ block
// Style
//
"camelcase": 1,
"indent": [1, 2],
"comma-spacing": [1, {"before": false, "after": true}], // enforce spacing before and after comma
"comma-style": [1, "last"],
"consistent-this": [1, "self"], // enforces consistent naming when capturing the current execution context (off by default)
"eol-last": 1, // enforce newline at the end of file, with no multiple empty lines
"key-spacing": [1, {"beforeColon": false, "afterColon": true}], // enforces spacing between keys and values in object literal properties
"new-parens": 1, // disallow the omission of parentheses when invoking a constructor with no arguments
"no-lonely-if": 1, // disallow if as the only statement in an else block (off by default)
"no-nested-ternary": 1, // disallow nested ternary expressions (off by default)
"no-spaced-func": 1, // disallow space between function identifier and application
"no-trailing-spaces": [1, { skipBlankLines: true }], // disallow trailing whitespace at the end of lines
"no-underscore-dangle": 1, // disallow dangling underscores in identifiers
"operator-assignment": [2, "always"],
"operator-linebreak": [2, "after"],
"quote-props": [1, "as-needed"], // require quotes around object literal property names (off by default)
"quotes": [2, "single"],
"semi": [1, "always"], // require or disallow use of semicolons instead of ASI
"semi-spacing": [2, {"before": false, "after": true}],
"space-infix-ops": 1, // require spaces around operators
"space-return-throw-case": 1, // require a space after return, throw, and case
"space-unary-ops": [1, {"words": true, "nonwords": false}], // Require or disallow spaces before/after unary operators (words on by default, nonwords off by default)
"wrap-regex": 2,
"react/jsx-boolean-value": 1,
"react/jsx-no-undef": 1,
"react/jsx-quotes": [2, "double", "avoid-escape"], // Enforce quote style for JSX attributes
"react/jsx-uses-react": 1,
"react/jsx-uses-vars": 1,
"react/no-did-mount-set-state": 1,
"react/no-did-update-set-state": 1,
"react/no-multi-comp": 1,
"react/no-unknown-property": 1,
"react/prop-types": 1,
"react/react-in-jsx-scope": 1,
"react/self-closing-comp": 1,
"react/wrap-multilines": 1
}
}
\ No newline at end of file
......@@ -31,7 +31,7 @@ Set options with the global window option:
</script>
```
*TODO (not implemented yet):* You can also override these options individually on the container:
You can also override these options individually on the container:
```html
<div
......@@ -47,6 +47,7 @@ Set options with the global window option:
- Default: Elements that match `'.gitter-chat-embed'`
- `options.showChatByDefault`: Whether to embed the chat on page load(true) or wait until the `options.activation` is resolved/clicked/interacted with(false).
- Default: `true`
- Note: **Use with caution,** useful for use cases where you have a page dedicated to chat.
- `options.activation`: If `options.showChatByDefault` is `false`, this is the element you have to click/interact with to get the chat to actually embed. You can also pass in a promise which can optionally resolve to a dom node
- Default: `null`
- `options.useStyles`: Whether to embed some pre-made CSS styles to the page
......
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -6,7 +6,7 @@
"scripts": {
"gulp": "babel-node gulpfile.js",
"build-standalone": "webpack",
"build-standalone-dev": "webpack --watch"
"build-standalone-dev": "webpack --watch --progress"
},
"author": "",
"license": "ISC",
......
......@@ -2,24 +2,24 @@
let $ = document.querySelectorAll.bind(document);
Node.prototype.on = window.on = function(names, fn) {
names.split(/\s/).forEach(function(name) {
this.addEventListener(name, fn);
}.bind(this));
names.split(/\s/).forEach(function(name) {
this.addEventListener(name, fn);
}.bind(this));
// Keep the chaining going
return this;
// Keep the chaining going
return this;
};
HTMLCollection.prototype.__proto__ = Array.prototype;
NodeList.prototype.__proto__ = Array.prototype;
NodeList.prototype.on = NodeList.prototype.addEventListener = function(name, fn) {
this.forEach(function(elem, i) {
elem.on(name, fn);
});
this.forEach(function(elem) {
elem.on(name, fn);
});
// Keep the chaining going
return this;
// Keep the chaining going
return this;
};
......
This diff is collapsed.
import objectAssign from 'object-assign';
let remove = function() {
this.parentElement.removeChild(this);
this.parentElement.removeChild(this);
};
// An array-like storage container for DOM elements
class ElementStore extends Array {
constructor(...elements) {
// The array constructor doesn't assign the items to `this`
// because can't be shimmed for built-in types
super(...elements);
objectAssign(this, elements || {});
}
// Because Array.prototype.concat isn't generic : http://www.2ality.com/2012/02/concat-not-generic.html
concat(...args) {
return new ElementStore(...(args.reduce((result, item) => {
// If array-like
if(item.length && !Array.isArray(item)) {
item = Array.prototype.slice.call(item);
}
return result.concat(item);
}, [])));
}
get length() {
// We start at `-1` to cancel out the `+1` at the end if there are no items in the array-like
return Object.keys(this).reduce((prevIndex, key) => {
return Math.max(parseInt(key, 10), prevIndex);
}, -1) + 1;
}
set length(newLength) {
const currentLength = this.length;
for(let i = newLength; i < currentLength; i++) {
delete this[i];
}
}
createElement(...args) {
//console.log('create', args[0]);
let element = document.createElement.apply(document, args);
this.push(element);
return element;
}
destroy() {
this.forEach((element, index) => {
remove(element);
this.splice(index, 1);
});
}
constructor(...elements) {
// The array constructor doesn't assign the items to `this`
// because can't be shimmed for built-in types
super(...elements);
objectAssign(this, elements || {});
}
// Because Array.prototype.concat isn't generic : http://www.2ality.com/2012/02/concat-not-generic.html
concat(...args) {
return new ElementStore(...(args.reduce((result, item) => {
// If array-like
if(item.length && !Array.isArray(item)) {
item = Array.prototype.slice.call(item);
}
return result.concat(item);
}, [])));
}
get length() {
// We start at `-1` to cancel out the `+1` at the end if there are no items in the array-like
return Object.keys(this).reduce((prevIndex, key) => {
return Math.max(parseInt(key, 10), prevIndex);
}, -1) + 1;
}
set length(newLength) {
const currentLength = this.length;
for(let i = newLength; i < currentLength; i++) {
delete this[i];
}
}
createElement(...args) {
//console.log('create', args[0]);
let element = document.createElement.apply(document, args);
this.push(element);
return element;
}
destroy() {
this.forEach((element, index) => {
remove(element);
this.splice(index, 1);
});
}
}
......
......@@ -9,7 +9,7 @@ module.exports = {
output: {
path: path.join(__dirname, 'dist'),
filename: 'sidecar.js',
library: 'sidecare',
library: 'sidecar',
libraryTarget: 'umd'
},
devtool: 'source-map',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment