[Pkg-javascript-commits] [node-argparse] 01/08: New upstream version 1.0.9

Jérémy Lal kapouer at moszumanska.debian.org
Fri Dec 29 14:00:51 UTC 2017


This is an automated email from the git hooks/post-receive script.

kapouer pushed a commit to branch master
in repository node-argparse.

commit 0b41b772f43d48b9cbbd2bd0da5bf3ad383c9c4c
Author: Jérémy Lal <kapouer at melix.org>
Date:   Fri Dec 29 14:56:13 2017 +0100

    New upstream version 1.0.9
---
 .eslintignore                |  1 +
 .eslintrc.yml                | 33 +++++++++---------
 .gitignore                   |  6 ++--
 .ndocrc                      |  3 +-
 .travis.yml                  |  2 +-
 CHANGELOG.md                 | 12 +++++++
 Makefile                     |  5 ++-
 lib/action_container.js      |  4 +--
 lib/argument_parser.js       | 82 ++++++++++++++++++++++----------------------
 lib/help/added_formatters.js |  4 +--
 lib/help/formatter.js        | 56 +++++++++++++++---------------
 package.json                 | 11 +++---
 test/constant.js             | 30 ++++++++--------
 test/fromfile.js             | 12 +++----
 test/nargs.js                |  2 +-
 test/user_defined_type.js    |  5 ++-
 16 files changed, 143 insertions(+), 125 deletions(-)

diff --git a/.eslintignore b/.eslintignore
index 6c65a9f..59d1786 100644
--- a/.eslintignore
+++ b/.eslintignore
@@ -1,3 +1,4 @@
 doc/
 node_modules/
 test/fixtures
+coverage/
diff --git a/.eslintrc.yml b/.eslintrc.yml
index 6439b4c..5cd2d0b 100644
--- a/.eslintrc.yml
+++ b/.eslintrc.yml
@@ -1,8 +1,6 @@
 env:
   node:     true
-
-plugins:
-  - nodeca
+  es6:      false
 
 rules:
   accessor-pairs:         2
@@ -10,13 +8,14 @@ rules:
   block-scoped-var:       2
   block-spacing:          2
   brace-style:            [ 2, '1tbs', { "allowSingleLine": true } ]
-  #callback-return:        2
+  callback-return:        2
   comma-dangle:           2
   comma-spacing:          2
   comma-style:            2
   computed-property-spacing: [ 2, never ]
-  #consistent-return:      2
   consistent-this:        [ 2, self ]
+  #consistent-return:      2
+  # ? change to multi
   curly:                  [ 2, 'multi-line' ]
   # dot-notation:           [ 2, { allowKeywords: true } ]
   dot-location:           [ 2, 'property' ]
@@ -25,6 +24,9 @@ rules:
   func-style:             [ 2, declaration ]
   guard-for-in:           2
   handle-callback-err:    2
+
+  indent:                 [ 2, 2, { VariableDeclarator: { var: 2, let: 2, const: 3 }, SwitchCase: 1 } ]
+
   # key-spacing:            [ 2, { "align": "value" } ]
   keyword-spacing:        2
   linebreak-style:        2
@@ -34,6 +36,7 @@ rules:
   max-len:                [ 2, 120, 1000 ]
   new-cap:                2
   new-parens:             2
+  #newline-after-var:      2
   no-alert:               2
   no-array-constructor:   2
   no-bitwise:             2
@@ -51,7 +54,7 @@ rules:
   no-dupe-keys:           2
   no-duplicate-case:      2
   no-else-return:         2
-  # no-empty:               1
+  no-empty:               1
   no-empty-character-class: 2
   no-empty-pattern:       2
   no-eq-null:             2
@@ -64,13 +67,15 @@ rules:
   no-fallthrough:         2
   no-floating-decimal:    2
   no-func-assign:         2
