“Follow the style already present in the file”, said in CONTRIBUTING.md, but there are some inconsistencies in existing code.
For example we could omit curly brackets and commas in object literals in CoffeeScript, and so you
do omit them:
@keyToCommandRegistry[key] =
command: command
isBackgroundCommand: @availableCommands[command].isBackgroundCommand
passCountToFunction: @availableCommands[command].passCountToFunction
noRepeat: @availableCommands[command].noRepeat
…some times.
rect = {
top: imgClientRects[0].top + coords[1],
left: imgClientRects[0].left + coords[0],
right: imgClientRects[0].left + coords[2],
bottom: imgClientRects[0].top + coords[3],
width: coords[2] - coords[0],
height: coords[3] - coords[1]
}
Also we could omit parentheses when calling a function with a few arguments, and so you
do that:
chrome.tabs.query {}, (tabs) =>
results = tabs.filter (tab) -> RankingUtils.matches(queryTerms, tab.url, tab.title)
…some times.
chrome.tabs.query({ windowId: chrome.windows.WINDOW_ID_CURRENT, active: true },
(tabs) -> updateActiveState(tabs[0].id))
That's of course not such a big deal (as long as it works), but anyway what code style should I follow if I want to make a few pull requests more? :)
Or, maybe, there is some reason to write it so, that I missed?