Permalink
Browse files

Changed to jshint

  • Loading branch information...
1 parent 02b4014 commit 5e0cb44aa09746858d1e4968f7594f312fbaa91b @drewhamlett drewhamlett committed Apr 27, 2014
Showing with 107 additions and 28 deletions.
  1. +0 −5 .gitignore
  2. +86 −0 .jshintrc
  3. +1 −1 LICENSE
  4. +20 −22 main.js
View
@@ -1,7 +1,2 @@
.DS_Store
-
-temp/beautify-css.js
-temp/beautify-html.js
-temp/beautify.js
-
*.zip
View
@@ -0,0 +1,86 @@
+{
+ // JSHint Default Configuration File (as on JSHint website)
+ // See http://jshint.com/docs/ for more details
+
+ "maxerr" : 50, // {int} Maximum error before stopping
+
+ // Enforcing
+ "bitwise" : true, // true: Prohibit bitwise operators (&, |, ^, etc.)
+ "camelcase" : false, // true: Identifiers must be in camelCase
+ "curly" : false, // true: Require {} for every new block or scope
+ "eqeqeq" : true, // true: Require triple equals (===) for comparison
+ "forin" : true, // true: Require filtering for..in loops with obj.hasOwnProperty()
+ "immed" : false, // true: Require immediate invocations to be wrapped in parens e.g. `(function () { } ());`
+ "indent" : 4, // {int} Number of spaces to use for indentation
+ "latedef" : false, // true: Require variables/functions to be defined before being used
+ "newcap" : false, // true: Require capitalization of all constructor functions e.g. `new F()`
+ "noarg" : true, // true: Prohibit use of `arguments.caller` and `arguments.callee`
+ "noempty" : true, // true: Prohibit use of empty blocks
+ "nonew" : false, // true: Prohibit use of constructors for side-effects (without assignment)
+ "plusplus" : true, // true: Prohibit use of `++` & `--`
+ "quotmark" : false, // Quotation mark consistency:
+ // false : do nothing (default)
+ // true : ensure whatever is used is consistent
+ // "single" : require single quotes
+ // "double" : require double quotes
+ "undef" : true, // true: Require all non-global variables to be declared (prevents global leaks)
+ "unused" : false, // true: Require all defined variables be used
+ "strict" : false, // true: Requires all functions run in ES5 Strict Mode
+ "trailing" : false, // true: Prohibit trailing whitespaces
+ "maxparams" : false, // {int} Max number of formal params allowed per function
+ "maxdepth" : false, // {int} Max depth of nested blocks (within functions)
+ "maxstatements" : false, // {int} Max number statements per function
+ "maxcomplexity" : false, // {int} Max cyclomatic complexity per function
+ "maxlen" : false, // {int} Max number of characters per line
+
+ // Relaxing
+ "asi" : false, // true: Tolerate Automatic Semicolon Insertion (no semicolons)
+ "boss" : false, // true: Tolerate assignments where comparisons would be expected
+ "debug" : false, // true: Allow debugger statements e.g. browser breakpoints.
+ "eqnull" : false, // true: Tolerate use of `== null`
+ "es5" : false, // true: Allow ES5 syntax (ex: getters and setters)
+ "esnext" : true, // true: Allow ES.next (ES6) syntax (ex: `const`)
+ "moz" : false, // true: Allow Mozilla specific syntax (extends and overrides esnext features)
+ // (ex: `for each`, multiple try/catch, function expression…)
+ "evil" : false, // true: Tolerate use of `eval` and `new Function()`
+ "expr" : false, // true: Tolerate `ExpressionStatement` as Programs
+ "funcscope" : false, // true: Tolerate defining variables inside control statements"
+ "globalstrict" : true, // true: Allow global "use strict" (also enables 'strict')
+ "iterator" : false, // true: Tolerate using the `__iterator__` property
+ "lastsemic" : false, // true: Tolerate omitting a semicolon for the last statement of a 1-line block
+ "laxbreak" : false, // true: Tolerate possibly unsafe line breakings
+ "laxcomma" : false, // true: Tolerate comma-first style coding
+ "loopfunc" : false, // true: Tolerate functions being defined in loops
+ "multistr" : true, // true: Tolerate multi-line strings
+ "proto" : false, // true: Tolerate using the `__proto__` property
+ "scripturl" : false, // true: Tolerate script-targeted URLs
+ "smarttabs" : false, // true: Tolerate mixed tabs/spaces when used for alignment
+ "shadow" : false, // true: Allows re-define variables later in code e.g. `var x=1; x=2;`
+ "sub" : true, // true: Tolerate using `[]` notation when it can still be expressed in dot notation
+ "supernew" : false, // true: Tolerate `new function () { ... };` and `new Object;`
+ "validthis" : false, // true: Tolerate using this in a non-constructor function
+
+ // Environments
+ "browser" : true, // Web Browser (window, document, etc)
+ "couch" : false, // CouchDB
+ "devel" : true, // Development/debugging (alert, confirm, etc)
+ "dojo" : false, // Dojo Toolkit
+ "jquery" : false, // jQuery
+ "mootools" : false, // MooTools
+ "node" : true, // Node.js
+ "nonstandard" : false, // Widely adopted globals (escape, unescape, etc)
+ "prototypejs" : false, // Prototype and Scriptaculous
+ "rhino" : false, // Rhino
+ "worker" : false, // Web Workers
+ "wsh" : false, // Windows Scripting Host
+ "yui" : false, // Yahoo User Interface
+
+ // Legacy
+ "nomen" : false, // true: Prohibit dangling `_` in variables
+ "onevar" : false, // true: Allow only one `var` statement per function
+ "passfail" : false, // true: Stop on first error
+ "white" : false, // true: Check against strict whitespace and indentation rules
+
+ // Custom Globals
+ "globals" : [ "$", "io", "moment", "angular", "it", "describe", "socket", "_", "toastr"] // additional predefined global variables
+}
View
@@ -1,6 +1,6 @@
The MIT License (MIT)
-Copyright (c) 2007-2013 Drew Hamlett, Einar Lielmanis and contributors.
+Copyright (c) 2007-2014 Drew Hamlett, Einar Lielmanis and contributors.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
View
@@ -1,4 +1,3 @@
-/*jslint vars: true, plusplus: true, devel: true, nomen: true, regexp: true, indent: 4 */
/*global define, $, brackets, window, js_beautify, style_html, css_beautify, localStorage */
define(function (require, exports, module) {
@@ -20,8 +19,9 @@ define(function (require, exports, module) {
COMMAND_ID = "me.drewh.jsbeautify",
CONTEXTUAL_COMMAND_ID = "me.drewh.jsbeautifyContextual";
-
- var js_beautify = require('beautify');
+ var PreferencesManager = brackets.getModule("preferences/PreferencesManager");
+ require('thirdparty/js');
+ var js_beautify = require('thirdparty/js/lib/beautify').beautify;
var css_beautify = require('beautify-css');
var html_beautify = require('beautify-html').html_beautify;
@@ -177,15 +177,15 @@ define(function (require, exports, module) {
function loadConfig() {
var settingsFile = FileSystem.getFileForPath(ProjectManager.getProjectRoot().fullPath + settingsFileName);
- settingsFile.read( function (err, content) {
- try {
- settings = JSON.parse(content);
- console.log('settings loaded'+settings);
- } catch (e) {
- console.error("Beautify: error parsing " + settingsFile+ ". Details: " + e);
- return;
- }
- } );
+ settingsFile.read(function (err, content) {
+ try {
+ settings = JSON.parse(content);
+ console.log('settings loaded' + settings);
+ } catch (e) {
+ console.error("Beautify: error parsing " + settingsFile + ". Details: " + e);
+ return;
+ }
+ });
}
function toggle(command, fromCheckbox) {
@@ -232,22 +232,20 @@ define(function (require, exports, module) {
menu.addMenuItem(COMMAND_SAVE_ID);
AppInit.appReady(function () {
- $(DocumentManager)
- .on("documentRefreshed.beautify", function (e, document) {
- // if this project's JSHint config has been updated, reload
- if (document.file.fullPath ===
- ProjectManager.getProjectRoot().fullPath + settingsFileName) {
- loadConfig();
- }
- });
+ $(DocumentManager).on("documentRefreshed.beautify", function (e, document) {
+ // if this project's JSHint config has been updated, reload
+ if (document.file.fullPath ===
+ ProjectManager.getProjectRoot().fullPath + settingsFileName) {
+ loadConfig();
+ }
+ });
$(ProjectManager)
.on("projectOpen.beautify", function () {
loadConfig();
});
loadConfig();
});
-
/**
* Contextual menu
*/
@@ -256,4 +254,4 @@ define(function (require, exports, module) {
var contextMenu = Menus.getContextMenu(Menus.ContextMenuIds.EDITOR_MENU);
contextMenu.addMenuItem(CONTEXTUAL_COMMAND_ID);
-});
+});

0 comments on commit 5e0cb44

Please sign in to comment.