Permalink
Browse files

Add JSHint and csslint support via npm run check/lint

  • Loading branch information...
1 parent bb56c10 commit b607f57c0fb37005e4d17ec72f62e2b6523f3d41 @XhmikosR XhmikosR committed Mar 21, 2013
Showing with 97 additions and 8 deletions.
  1. +4 −3 .gitignore
  2. +34 −0 .jshintrc
  3. +2 −0 Readme.md
  4. +0 −5 make.js
  5. +6 −0 package.json
  6. +48 −0 run-tests.js
  7. +3 −0 source/_static/css/style.css
View
@@ -1,7 +1,8 @@
+*.log
*.pyc
-/*.log
-/build/
-/node_modules/
+build
+node_modules
+npm-debug.log
# gedit backup files
*.*~
View
@@ -0,0 +1,34 @@
+{
+ "node" : true,
+ "es5" : true,
+ "browser" : false,
+
+ "bitwise": true,
+ "boss": true,
+ "camelcase": true,
+ "curly": true,
+ "eqeqeq": true,
+ "indent": 4,
+ "latedef": true,
+ "multistr": true,
+ "noarg": true,
+ "noempty": true,
+ "plusplus": false,
+ "regexp": true,
+ "strict": false,
+ "trailing": true,
+ "unused": true,
+ "globals": {
+ "cd": true,
+ "cp": true,
+ "target": true,
+ "echo": true,
+ "cat": true,
+ "exec": true,
+ "pushd": true,
+ "popd": true,
+ "rm": true,
+ "require": true,
+ "__dirname": true
+ }
+}
View
@@ -11,3 +11,5 @@ Getting started
* Run `node make` or `node make website` to build the static site
* Run the Python webserver to test your changes: `node make server`
(http://localhost:8000/)
+
+You can run `npm run check` or `npm run lint` to run JSHint and csslint for our files.
View
@@ -7,11 +7,6 @@
* Copyright (C) 2013 MPC-HC Team
*/
-/* jshint forin:true, noarg:true, noempty:true, eqeqeq:true, bitwise:true,
- camelcase:true, trailing:true, strict:true, boss:true, unused:true,
- curly:true, indent:4, maxerr:100 */
-/*global cd, cp, target, echo, cat, exec, pushd, popd, rm, require, __dirname */
-
(function () {
'use strict';
View
@@ -12,8 +12,14 @@
"type": "git",
"url": "https://github.com/mpc-hc/website.git"
},
+ "scripts": {
+ "check": "node run-tests",
+ "lint": "node run-tests"
+ },
"devDependencies": {
"clean-css": "~0.10.2",
+ "csslint": "~0.9.10",
+ "jshint": "~1.1.0",
"shelljs": "~0.1.2",
"uglify-js": "~2.2.5"
},
View
@@ -0,0 +1,48 @@
+#!/usr/bin/env node
+
+/**!
+ * run-tests.js, script to run JSHint and csslint for our files
+ * Released under the terms of MIT license
+ *
+ * https://github.com/mpc-hc/website
+ *
+ * Copyright (C) 2013 MPC-HC Team
+ */
+
+require('shelljs/global');
+
+cd(__dirname);
+
+//
+// JSHint
+//
+JSHINT_BIN = './node_modules/jshint/bin/jshint';
+
+if (!test('-f', JSHINT_BIN)) {
+ echo('JSHint not found. Run `npm install` in the root dir first.');
+ exit(1);
+}
+
+if (exec('node' +' ' + JSHINT_BIN +' ' + 'make.js run-tests.js source/_static/js/plugins.js').code !== 0) {
+ echo('*** JSHint failed! (return code != 0)');
+ echo();
+} else {
+ echo('JSHint completed successfully');
+ echo();
+}
+
+
+//
+// csslint
+//
+CSSLINT_BIN = './node_modules/csslint/cli.js';
+
+if (!test('-f', CSSLINT_BIN)) {
+ echo('csslint not found. Run `npm install` in the root dir first.');
+ exit(1);
+}
+
+if (exec('node' +' ' + CSSLINT_BIN +' ' + 'source/_static/css/style.css').code !== 0) {
+ echo('*** csslint failed! (return code != 0)');
+ echo();
+}
@@ -1,3 +1,6 @@
+/*csslint box-sizing: false, font-sizes: false, ids: false, important: false,
+ qualified-headings: false, unique-headings: false*/
+
body {
background: white url("../img/bg-pattern.png") repeat top right;
font: 13px/18px Ubuntu, "Helvetica Neue", Helvetica, Arial, sans-serif;

0 comments on commit b607f57

Please sign in to comment.