Repository: yargs/yargs (js)

Issue:
"extends" should also trigger for files without extension that end in "rc"
It's a common convention for a configuration file to end with the suffix `rc`., e.g., `.nycrc`; it seems like a good extension to the `extends` functionality would be to also support filenames of the form `.*rc`.

Currently `extends` only supports the `.json` extension. fixes https://github.com/istanbuljs/nyc/issues/732

CC: @genepaul

Pull request description:
extend *.rc files in addition to json
fixes #1035 

This simply updates the regex to include *.*rc files. It does not handle the situation with rc files that are formatted in INI format. That seems to be a separate discussion.

Patch:
diff --git a/lib/apply-extends.js b/lib/apply-extends.js
index 530b022..1436b65 100644
--- a/lib/apply-extends.js
+++ b/lib/apply-extends.js
@@ -21,7 +21,7 @@ function applyExtends (config, cwd) {
 
   if (config.hasOwnProperty('extends')) {
     if (typeof config.extends !== 'string') return defaultConfig
-    const isPath = /\.json$/.test(config.extends)
+    const isPath = /\.json|\..*rc$/.test(config.extends)
     let pathToDefault = null
     if (!isPath) {
       try {


Test patch:
diff --git a/test/fixtures/extends/.myotherrc b/test/fixtures/extends/.myotherrc
new file mode 100644
index 0000000..8c686ca
--- /dev/null
+++ b/test/fixtures/extends/.myotherrc
@@ -0,0 +1,4 @@
+{
+    "extends": "./config_1.json",
+    "c": 201
+}
\ No newline at end of file
diff --git a/test/fixtures/extends/.myrc b/test/fixtures/extends/.myrc
new file mode 100644
index 0000000..0d45cf9
--- /dev/null
+++ b/test/fixtures/extends/.myrc
@@ -0,0 +1,4 @@
+{
+    "extends": "./.myotherrc",
+    "a": 5
+}
\ No newline at end of file
diff --git a/test/yargs.js b/test/yargs.js
index 94f4018..6511250 100644
--- a/test/yargs.js
+++ b/test/yargs.js
@@ -1284,6 +1284,20 @@ describe('yargs dsl tests', () => {
         argv.a.should.equal(2)
         argv.extends.should.equal('batman')
       })
+
+      it('allows files with .*rc extension to be extended', () => {
+        const argv = yargs()
+          .config({
+            extends: './test/fixtures/extends/.myrc',
+            a: 3
+          })
+          .argv
+
+        argv.a.should.equal(3)
+        argv.b.should.equal(22)
+        argv.c.should.equal(201)
+        argv.z.should.equal(15)
+      })
     })
   })