+  # Postponed
+  #no-implicit-coercion:   [2, { "boolean": true, "number": true, "string": true } ]
   no-implied-eval:        2
   no-inner-declarations:  2
   no-invalid-regexp:      2
   no-irregular-whitespace: 2
   no-iterator:            2
-  no-labels:              2
   no-label-var:           2
+  no-labels:              2
   no-lone-blocks:         1
   no-lonely-if:           2
   no-loop-func:           2
@@ -78,6 +83,7 @@ rules:
   no-mixed-spaces-and-tabs: 2
   no-native-reassign:     2
   no-negated-in-lhs:      2
+  no-nested-ternary:      2
   no-new:                 2
   no-new-func:            2
   no-new-object:          2
@@ -89,11 +95,11 @@ rules:
   no-path-concat:         2
   no-proto:               2
   no-redeclare:           2
-  # no-regex-spaces:        2
+  no-regex-spaces:        2
   no-return-assign:       2
   no-self-compare:        2
   no-sequences:           2
-  # no-shadow:              2
+  #no-shadow:              2
   no-shadow-restricted-names: 2
   no-sparse-arrays:       2
   no-throw-literal:       2
@@ -110,6 +116,7 @@ rules:
   no-with:                2
   object-curly-spacing:   [ 2, always, { "objectsInObjects": true, "arraysInObjects": true } ]
   operator-assignment:    1
+  operator-linebreak:     [ 2, after ]
   semi:                   2
   semi-spacing:           2
   space-before-blocks:    2
@@ -125,11 +132,3 @@ rules:
   use-isnan:              2
   valid-typeof:           2
   yoda:                   [ 2, never, { "exceptRange": true } ]
-
-
-
-#
-# Our custom rules from plugin
-#
-  nodeca/indent:              [2, spaces, 2]
-  nodeca/no-wire-anonymous:   1
diff --git a/.gitignore b/.gitignore
index 766c968..378ac9b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,3 @@
-/tmp/
-/node_modules/
-/doc/
+coverage
+doc
+node_modules
diff --git a/.ndocrc b/.ndocrc
index 996780f..c5fbfbb 100644
--- a/.ndocrc
+++ b/.ndocrc
@@ -4,9 +4,10 @@
 
 --index         "./README.md"
 --package       "./package.json"
---gh-ribbon     "{package.homepage}"
+--gh-ribbon     "https://github.com/{package.repository}"
 --output        "doc"
 --render        "html"
+--link-format   "https://github.com/{package.repository}/blob/master/{file}#L{line}"
 --broken-links  "throw"
 
 
diff --git a/.travis.yml b/.travis.yml
index d949ace..066c729 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -3,5 +3,5 @@ node_js:
  - "0.10"
  - "0.12"
  - "4"
- - "5"
+ - "6"
 sudo: false
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 61405eb..e422115 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,15 @@
+1.0.9 / 2016-09-29
+------------------
+
+- Rerelease after 1.0.8 - deps cleanup.
+
+
+1.0.8 / 2016-09-29
+------------------
+
+- Maintenance (deps bump, fix node 6.5+ tests, coverage report).
+
+
 1.0.7 / 2016-03-17
 ------------------
 
diff --git a/Makefile b/Makefile
index 4f18944..de2e743 100644
--- a/Makefile
+++ b/Makefile
@@ -27,10 +27,13 @@ lint:
 test: lint
 	./node_modules/.bin/mocha
 
+coverage:
+	rm -rf coverage
+	./node_modules/.bin/istanbul cover node_modules/.bin/_mocha
 
 doc:
 	rm -rf ./doc
-	./node_modules/.bin/ndoc --link-format "{package.homepage}/blob/${CURR_HEAD}/{file}#L{line}"
+	./node_modules/.bin/ndoc --link-format "https://github.com/{package.repository}/blob/${CURR_HEAD}/{file}#L{line}"
 
 
 gh-pages:
