Skip to content

Instantly share code, notes, and snippets.

@sarfata
Created January 13, 2014 02:50
Show Gist options
  • Save sarfata/8393981 to your computer and use it in GitHub Desktop.
Save sarfata/8393981 to your computer and use it in GitHub Desktop.
A sample [JSHint](http://www.jshint.com) configuration file for Pebble development and a modified `wscript` build file to call jshint on every build.
/*
* Example jshint configuration file for Pebble development.
*
* Read: http://developer.getpebble.com/blog/2014/01/12/Using-JSHint-For-Pebble-Development/
* And check out the full documentation at http://www.jshint.com/docs/options/
*/
{
// Declares the existence of a global 'Pebble' object
"globals": { "Pebble" : true },
// And standard objects (XMLHttpRequest and console)
"browser": true,
"devel": true,
// Do not mess with standard JavaScript objects (Array, Date, etc)
"freeze": true,
// Do not use eval! Keep this warning turned on (ie: false)
"evil": false,
/*
* The options below are more style/developer dependent.
* Customize to your liking.
*/
// All variables should be in camelcase
"camelcase": true,
// Do not allow blocks without { }
"curly": true,
// Prohibits the use of immediate function invocations without wrapping them in parentheses
"immed": true,
// Enforce indentation
"indent": true,
// Do not use a variable before it's defined
"latedef": "nofunc",
// Spot undefined variables
"undef": "true",
// Spot unused variables
"unused": "true"
}
#
# This is a wscript file to build a Pebble project and call jshint
# on every builds. This helps detect typos and bugs in JavaScript code.
#
# See: http://developer.getpebble.com/blog/2014/01/12/Using-JSHint-For-Pebble-Development/
from sh import jshint
top = '.'
out = 'build'
def options(ctx):
ctx.load('pebble_sdk')
def configure(ctx):
ctx.load('pebble_sdk')
jshint.bake(['--config', 'pebble-jshintrc'])
def build(ctx):
ctx.load('pebble_sdk')
jshint("src/js/pebble-js-app.js")
ctx.pbl_program(source=ctx.path.ant_glob('src/**/*.c'),
target='pebble-app.elf')
ctx.pbl_bundle(elf='pebble-app.elf',
js=ctx.path.ant_glob('src/js/**/*.js'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment