Repository: ember-intl/ember-intl (ts)

Issue:
[ember-intl] '.ds-store' is not a valid locale name
I've been using ember-intl in my main application and a number of addons. During the build process, I've noticed the following warning.

    [ember-intl] '.ds-store' is not a valid locale name

I believe it is taking the *.DS_Store* file produced by Macs and trying to think of it as a translation file. I only noticed this issue once adding translations to addons that are consumed by my application. The file is likely converted to *.ds-store* when the broccoli TranslationReducer plugin normalizes the file names. 

I have a *.DS_Store* entry in my global *.gitignore* file, but I don't have it in my *.npmignore* files, which I'm guessing is where it is finding that file. However, should it be necessary to include that entry in the *.npmignore* or should this be something that ember-intl accounts for?

### Environment

- Ember Version: 3.1.4
- Ember CLI Version: 3.1.4
- Ember Intl Version: 3.0.0
- Browser(s): Any
- Node Version: 8.11.3


Pull request:
fix: filter translation files without supported extension
fixes #594

This also fixes the mocha tests which weren't completely run previously

```
$ mocha tests-node/**/*.*
  index
    ✓ createOptions ensures that requiresTranslation is a function.
  1 passing (9ms)
```

Patch:
diff --git a/index.js b/index.js
index 67495c5d..848eb634 100644
--- a/index.js
+++ b/index.js
@@ -198,12 +198,14 @@ module.exports = {
 
     if (fs.existsSync(joinedPath)) {
       locales = locales.concat(
-        walkSync(joinedPath, { directories: false }).map(function(filename) {
-          return path
-            .basename(filename, path.extname(filename))
-            .toLowerCase()
-            .replace(/_/g, '-');
-        })
+        walkSync(joinedPath, { directories: false })
+          .filter(utils.validLocaleFile)
+          .map(function(filename) {
+            return path
+              .basename(filename, path.extname(filename))
+              .toLowerCase()
+              .replace(/_/g, '-');
+          })
       );
     }
 
diff --git a/lib/utils/index.js b/lib/utils/index.js
index 4bf6c9a8..f15fae28 100644
--- a/lib/utils/index.js
+++ b/lib/utils/index.js
@@ -10,5 +10,6 @@
 module.exports = {
   unique: require('./unique'),
   castArray: require('./cast-array'),
-  isSupportedLocale: require('./is-supported-locale')
+  isSupportedLocale: require('./is-supported-locale'),
+  validLocaleFile: require('./valid-locale-file')
 };
diff --git a/lib/utils/valid-locale-file.js b/lib/utils/valid-locale-file.js
new file mode 100644
index 00000000..7951cb69
--- /dev/null
+++ b/lib/utils/valid-locale-file.js
@@ -0,0 +1,12 @@
+/* eslint-env node */
+const path = require('path');
+
+const allowedExtensions = ['.json', '.yaml', '.yml'];
+
+function validLocaleFile(filename) {
+  if (typeof filename !== 'string') return false;
+
+  return allowedExtensions.includes(path.extname(filename));
+}
+
+module.exports = validLocaleFile;
diff --git a/package.json b/package.json
index 6d42f8fc..3a39731c 100644
--- a/package.json
+++ b/package.json
@@ -25,7 +25,7 @@
     "start": "ember serve",
     "build": "ember build",
     "lint:js": "eslint ./*.js addon addon-test-support app config lib server test-support tests",
-    "tests-node": "mocha tests-node/**/*.*",
+    "tests-node": "mocha \"tests-node/**/*.*\"",
     "test": "npm run tests-node && ember test",
     "testall": "npm run tests-node && ember try:each",
     "prettier": "prettier --single-quote --print-width 120 --write \"{blueprints,config,lib,app,addon,addon-test-support,tests,tests-node}/**/*.js\""


Test patch:
diff --git a/tests-node/unit/utils/valid-locale-file-test.js b/tests-node/unit/utils/valid-locale-file-test.js
new file mode 100644
index 00000000..2f83d7ff
--- /dev/null
+++ b/tests-node/unit/utils/valid-locale-file-test.js
@@ -0,0 +1,25 @@
+/* eslint-env node */
+/* globals describe, it */
+
+'use strict';
+
+let expect = require('chai').expect;
+
+let validLocaleFile = require('../../../lib/utils/valid-locale-file');
+
+describe('validLocaleFile', function() {
+  [
+    ['en-us.yaml', true],
+    ['en.json', true],
+    ['sub/en-us.yml', true],
+
+    ['index.html', false],
+    ['.bashrc', false],
+    ['.DS_Store', false],
+    [undefined, false]
+  ].forEach(([filename, isValid]) => {
+    it(`${filename}`, function() {
+      expect(validLocaleFile(filename)).to.equal(isValid);
+    });
+  });
+});