1
0
Fork 0
mirror of https://github.com/TryGhost/Ghost-Admin.git synced 2023-12-14 02:33:04 +01:00

Merge pull request #36 from kevinansfield/linting

Add Gruntfile.js, setup linting task and Travis build
This commit is contained in:
Hannah Wolfe 2016-06-02 17:32:44 +01:00
commit 4fe39fb2da
5 changed files with 90 additions and 4 deletions

View file

@ -6,8 +6,7 @@
"-Promise",
"-Notification",
"validator",
"moment",
"fileUpload"
"moment"
],
"browser": true,
"boss": true,

View file

@ -5,6 +5,11 @@ language: node_js
node_js:
- "0.10"
matrix:
include:
- node_js: "0.10"
env: TEST_SUITE=lint
cache:
directories:
- node_modules
@ -30,4 +35,4 @@ before_script:
- export DISPLAY=:99; sh -e /etc/init.d/xvfb start; sleep 3;
script:
- npm test
- if [ "$TEST_SUITE" == "lint" ]; then grunt lint; else npm test; fi

75
Gruntfile.js Normal file
View file

@ -0,0 +1,75 @@
/* global module, require, process */
/* jscs:disable */
var path = require('path'),
escapeChar = process.platform.match(/^win/) ? '^' : '\\',
cwd = process.cwd().replace(/( |\(|\))/g, escapeChar + '$1');
module.exports = function(grunt) {
// Find all of the task which start with `grunt-` and load them, rather than explicitly declaring them all
require('matchdep').filterDev(['grunt-*', '!grunt-cli']).forEach(grunt.loadNpmTasks);
grunt.initConfig({
jshint: {
options: {
jshintrc: true,
ignores: [
'node_modules/**',
'bower_components/**',
'tmp/**',
'dist/**',
'vendor/**'
]
},
all: ['**/*.js']
},
jscs: {
app: {
options: {
config: '.jscsrc',
excludeFiles: [
'node_modules/**',
'bower_components/**',
'tests/**',
'tmp/**',
'dist/**',
'vendor/**'
]
},
files: {
src: ['**/*.js']
}
},
tests: {
options: {
config: 'tests/.jscsrc'
},
files: {
src: [
'tests/**/*.js'
]
}
}
},
shell: {
csscombfix: {
command: path.resolve(cwd + '/node_modules/.bin/csscomb -c app/styles/csscomb.json -v app/styles')
},
csscomblint: {
command: path.resolve(cwd + '/node_modules/.bin/csscomb -c app/styles/csscomb.json -lv app/styles')
}
}
});
grunt.registerTask('lint', 'Run the code style checks and linter',
['jshint', 'jscs', 'shell:csscomblint']
);
};

View file

@ -20,6 +20,7 @@
"license": "MIT",
"devDependencies": {
"broccoli-asset-rev": "2.4.2",
"csscomb": "3.1.8",
"ember-ajax": "0.7.1",
"ember-cli": "2.5.1",
"ember-cli-app-version": "1.0.0",
@ -58,9 +59,14 @@
"emberx-file-input": "1.0.0",
"fs-extra": "0.30.0",
"glob": "^7.0.3",
"grunt": "1.0.1",
"grunt-contrib-jshint": "1.0.0",
"grunt-jscs": "2.8.0",
"grunt-shell": "1.3.0",
"liquid-fire": "0.23.1",
"liquid-tether": "1.1.1",
"loader.js": "4.0.7",
"matchdep": "1.0.1",
"walk-sync": "^0.2.6"
},
"ember-addon": {

View file

@ -26,7 +26,8 @@
"currentURL",
"currentPath",
"currentRouteName",
"expect"
"expect",
"fileUpload"
],
"mocha": true,
"node": false,