Add jshint with ignore list

Lets travis do the work

exclude vendor

Fix js hint errors

Add refactor note
This commit is contained in:
Steffen Lindner 2015-04-29 17:17:36 +02:00 коммит произвёл Thomas Müller
Родитель c05297ddd6
Коммит e0c237e591
6 изменённых файлов: 60 добавлений и 7 удалений

10
.jshintignore Normal file
Просмотреть файл

@ -0,0 +1,10 @@
node_modules
l10n
vendor
/* Static 3rd party */
js/jquery.storageapi.js
js/backbone.js
js/jquery.autosize.js
js/jquery-visibility.js
js/handlebars-v1.3.0.js
js/backbone.marionette.js

Просмотреть файл

@ -1,5 +1,5 @@
{
"camelcase": true,
"camelcase": false,
"eqeqeq": true,
"immed": true,
"latedef": false,
@ -22,7 +22,6 @@
"describe": true,
"beforeEach": true,
"afterEach": true,
"sinon": true,
"fakeServer": true,
"_": true,
"OC": true,

Просмотреть файл

@ -25,16 +25,23 @@ before_install:
- bash ./before_install.sh mail $CORE_BRANCH $DB
- cd ../core
- php occ app:enable mail
- npm install -g npm@latest
before_script:
- cd apps/mail
- npm install --deps
script:
# Test lint
- cd apps/mail
- find . -name \*.php -not -path './vendor/*' -exec php -l "{}" \;
# Run phpunit tests
- cd tests
- phpunit --configuration phpunit.xml
# Test jshint
- npm test
# Create coverage report
- sh -c "if [ '$TRAVIS_PHP_VERSION' != 'hhvm' ]; then wget https://scrutinizer-ci.com/ocular.phar; fi"
- sh -c "if [ '$TRAVIS_PHP_VERSION' != 'hhvm' ]; then php ocular.phar code-coverage:upload --format=php-clover clover.xml; fi"

Просмотреть файл

@ -24,6 +24,10 @@ var Mail = {
$('#searchresults').hide();
}
},
/*jshint maxparams: 6 */
/* Todo: Refactor if you are touching
https://jslinterrors.com/this-function-has-too-many-parameters
*/
BackGround: {
showNotification: function (title, body, tag, icon, accountId, folderId) {
// notifications not supported -> go away
@ -85,7 +89,8 @@ var Mail = {
// If it's okay let's create a notification
var tag = 'not-' + f.accountId + '-' + f.name;
var icon = OC.filePath('mail', 'img', 'mail-notification.png');
Mail.BackGround.showNotification(localAccount.get('email'), body, tag, icon, f.accountId, f.id);
Mail.BackGround.showNotification(localAccount.get('email'), body, tag, icon,
f.accountId, f.id);
}
// update folder status
var localFolder = folders.get(f.id);

Просмотреть файл

@ -1,4 +1,4 @@
/* global Backbone, Mail, models */
/* global Backbone, Mail, models, oc_defaults */
var views = views || {};
@ -93,9 +93,11 @@ views.Folders = Backbone.Marionette.CollectionView.extend({
var unread = activeFolder.get('unseen');
if ( unread > 0) {
window.document.title = activeFolder.get('name') + ' (' + unread + ') - ' + activeAccount.get('email') + ' - Mail - ' + oc_defaults.title;
window.document.title = activeFolder.get('name') + ' (' + unread + ') - ' +
activeAccount.get('email') + ' - Mail - ' + oc_defaults.title;
} else {
window.document.title = activeFolder.get('name') + ' - ' + activeAccount.get('email') + ' - Mail - ' + oc_defaults.title;
window.document.title = activeFolder.get('name') + ' - ' + activeAccount.get('email') +
' - Mail - ' + oc_defaults.title;
}
}

30
package.json Normal file
Просмотреть файл

@ -0,0 +1,30 @@
{
"name": "mail",
"version": "0.0.1",
"description": "Mail app for ownCloud",
"main": "index.js",
"directories": {
"test": "tests"
},
"scripts": {
"test": "./node_modules/.bin/jshint . && ./node_modules/.bin/jsxhint ."
},
"repository": {
"type": "git",
"url": "https://github.com/owncloud/mail.git"
},
"keywords": [
"ownCloud",
"mail"
],
"author": "Thomas Müller and others",
"license": "AGPL",
"bugs": {
"url": "https://github.com/owncloud/mail/issues"
},
"homepage": "https://github.com/owncloud/mail",
"devDependencies": {
"jshint": "^2.7.0",
"jsxhint": "^0.14.0"
}
}