Skip to content

Commit

Permalink
Merge pull request Yoast#74 from Yoast/stories/at/codestyle
Browse files Browse the repository at this point in the history
Fix jshint & jscs codestyle
  • Loading branch information
omarreiss committed Aug 11, 2015
2 parents cbc62f1 + baa1813 commit 8a18324
Show file tree
Hide file tree
Showing 24 changed files with 1,120 additions and 876 deletions.
4 changes: 2 additions & 2 deletions .gruntjshintrc
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
"latedef": true,
"newcap": true,
"noarg": true,
"quotmark": "single",
"quotmark": "double",
"sub": true,
"strict": true,
"undef": true,
"unused": true,

"node": true
}
}
2 changes: 1 addition & 1 deletion .jscsrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"preset": "jquery"
}
}
3 changes: 1 addition & 2 deletions .jshintrc
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@
"sub": true,
"strict": false,

"undef": false,
"undef": true,
"unused": true,
"funcscope": false,
"browser": true,
"jquery": false,

"globals": {
Expand Down
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ cache:
- node_modules

before_script:
- npm install -g grunt-cli
- npm install

script:
- npm test
- grunt check

notifications:
slack:
secure: W3StABr+AdcdQawTObK4nbsnn5nLrTTtZfVpD/GEN6gvSOQcykbGEC5+ceYg0jn5b4StDyCiTo5blEsrpVICFpYKc44+ogah+qaGRUfVRS/rpOvn4AueXTWn4JxhZzuxqKMiTmyW+MQG0uYM7sk7Q5S+15jj6ilkj4QATaBVNbY=
secure: W3StABr+AdcdQawTObK4nbsnn5nLrTTtZfVpD/GEN6gvSOQcykbGEC5+ceYg0jn5b4StDyCiTo5blEsrpVICFpYKc44+ogah+qaGRUfVRS/rpOvn4AueXTWn4JxhZzuxqKMiTmyW+MQG0uYM7sk7Q5S+15jj6ilkj4QATaBVNbY=
60 changes: 29 additions & 31 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,36 +1,34 @@
module.exports = function(grunt) {
'use strict';
module.exports = function( grunt ) {
"use strict";

//require('time-grunt')(grunt);
//require('time-grunt')(grunt);

// Define project configuration
var project = {
paths: {
grunt: 'grunt/',
js: 'js/',
css: 'css/',
// Define project configuration
var project = {
paths: {
grunt: "grunt/",
js: "js/",
css: "css/",
get config() {
return this.grunt + 'config/';
return this.grunt + "config/";
}
},
files: {
js: [
'js/*.js',
'!js/*.min.js',
'spec/*.js',
'!spec/*.min.js'
],
get config() {
return project.paths.config + '*.js';
},
grunt: 'Gruntfile.js'
},
pkg: grunt.file.readJSON( 'package.json' )
};
},
files: {
js: [
"js/*.js",
"!js/*.min.js"
],
get config() {
return project.paths.config + "*.js";
},
grunt: "Gruntfile.js"
},
pkg: grunt.file.readJSON( "package.json" )
};

// Load Grunt configurations and tasks
require( 'load-grunt-config' )(grunt, {
configPath: require( 'path' ).join( process.cwd(), project.paths.config ),
data: project
});
};
// Load Grunt configurations and tasks
require( "load-grunt-config" )( grunt, {
configPath: require( "path" ).join( process.cwd(), project.paths.config ),
data: project
} );
};
1 change: 1 addition & 0 deletions grunt/config/aliases.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ check:
- 'jshint'
- 'jsonlint'
- 'jsvalidate'
- 'jscs'
# Default task
default:
- check
Expand Down
4 changes: 2 additions & 2 deletions grunt/config/clean.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = {
'build': ['js/dist/*.min.js', '!<%= paths.js %>/dist/yoast-seo-content-analysis.min.js']
};
"build": [ "js/dist/*.min.js", "!<%= paths.js %>/dist/yoast-seo-content-analysis.min.js" ]
};
4 changes: 1 addition & 3 deletions grunt/config/cssmin.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
module.exports = {
target: {
files: {
'<%= paths.css %>dist/yoast-seo-content-analysis.min.css': ['<%= paths.css %>*.css']
"<%= paths.css %>dist/yoast-seo-content-analysis.min.css": [ "<%= paths.css %>*.css" ]
}
}
};


