Skip to content

Commit

Permalink
Add jscs
Browse files Browse the repository at this point in the history
  • Loading branch information
vsn4ik committed Sep 20, 2015
1 parent f484c09 commit 6d16184
Show file tree
Hide file tree
Showing 11 changed files with 76 additions and 25 deletions.
13 changes: 6 additions & 7 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# Export-ignore files for composer (with --prefer-dist)
.gitattributes export-ignore
.gitignore export-ignore
.travis.yml export-ignore
Gruntfile.js export-ignore
README.md export-ignore
bower.json export-ignore
package.json export-ignore
# Dont add bower.json, otherwise it is not loaded in the Bower package
docs export-ignore
.* export-ignore
Gruntfile.js export-ignore
README.md export-ignore
package.json export-ignore
13 changes: 12 additions & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,16 @@ module.exports = function(grunt) {
src: 'docs/assets/js/'
}
},
jscs: {
options: {
config: 'js/.jscsrc'
},
core: 'js/',
grunt: 'Gruntfile.js',
docs: {
src: 'docs/assets/js/'
}
},
uglify: {
core: {
expand: true,
Expand Down Expand Up @@ -143,7 +153,7 @@ module.exports = function(grunt) {
cwd: 'docs',
src: 'index.html',
dest: '_gh_pages/'
},
}
},
compress: {
dist: {
Expand All @@ -168,6 +178,7 @@ module.exports = function(grunt) {
'less',
'cssmin',
'jshint',
'jscs',
'copy:core',
'uglify',
'usebanner'
Expand Down
4 changes: 1 addition & 3 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@
],
"ignore": [
"docs",
".gitattributes",
".gitignore",
".travis.yml",
"/.*",
"Gruntfile.js",
"README.md",
"_config.yml",
Expand Down
2 changes: 1 addition & 1 deletion dist/css/bootstrap-submenu.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/css/bootstrap-submenu.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions dist/js/bootstrap-submenu.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Bootstrap-submenu v2.0.0 (http://vsn4ik.github.io/bootstrap-submenu)
* Bootstrap-submenu v2.0.1 (http://vsn4ik.github.io/bootstrap-submenu)
* Copyright 2015 Vasily A. (https://github.com/vsn4ik)
* Licensed under the MIT license
*/
Expand Down Expand Up @@ -122,7 +122,7 @@
Submenupicker.prototype = {
init: function() {
this.$menu.off('keydown.bs.dropdown.data-api');
this.$menu.on('keydown', $.proxy(this, 'item_keydown'));
this.$menu.on('keydown', $.proxy(this, 'itemKeydown'));

this.$menu.find('li > a').each(function() {
new Item(this);
Expand All @@ -137,7 +137,7 @@
hidden: function() {
this.$items.trigger('hide.bs.submenu');
},
item_keydown: function(event) {
itemKeydown: function(event) {
// 38: Arrow up, 40: Arrow down

if ($.inArray(event.keyCode, [38, 40]) != -1) {
Expand Down
4 changes: 2 additions & 2 deletions dist/js/bootstrap-submenu.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions docs/assets/js/docs.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// jscs:disable requireCamelCaseOrUpperCaseIdentifiers

'use strict';

$(function() {
Expand Down
42 changes: 42 additions & 0 deletions js/.jscsrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"esnext": true,
"disallowEmptyBlocks": true,
"disallowKeywords": ["with"],
"disallowMixedSpacesAndTabs": true,
"disallowMultipleLineStrings": true,
"disallowMultipleVarDecl": true,
"disallowQuotedKeysInObjects": "allButReserved",
"disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-", "~", "!"],
"disallowSpaceBeforeBinaryOperators": [","],
"disallowSpaceBeforePostfixUnaryOperators": ["++", "--"],
"disallowSpacesInFunctionDeclaration": { "beforeOpeningRoundBrace": true },
"disallowSpacesInNamedFunctionExpression": { "beforeOpeningRoundBrace": true },
"disallowSpacesInsideArrayBrackets": true,
"disallowSpacesInsideParentheses": true,
"disallowTrailingComma": true,
"disallowTrailingWhitespace": true,
"requireCamelCaseOrUpperCaseIdentifiers": true,
"requireCapitalizedConstructors": true,
"requireCommaBeforeLineBreak": true,
"requireDollarBeforejQueryAssignment": true,
"requireDotNotation": true,
"requireLineFeedAtFileEnd": true,
"requirePaddingNewLinesAfterUseStrict": true,
"requirePaddingNewLinesBeforeExport": true,
"requireSpaceAfterBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!==", ">", "<", ">=", "<="],
"requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch"],
"requireSpaceAfterLineComment": true,
"requireSpaceBeforeBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!==", ">", "<", ">=", "<="],
"requireSpaceBetweenArguments": true,
"requireSpacesInAnonymousFunctionExpression": { "beforeOpeningCurlyBrace": true },
"requireSpacesInConditionalExpression": true,
"requireSpacesInForStatement": true,
"requireSpacesInFunctionDeclaration": { "beforeOpeningCurlyBrace": true },
"requireSpacesInFunctionExpression": { "beforeOpeningCurlyBrace": true },
"requireSpacesInNamedFunctionExpression": { "beforeOpeningCurlyBrace": true },
"requireSpacesInsideObjectBrackets": "allButNested",
"validateAlignedFunctionParameters": true,
"validateIndentation": 2,
"validateLineBreaks": "LF",
"validateQuoteMarks": "'"
}
4 changes: 2 additions & 2 deletions js/bootstrap-submenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
Submenupicker.prototype = {
init: function() {
this.$menu.off('keydown.bs.dropdown.data-api');
this.$menu.on('keydown', $.proxy(this, 'item_keydown'));
this.$menu.on('keydown', $.proxy(this, 'itemKeydown'));

this.$menu.find('li > a').each(function() {
new Item(this);
Expand All @@ -131,7 +131,7 @@
hidden: function() {
this.$items.trigger('hide.bs.submenu');
},
item_keydown: function(event) {
itemKeydown: function(event) {
// 38: Arrow up, 40: Arrow down

if ($.inArray(event.keyCode, [38, 40]) != -1) {
Expand Down
9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bootstrap-submenu",
"version": "2.0.0",
"version": "2.0.1",
"description": "Bootstrap Sub-Menus",
"keywords": [
"bootstrap",
Expand All @@ -17,7 +17,7 @@
"license": "MIT",
"files": [
"dist",
"js",
"js/**/*.js",
"less",
"LICENSE"
],
Expand All @@ -37,6 +37,7 @@
"grunt-contrib-less": "~1.0.1",
"grunt-contrib-uglify": "~0.9.2",
"grunt-ejs": "~0.3.0",
"grunt-jscs": "~1.8.0",
"highlight.js": "~8.8.0",
"jquery": "~2.1.4",
"load-grunt-tasks": "~3.2.0",
Expand All @@ -49,9 +50,7 @@
"main": "dist/js/bootstrap-submenu.js",
"ignore": [
"docs",
".gitattributes",
".gitignore",
".travis.yml",
".*",
"Gruntfile.js",
"README.md",
"_config.yml",
Expand Down

0 comments on commit 6d16184

Please sign in to comment.