From d1ff77824ba87bcb9b9641db720ddb533216834c Mon Sep 17 00:00:00 2001 From: Markus Bordihn Date: Mon, 3 Aug 2015 20:34:07 +0200 Subject: [PATCH] Add basic lint options for npm To use this linter, make sure npm is installed and execute the following commands inside the main folder. 1.) Only once to update the package "npm install" 2.) To run the linter "npm run lint" This would make it easier to clean up some of the code. --- .gitignore | 4 ++++ .jshintignore | 6 ++++++ msg/messages.js | 4 ++-- package.json | 15 ++++++++++++++- 4 files changed, 26 insertions(+), 3 deletions(-) create mode 100644 .jshintignore diff --git a/.gitignore b/.gitignore index 43638e075..00504a0a9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,7 @@ +node_modules +npm-debug.log .DS_Store +.settings +.project *.pyc *.komodoproject diff --git a/.jshintignore b/.jshintignore new file mode 100644 index 000000000..9cc962747 --- /dev/null +++ b/.jshintignore @@ -0,0 +1,6 @@ +node_modules/ +tests/ +demos/ +**/*_compressed.js +**/*_uncompressed.js +**/*_test.js \ No newline at end of file diff --git a/msg/messages.js b/msg/messages.js index 7744c5507..e49cefdbf 100644 --- a/msg/messages.js +++ b/msg/messages.js @@ -679,7 +679,7 @@ Blockly.Msg.TEXT_GET_SUBSTRING_END_LAST = 'to last letter'; Blockly.Msg.TEXT_GET_SUBSTRING_TAIL = ''; /// url - Information about the case of letters (upper-case and lower-case). -Blockly.Msg.TEXT_CHANGECASE_HELPURL = 'https://github.com/google/blockly/wiki/Text#adjusting-text-case' +Blockly.Msg.TEXT_CHANGECASE_HELPURL = 'https://github.com/google/blockly/wiki/Text#adjusting-text-case'; /// tooltip - Describes a block to adjust the case of letters. For more information on this block, /// see [https://github.com/google/blockly/wiki/Text#adjusting-text-case /// https://github.com/google/blockly/wiki/Text#adjusting-text-case]. @@ -979,7 +979,7 @@ Blockly.Msg.LISTS_GET_SUBLIST_TOOLTIP = 'Creates a copy of the specified portion /// url - Information describing splitting text into a list, or joining a list into text. Blockly.Msg.LISTS_SPLIT_HELPURL = 'https://github.com/google/blockly/wiki/Lists#splitting-strings-and-joining-lists'; /// dropdown - Indicates that text will be split up into a list (e.g. "a-b-c" -> ["a", "b", "c"]). -Blockly.Msg.LISTS_SPLIT_LIST_FROM_TEXT = 'make list from text' +Blockly.Msg.LISTS_SPLIT_LIST_FROM_TEXT = 'make list from text'; /// dropdown - Indicates that a list will be joined together to form text (e.g. ["a", "b", "c"] -> "a-b-c"). Blockly.Msg.LISTS_SPLIT_TEXT_FROM_LIST = 'make text from list'; /// block text - Prompts for a letter to be used as a separator when splitting or joining text. diff --git a/package.json b/package.json index 48e4bdc5f..fb0d4a234 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,9 @@ "version": "1.0.0", "description": "Blockly is a library for building visual programming editors.", "keywords": ["blockly"], + "scripts": { + "lint": "jshint ." + }, "repository": { "type": "git", "url": "https://github.com/google/blockly.git" @@ -15,5 +18,15 @@ "name": "Neil Fraser" }, "license": "Apache-2.0", - "private": true + "private": true, + "devDependencies": { + "jshint": "latest" + }, + "jshintConfig": { + "unused": true, + "undef": true, + "globalstrict": true, + "sub": true, + "predef": ["Blockly", "goog", "window", "document", "soy", "XMLHttpRequest"] + } }