Add pre-commit hook for standard linter

This commit is contained in:
Christoph Diehl 2018-01-22 22:30:40 +01:00
parent ab97313acb
commit 94938bda28
3 changed files with 84 additions and 52 deletions

View File

@ -1,4 +1,4 @@
module.exports = function(grunt) { module.exports = function (grunt) {
let pkg = grunt.file.readJSON('package.json') let pkg = grunt.file.readJSON('package.json')
grunt.initConfig({ grunt.initConfig({

View File

@ -1,60 +1,60 @@
module.exports = function(config) { module.exports = function (config) {
var configuration = { let configuration = {
basePath: './tests', basePath: './tests',
frameworks: ['qunit'], frameworks: ['qunit'],
files: [ files: [
'../lib/utils/init.js', '../lib/utils/init.js',
'../lib/utils/*.js', '../lib/utils/*.js',
'../lib/logging/*.js', '../lib/logging/*.js',
'../lib/make/init.js', '../lib/make/init.js',
'../lib/make/*.js', '../lib/make/*.js',
'../lib/random/*.js', '../lib/random/*.js',
'**/*.js' '**/*.js'
], ],
exclude: [ exclude: [
], ],
preprocessors: { preprocessors: {
'../lib/**/*.js': ['coverage'] '../lib/**/*.js': ['coverage']
}, },
reporters: ['progress', 'coverage'], reporters: ['progress', 'coverage'],
port: 9876, port: 9876,
colors: true, colors: true,
logLevel: config.LOG_INFO, logLevel: config.LOG_INFO,
autoWatch: true, autoWatch: true,
browsers: ['Chrome', 'Firefox'], browsers: ['Chrome', 'Firefox'],
singleRun: true, singleRun: true,
browserNoActivityTimeout: 30000, browserNoActivityTimeout: 30000,
customLaunchers: { customLaunchers: {
Chrome_travis_ci: { Chrome_travis_ci: {
base: 'Chrome', base: 'Chrome',
flags: ['--no-sandbox'] flags: ['--no-sandbox']
} }
}, },
coverageReporter: { coverageReporter: {
reporters: [ reporters: [
{ type: "lcov", dir: "coverage/" }, { type: 'lcov', dir: 'coverage/' },
{ type: 'text-summary' } { type: 'text-summary' }
] ]
},
};
if (process.env.TRAVIS) {
configuration.browsers = ['Chrome_travis_ci', 'Firefox'];
} }
}
config.set(configuration); if (process.env.TRAVIS) {
}; configuration.browsers = ['Chrome_travis_ci', 'Firefox']
}
config.set(configuration)
}

View File

@ -1,10 +1,49 @@
{ {
"name": "octo", "name": "octo",
"description": "",
"keywords": [
"fuzzing", "browsers"
],
"homepage": "https://github.com/mozillasecurity/octo",
"repository": {
"type": "git",
"url": "https://github.com/mozillasecurity/octo.git"
},
"bugs": {
"url": "https://github.com/mozillasecurity/octo/issues",
"email": "cdiehl@mozilla.com"
},
"author": "Christoph Diehl <cdiehl@mozilla.com>",
"license": "MPL-2.0",
"scripts": {
"test": "grunt test --verbose",
"test:lint": "cross-env NODE_ENV=test standard --verbose"
},
"standard": {
"ignore": [
"tests/**"
],
"globals": [
"random",
"make",
"utils",
"logger",
"MersenneTwister",
"o",
"btoa",
"atob"
],
"envs": [
"browser"
]
},
"devDependencies": { "devDependencies": {
"cross-env": "^5.1.3",
"grunt": "*", "grunt": "*",
"grunt-karma": "*", "grunt-karma": "*",
"grunt-karma-coveralls": "*", "grunt-karma-coveralls": "*",
"grunt-standard": "*", "grunt-standard": "*",
"husky": "^0.14.3",
"karma": "*", "karma": "*",
"karma-chrome-launcher": "*", "karma-chrome-launcher": "*",
"karma-coverage": "*", "karma-coverage": "*",
@ -12,12 +51,5 @@
"karma-qunit": "*", "karma-qunit": "*",
"qunitjs": "*", "qunitjs": "*",
"standard": "*" "standard": "*"
},
"scripts": {
"test": "grunt test --verbose"
},
"standard": {
"globals": ["random", "make", "utils", "logger", "MersenneTwister", "o", "btoa", "atob"],
"envs": ["browser"]
} }
} }