18 changes: 11 additions & 7 deletions grunt/config/jscs.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,28 @@
// https://github.com/jscs-dev/grunt-jscs
module.exports = {
options: {
config: '.jscsrc'
config: ".jscsrc"
},
plugin: {
options: {

// We already have non camel case variables names that we cannot change easily
requireCamelCaseOrUpperCaseIdentifiers: null
},
files: {
src: [
'js/analyzer.js'
]
src: "<%= files.js %>"
}
},
grunt: {
options: {

// We have no control over task names that use underscores
requireCamelCaseOrUpperCaseIdentifiers: 'ignoreProperties'
requireCamelCaseOrUpperCaseIdentifiers: "ignoreProperties"
},
files: {
src: [
'<%= files.grunt %>',
'<%= files.config %>'
"<%= files.grunt %>",
"<%= files.config %>"
]
}
}
Expand Down
10 changes: 5 additions & 5 deletions grunt/config/jshint.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
module.exports = {
plugin: {
options: {
jshintrc: '.jshintrc'
jshintrc: ".jshintrc"
},
src: '<%= files.js %>'
src: "<%= files.js %>"
},
grunt: {
options: {
jshintrc: '.gruntjshintrc'
jshintrc: ".gruntjshintrc"
},
src: [
'<%= files.grunt %>',
'<%= files.config %>'
"<%= files.grunt %>",
"<%= files.config %>"
]
}
};
10 changes: 5 additions & 5 deletions grunt/config/jsonlint.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
module.exports = {
all: {
src: [
'.gruntjshintrc',
'.jscsrc',
'.jshintrc',
'composer.json',
'package.json'
".gruntjshintrc",
".jscsrc",
".jshintrc",
"composer.json",
"package.json"
]
}
};
6 changes: 3 additions & 3 deletions grunt/config/jsvalidate.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ module.exports = {
},
plugin: {
files: {
src: 'js/analyzer.js'
src: "js/analyzer.js"
}
},
grunt: {
files: {
src: [
'<%= files.grunt %>',
'<%= files.config %>'
"<%= files.grunt %>",
"<%= files.config %>"
]
}
}
Expand Down
8 changes: 4 additions & 4 deletions grunt/config/po2json.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
module.exports = {
all: {
options: {
format: 'jed1.x',
domain: 'js-text-analysis'
format: "jed1.x",
domain: "js-text-analysis"
},
src: [ 'languages/*.po' ],
dest: 'languages'
src: [ "languages/*.po" ],
dest: "languages"
}
};
30 changes: 16 additions & 14 deletions grunt/config/shell.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
// https://github.com/sindresorhus/grunt-shell
module.exports = function(grunt) {
module.exports = function( grunt ) {
"use strict";

return {
makepot: {
potFile: 'languages/js-text-analysis.pot',
textdomain: 'js-text-analysis',
command: function () {
potFile: "languages/js-text-analysis.pot",
textdomain: "js-text-analysis",
command: function() {
var files;

files = ['js/*.js', 'js/config/*.js'];
files = grunt.file.expand(files);
files = [ "js/*.js", "js/config/*.js" ];
files = grunt.file.expand( files );

return 'xgettext ' +
'--default-domain=<%= shell.makepot.textdomain %>' +
' -o <%= shell.makepot.potFile %>' +
' --package-version=<%= pkg.version %> --package-name=<%= pkg.name %>' +
' --force-po' +
' --from-code=UTF-8' +
' --add-comments="translators: "' +
' ' + files.join( ' ' );
return "xgettext" +
" --default-domain=<%= shell.makepot.textdomain %>" +
" -o <%= shell.makepot.potFile %>" +
" --package-version=<%= pkg.version %> --package-name=<%= pkg.name %>" +
" --force-po" +
" --from-code=UTF-8" +
" --add-comments=\"translators: \"" +
" " + files.join( " " );
}
}
};
Expand Down
14 changes: 9 additions & 5 deletions grunt/config/uglify.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
// https://github.com/gruntjs/grunt-contrib-uglify
module.exports = {
'js-text-analysis': {
"js-text-analysis": {
options: {
preserveComments: 'some',
report: 'gzip'
preserveComments: "some",
report: "gzip"
},
files: {
'<%= paths.js %>/dist/yoast-seo-content-analysis.min.js': ['<%= paths.js %>/*.js', '<%= paths.js %>/config/*.js'],
'<%= paths.js %>/dist/yoast-seo-content-analyzer.min.js': ['<%= paths.js %>/analyzer.js', '<%= paths.js %>/config/scoring.js']
"<%= paths.js %>/dist/yoast-seo-content-analysis.min.js": [
"<%= paths.js %>/*.js", "<%= paths.js %>/config/*.js"
],
"<%= paths.js %>/dist/yoast-seo-content-analyzer.min.js": [
"<%= paths.js %>/analyzer.js", "<%= paths.js %>/config/scoring.js"
]
}
}
};
Expand Down
Loading

0 comments on commit 8a18324

Please sign in to comment.