diff --git a/lib/action_container.js b/lib/action_container.js
index 86aa017..6f1237b 100644
--- a/lib/action_container.js
+++ b/lib/action_container.js
@@ -323,8 +323,8 @@ ActionContainer.prototype._addContainerActions = function (container) {
   var mutexGroup;
   container._mutuallyExclusiveGroups.forEach(function (group) {
     mutexGroup = this.addMutuallyExclusiveGroup({
-        required: group.required
-      });
+      required: group.required
+    });
     // map the actions to their new mutex group
     group._groupActions.forEach(function (action) {
       groupMap[actionHash(action)] = mutexGroup;
diff --git a/lib/argument_parser.js b/lib/argument_parser.js
index eca1ad6..bd9a59a 100644
--- a/lib/argument_parser.js
+++ b/lib/argument_parser.js
@@ -649,19 +649,19 @@ ArgumentParser.prototype._matchArgument = function (action, regexpArgStrings) {
   // throw an exception if we weren't able to find a match
   if (!matches) {
     switch (action.nargs) {
-    /*eslint-disable no-undefined*/
-    case undefined:
-    case null:
-      message = 'Expected one argument.';
-      break;
-    case c.OPTIONAL:
-      message = 'Expected at most one argument.';
-      break;
-    case c.ONE_OR_MORE:
-      message = 'Expected at least one argument.';
-      break;
-    default:
-      message = 'Expected %s argument(s)';
+      /*eslint-disable no-undefined*/
+      case undefined:
+      case null:
+        message = 'Expected one argument.';
+        break;
+      case c.OPTIONAL:
+        message = 'Expected at most one argument.';
+        break;
+      case c.ONE_OR_MORE:
+        message = 'Expected at least one argument.';
+        break;
+      default:
+        message = 'Expected %s argument(s)';
     }
 
     throw argumentErrorHelper(
@@ -840,34 +840,34 @@ ArgumentParser.prototype._getNargsPattern = function (action) {
   var regexpNargs;
 
   switch (action.nargs) {
-  // the default (null) is assumed to be a single argument
-  case undefined:
-  case null:
-    regexpNargs = '(-*A-*)';
-    break;
-  // allow zero or more arguments
-  case c.OPTIONAL:
-    regexpNargs = '(-*A?-*)';
-    break;
-  // allow zero or more arguments
-  case c.ZERO_OR_MORE:
-    regexpNargs = '(-*[A-]*)';
-    break;
-  // allow one or more arguments
-  case c.ONE_OR_MORE:
-    regexpNargs = '(-*A[A-]*)';
-    break;
-  // allow any number of options or arguments
-  case c.REMAINDER:
-    regexpNargs = '([-AO]*)';
-    break;
-  // allow one argument followed by any number of options or arguments
-  case c.PARSER:
-    regexpNargs = '(-*A[-AO]*)';
-    break;
-  // all others should be integers
-  default:
-    regexpNargs = '(-*' + $$.repeat('-*A', action.nargs) + '-*)';
+    // the default (null) is assumed to be a single argument
+    case undefined:
+    case null:
+      regexpNargs = '(-*A-*)';
+      break;
+    // allow zero or more arguments
+    case c.OPTIONAL:
+      regexpNargs = '(-*A?-*)';
+      break;
+    // allow zero or more arguments
+    case c.ZERO_OR_MORE:
+      regexpNargs = '(-*[A-]*)';
+      break;
+    // allow one or more arguments
+    case c.ONE_OR_MORE:
+      regexpNargs = '(-*A[A-]*)';
+      break;
+    // allow any number of options or arguments
+    case c.REMAINDER:
+      regexpNargs = '([-AO]*)';
+      break;
+    // allow one argument followed by any number of options or arguments
+    case c.PARSER:
+      regexpNargs = '(-*A[-AO]*)';
+      break;
+    // all others should be integers
+    default:
+      regexpNargs = '(-*' + $$.repeat('-*A', action.nargs) + '-*)';
   }
 
   // if this is an optional action, -- is not allowed
diff --git a/lib/help/added_formatters.js b/lib/help/added_formatters.js
index f0fbe5d..f8e4299 100644
--- a/lib/help/added_formatters.js
+++ b/lib/help/added_formatters.js
@@ -58,8 +58,8 @@ util.inherits(RawDescriptionHelpFormatter, HelpFormatter);
 RawDescriptionHelpFormatter.prototype._fillText = function (text, width, indent) {
   var lines = text.split('\n');
   lines = lines.map(function (line) {
-      return $$.trimEnd(indent + line);
-    });
+    return $$.trimEnd(indent + line);
+  });
   return lines.join('\n');
 };
 module.exports.RawDescriptionHelpFormatter = RawDescriptionHelpFormatter;
diff --git a/lib/help/formatter.js b/lib/help/formatter.js
index 61c4f41..a8e4148 100644
--- a/lib/help/formatter.js
+++ b/lib/help/formatter.js
@@ -688,34 +688,34 @@ HelpFormatter.prototype._formatArgs = function (action, metavarDefault) {
   var buildMetavar = this._metavarFormatter(action, metavarDefault);
 
   switch (action.nargs) {
-  /*eslint-disable no-undefined*/
-  case undefined:
-  case null:
-    metavars = buildMetavar(1);
-    result = '' + metavars[0];
-    break;
-  case c.OPTIONAL:
-    metavars = buildMetavar(1);
-    result = '[' + metavars[0] + ']';
-    break;
-  case c.ZERO_OR_MORE:
-    metavars = buildMetavar(2);
-    result = '[' + metavars[0] + ' [' + metavars[1] + ' ...]]';
-    break;
-  case c.ONE_OR_MORE:
-    metavars = buildMetavar(2);
-    result = '' + metavars[0] + ' [' + metavars[1] + ' ...]';
-    break;
-  case c.REMAINDER:
-    result = '...';
-    break;
-  case c.PARSER:
-    metavars = buildMetavar(1);
-    result = metavars[0] + ' ...';
-    break;
-  default:
-    metavars = buildMetavar(action.nargs);
-    result = metavars.join(' ');
+    /*eslint-disable no-undefined*/
+    case undefined:
+    case null:
+      metavars = buildMetavar(1);
+      result = '' + metavars[0];
+      break;
+    case c.OPTIONAL:
+      metavars = buildMetavar(1);
+      result = '[' + metavars[0] + ']';
+      break;
+    case c.ZERO_OR_MORE:
+      metavars = buildMetavar(2);
+      result = '[' + metavars[0] + ' [' + metavars[1] + ' ...]]';
+      break;
+    case c.ONE_OR_MORE:
+      metavars = buildMetavar(2);
+      result = '' + metavars[0] + ' [' + metavars[1] + ' ...]';
+      break;
+    case c.REMAINDER:
+      result = '...';
+      break;
+    case c.PARSER:
+      metavars = buildMetavar(1);
+      result = metavars[0] + ' ...';
+      break;
+    default:
+      metavars = buildMetavar(action.nargs);
+      result = metavars.join(' ');
   }
   return result;
 };
diff --git a/package.json b/package.json
index 651d5d4..1f9bdb4 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
 {
   "name": "argparse",
   "description": "Very powerful CLI arguments parser. Native port of argparse - python's options parsing library",
-  "version": "1.0.7",
+  "version": "1.0.9",
   "keywords": [
     "cli",
     "parser",
@@ -9,7 +9,6 @@
     "option",
     "args"
   ],
-  "homepage": "https://github.com/nodeca/argparse",
   "contributors": [
     "Eugene Shkuropat",
     "Paul Jacobson"
@@ -27,9 +26,9 @@
     "sprintf-js": "~1.0.2"
   },
   "devDependencies": {
-    "eslint": "2.0.0-rc.0",
-    "eslint-plugin-nodeca": "~1.0.3",
-    "mocha": "*",
-    "ndoc": "^3.1.0"
+    "eslint": "^2.13.1",
+    "istanbul": "^0.4.5",
+    "mocha": "^3.1.0",
+    "ndoc": "^5.0.1"
   }
 }
diff --git a/test/constant.js b/test/constant.js
index 435a0e9..64a6ebc 100644
--- a/test/constant.js
+++ b/test/constant.js
@@ -24,18 +24,18 @@ describe('constant actions', function () {
   it('storeConst should give error if constant not given (or misspelled)', function () {
     assert.throws(
       function () {
-          parser.addArgument(
-            [ '-a' ],
-            {
-              action: 'storeConst',
-              dest:   'answer',
-              help:   'store constant',
-              const:  42
-            }
-          );
-        },
-        /constant option is required for storeAction/
-      );
+        parser.addArgument(
+          [ '-a' ],
+          {
+            action: 'storeConst',
+            dest:   'answer',
+            help:   'store constant',
+            const:  42
+          }
+        );
+      },
+      /constant option is required for storeAction/
+    );
   });
 
   it('appendConst should append constant as given', function () {
@@ -50,9 +50,9 @@ describe('constant actions', function () {
   it('appendConst should give error if constant not given (or misspelled)', function () {
     assert.throws(
       function () {
-          parser.addArgument([ '-a' ], { action: 'appendConst', dest:   'answer',
-              help:   'store constant', const: 42 });
-        },
+        parser.addArgument([ '-a' ], { action: 'appendConst', dest:   'answer',
+            help:   'store constant', const: 42 });
+      },
       /constant option is required for appendAction/
     );
   });
diff --git a/test/fromfile.js b/test/fromfile.js
index 13f3141..8b6156a 100644
--- a/test/fromfile.js
+++ b/test/fromfile.js
@@ -59,12 +59,12 @@ describe('from file', function () {
   });
   it('test custom convertArgLineToArgs function', function () {
     parser.convertArgLineToArgs = function (argLine) {
-        // split line into 'words'
-        args = argLine.split(' ');
-        args = args.map(function (arg) { return arg.trim(); });
-        args = args.filter(function (arg) { return arg.length > 0; });
-        return args;
-      };
+      // split line into 'words'
+      args = argLine.split(' ');
+      args = args.map(function (arg) { return arg.trim(); });
+      args = args.filter(function (arg) { return arg.length > 0; });
+      return args;
+    };
     args = parser.parseArgs([ 'X', '@hello' ]);
     assert.deepEqual(args, { a: null, x: 'X', y: [ 'hello', 'world!' ] });
   });
diff --git a/test/nargs.js b/test/nargs.js
index 986ca6a..6138da4 100644
--- a/test/nargs.js
+++ b/test/nargs.js
@@ -855,7 +855,7 @@ describe('nargs', function () {
     parser.addArgument([ '--xlim' ], { nargs: 2, type: 'float' });
 
     args = parser.parseArgs([ '--xlim', '-2e-3', '1e4' ]);
-    assert.equal(args['xlim'][0], -0.002);
+    assert.equal(args.xlim[0], -0.002);
   });
 
 });
diff --git a/test/user_defined_type.js b/test/user_defined_type.js
index db85fc5..11f144c 100644
--- a/test/user_defined_type.js
+++ b/test/user_defined_type.js
@@ -112,7 +112,10 @@ describe('user defined type', function () {
     assert.deepEqual(args, { d: new Date('1/1/2012') });
     assert.throws(
     function () { parser.parseArgs([ '-d', 'abc' ]); },
-      /Invalid <function> value: abc\nabc is not a valid date/im
+      TypeError,
+      // DateTime exception message format has changed around node v6.5
+      // use `.+` to match any variations.
+      /Invalid .+ value: abc/im
     );
   });
 });

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-argparse.git



More information about the Pkg-javascript-commits mailing list