{"action":"closed","issue":{"url":"https://api.github.com/repos/sequelize/sequelize/issues/3638","labels_url":"https://api.github.com/repos/sequelize/sequelize/issues/3638/labels{/name}","comments_url":"https://api.github.com/repos/sequelize/sequelize/issues/3638/comments","events_url":"https://api.github.com/repos/sequelize/sequelize/issues/3638/events","html_url":"https://github.com/sequelize/sequelize/issues/3638","id":72573994,"number":3638,"title":"models/index.js incorrectly loads all models","user":{"login":"jez","id":5544532,"avatar_url":"https://avatars.githubusercontent.com/u/5544532?v=3","gravatar_id":"","url":"https://api.github.com/users/jez","html_url":"https://github.com/jez","followers_url":"https://api.github.com/users/jez/followers","following_url":"https://api.github.com/users/jez/following{/other_user}","gists_url":"https://api.github.com/users/jez/gists{/gist_id}","starred_url":"https://api.github.com/users/jez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jez/subscriptions","organizations_url":"https://api.github.com/users/jez/orgs","repos_url":"https://api.github.com/users/jez/repos","events_url":"https://api.github.com/users/jez/events{/privacy}","received_events_url":"https://api.github.com/users/jez/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-05-02T02:38:41Z","updated_at":"2015-05-02T08:53:31Z","closed_at":"2015-05-02T08:53:31Z","body":"The `models/index.js` file incorrectly loads models from the `models/` directory. It assumes that every file included in this directory is a `.js` file.\r\n\r\nWhen my `models/` folder looks like this:\r\n\r\n```plain\r\nmodels\r\n├── index.js\r\n├── queue.js\r\n├── spot.js\r\n└── tags\r\n\r\n0 directories, 4 files\r\n```\r\n\r\nI get the following error:\r\n\r\n```plain\r\n1 May 22:27:18 - [nodemon] v1.3.7\r\n1 May 22:27:18 - [nodemon] to restart at any time, enter `rs`\r\n1 May 22:27:18 - [nodemon] watching: *.*\r\n1 May 22:27:18 - [nodemon] starting `node ./bin/www`\r\n/<path omitted>/models/tags:1\r\nxports, require, module, __filename, __dirname) { !_TAG_FILE_SORTED\t2\t/0=unsor\r\n                                                                   \t^\r\nSyntaxError: Unexpected number\r\n    at exports.runInThisContext (vm.js:73:16)\r\n    at Module._compile (module.js:443:25)\r\n    at Object.Module._extensions..js (module.js:478:10)\r\n    at Module.load (module.js:355:32)\r\n    at Function.Module._load (module.js:310:12)\r\n    at Module.require (module.js:365:17)\r\n    at require (module.js:384:17)\r\n    at module.exports.Sequelize.import (/<path omitted>/node_modules/sequelize/lib/sequelize.js:624:63)\r\n    at /<path omitted>/models/index.js:18:36\r\n    at Array.forEach (native)\r\n    at Object.<anonymous> (/<path omitted>/models/index.js:17:4)\r\n    at Module._compile (module.js:460:26)\r\n    at Object.Module._extensions..js (module.js:478:10)\r\n    at Module.load (module.js:355:32)\r\n    at Function.Module._load (module.js:310:12)\r\n    at Module.require (module.js:365:17)\r\n1 May 22:27:19 - [nodemon] app crashed - waiting for file changes before starting...\r\n```\r\n\r\nThis is because `models/index.js` tries to load the `tags` file as a JavaScript file. The fix is simply to check for file extensions in `models/index.js`."}}