Skip to content

Commit

Permalink
set up some linting (obvious errors only)
Browse files Browse the repository at this point in the history
  • Loading branch information
rlidwka committed Mar 28, 2015
1 parent 2ee12c7 commit 9047e28
Show file tree
Hide file tree
Showing 31 changed files with 111 additions and 361 deletions.
275 changes: 0 additions & 275 deletions .eslint.yaml

This file was deleted.

2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
lib/static
44 changes: 44 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# vim: syntax=yaml

#
# List of very light restrictions designed to prevent obvious errors,
# not impose our own code style upon other contributors.
#
# This is supposed to be used with `eslint --reset`
#
# Created to work with [email protected]
#

env:
node: true

rules:
# useful to have in node.js,
# if you're sure you don't need to handle error, rename it to "_err"
handle-callback-err: 2

# just to make sure we don't forget to remove them when releasing
no-debugger: 2

# add "falls through" for those
no-fallthrough: 2

# just warnings about whitespace weirdness here
eol-last: 1
no-irregular-whitespace: 1
no-mixed-spaces-and-tabs: [1, smart-tabs]
no-trailing-spaces: 1

# probably always an error, tell me if it's not
no-new-require: 2

# single most important rule here, without it linting won't even
# make any sense
no-undef: 2

# in practice, those are always errors
no-unreachable: 2

# useful for code clean-up
no-unused-vars: [1, {"vars": "all", "args": "none"}]

8 changes: 8 additions & 0 deletions lib/GUI/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

env:
node: true
browser: true

globals:
jQuery: true

3 changes: 0 additions & 3 deletions lib/GUI/js/search.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
var $ = require('unopinionate').selector
var template = require('../entry.hbs')
var onScroll = require('onscroll')

$(function() {
;(function(window, document) {
var $form = $('#search-form')
var $input = $form.find('input')
var $body = $('body')
var $clear = $form.find('.clear')
var $searchResults = $('#search-results')
var $pkgListing = $('#all-packages')
var $searchBtn = $('.js-search-btn')
Expand Down
8 changes: 3 additions & 5 deletions lib/auth.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
var assert = require('assert')
var Crypto = require('crypto')
var jju = require('jju')
var Error = require('http-errors')
var Path = require('path')
var Logger = require('./logger')

module.exports = Auth
Expand Down Expand Up @@ -183,7 +181,7 @@ Auth.prototype.bearer_middleware = function() {
var self = this
return function(req, res, _next) {
req.pause()
function next(err) {
function next(_err) {
req.resume()
return _next.apply(null, arguments)
}
Expand Down Expand Up @@ -222,7 +220,7 @@ Auth.prototype.cookie_middleware = function() {
var self = this
return function(req, res, _next) {
req.pause()
function next(err) {
function next(_err) {
req.resume()
return _next()
}
Expand Down Expand Up @@ -321,7 +319,7 @@ Auth.prototype.aes_decrypt = function(buf) {
function AnonymousUser() {
return {
name: undefined,
// groups without '$' are going to be deprecated eventually
// groups without '$' are going to be deprecated eventually
groups: [ '$all', '$anonymous', '@all', '@anonymous', 'all', 'undefined', 'anonymous' ],
real_groups: [],
}
Expand Down
2 changes: 1 addition & 1 deletion lib/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ if (commander.args.length != 0) {
commander.help()
}

var config, config_path, have_question
var config, config_path
try {
if (commander.config) {
config_path = Path.resolve(commander.config)
Expand Down
1 change: 0 additions & 1 deletion lib/index-web.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ var Cookies = require('cookies')
var express = require('express')
var fs = require('fs')
var Handlebars = require('handlebars')
var Error = require('http-errors')
var renderReadme = require('render-readme')
var Search = require('./search')
var Middleware = require('./middleware')
Expand Down
Loading

0 comments on commit 9047e28

Please sign in to comment.