A repo to document code standards for different languages and provide tools for linting Mobify projects.
Typically we lint our javascript files using Grunt. We have two javascript linters with different features. jshint and jscs.
To add javascript linting to your project:
- Install the NPM
mobify-code-style
,grunt-contrib-jshint
, andgrunt-contrib-jscs
modules. - Create a Gruntfile if you don't have one already.
- In the initConfig of your gruntfile, add sections for jshint and/or jscs pointing to the correct linting file.
Sample jshint config:
jshint:{
dev: {
src: ['src/**/*.js'],
options: {
// The task fails if force is set to false. With true, it shows the
// linting errors, but continues
force: false,
jshintrc: 'node_modules/mobify-code-style/javascript/.jshintrc'
}
}
}
Sample jscs config:
jscs: {
options: {
config: 'node_modules/mobify-code-style/javascript/.jscsrc'
},
src: ['src/**/*.js']
}
Our Client Services team's CSS Style Guide. Written with a lot of tender care by @kpeatt and @jeffkamo.