Move to 2 space indentation + editorconfig

This commit is contained in:
Josh Johnson 2016-09-05 22:04:15 +01:00
parent 9bb9e0b4c2
commit d40841d8dd
11 changed files with 2659 additions and 2645 deletions

9
.editorconfig Normal file
View file

@ -0,0 +1,9 @@
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true

View file

@ -10,7 +10,7 @@
"rules": { "rules": {
"quotes": [2, "single"], "quotes": [2, "single"],
"strict": [2, "never"], "strict": [2, "never"],
"indent": ["error", 4, {"SwitchCase": 1}], "indent": ["error", 2, {"SwitchCase": 1}],
"eol-last": "off", "eol-last": "off",
"arrow-body-style": "off", "arrow-body-style": "off",
"no-underscore-dangle": "off", "no-underscore-dangle": "off",

View file

@ -9,7 +9,8 @@ import {
activateChoices, activateChoices,
addGroup, addGroup,
clearAll, clearAll,
} from './actions/index'; }
from './actions/index';
import { import {
isScrolledIntoView, isScrolledIntoView,
getAdjacentEl, getAdjacentEl,
@ -21,14 +22,16 @@ import {
getWidthOfInput, getWidthOfInput,
sortByAlpha, sortByAlpha,
sortByScore, sortByScore,
} from './lib/utils.js'; }
from './lib/utils.js';
import './lib/polyfills.js'; import './lib/polyfills.js';
/** /**
* Choices * Choices
*/ */
export default class Choices { export
default class Choices {
constructor(element = '[data-choice]', userConfig = {}) { constructor(element = '[data-choice]', userConfig = {}) {
// If there are multiple elements, create a new instance // If there are multiple elements, create a new instance
// for each element besides the first one (as that already has an instance) // for each element besides the first one (as that already has an instance)
@ -808,7 +811,9 @@ export default class Choices {
this._removeItem(lastItem); this._removeItem(lastItem);
this._triggerChange(lastItem.value); this._triggerChange(lastItem.value);
} else { } else {
if (!hasHighlightedItems) { this.highlightItem(lastItem); } if (!hasHighlightedItems) {
this.highlightItem(lastItem);
}
this.removeHighlightedItems(); this.removeHighlightedItems();
} }
} }
@ -2045,7 +2050,9 @@ export default class Choices {
this._highlightChoice(); this._highlightChoice();
} else { } else {
// Otherwise show a notice // Otherwise show a notice
const dropdownItem = this.isSearching ? this._getTemplate('notice', this.config.noResultsText) : this._getTemplate('notice', this.config.noChoicesText); const dropdownItem = this.isSearching ?
this._getTemplate('notice', this.config.noResultsText) :
this._getTemplate('notice', this.config.noChoicesText);
this.choiceList.appendChild(dropdownItem); this.choiceList.appendChild(dropdownItem);
} }
} }

View file

@ -1,5 +1,4 @@
/* eslint-disable */ /* eslint-disable */
// Production steps of ECMA-262, Edition 6, 22.1.2.1 // Production steps of ECMA-262, Edition 6, 22.1.2.1
// Reference: https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.from // Reference: https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.from
if (!Array.from) { if (!Array.from) {

View file

@ -1,5 +1,4 @@
/* eslint-disable */ /* eslint-disable */
/** /**
* Capitalises the first letter of each word in a string * Capitalises the first letter of each word in a string
* @param {String} str String to capitalise * @param {String} str String to capitalise

View file

@ -4,8 +4,8 @@ import rootReducer from './../reducers/index.js';
export default class Store { export default class Store {
constructor() { constructor() {
this.store = createStore( this.store = createStore(
rootReducer, rootReducer
window.devToolsExtension ? window.devToolsExtension() : undefined , window.devToolsExtension ? window.devToolsExtension() : undefined
); );
} }