{"action":"created","issue":{"url":"https://api.github.com/repos/palantir/tslint/issues/1049","repository_url":"https://api.github.com/repos/palantir/tslint","labels_url":"https://api.github.com/repos/palantir/tslint/issues/1049/labels{/name}","comments_url":"https://api.github.com/repos/palantir/tslint/issues/1049/comments","events_url":"https://api.github.com/repos/palantir/tslint/issues/1049/events","html_url":"https://github.com/palantir/tslint/pull/1049","id":142428977,"number":1049,"title":"Add `node_module:` prefix for loading rules from a node module","user":{"login":"JKillian","id":1400151,"avatar_url":"https://avatars.githubusercontent.com/u/1400151?v=3","gravatar_id":"","url":"https://api.github.com/users/JKillian","html_url":"https://github.com/JKillian","followers_url":"https://api.github.com/users/JKillian/followers","following_url":"https://api.github.com/users/JKillian/following{/other_user}","gists_url":"https://api.github.com/users/JKillian/gists{/gist_id}","starred_url":"https://api.github.com/users/JKillian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JKillian/subscriptions","organizations_url":"https://api.github.com/users/JKillian/orgs","repos_url":"https://api.github.com/users/JKillian/repos","events_url":"https://api.github.com/users/JKillian/events{/privacy}","received_events_url":"https://api.github.com/users/JKillian/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/palantir/tslint/milestones/17","html_url":"https://github.com/palantir/tslint/milestones/TSLint%203.7","labels_url":"https://api.github.com/repos/palantir/tslint/milestones/17/labels","id":1648946,"number":17,"title":"TSLint 3.7","description":"","creator":{"login":"adidahiya","id":723999,"avatar_url":"https://avatars.githubusercontent.com/u/723999?v=3","gravatar_id":"","url":"https://api.github.com/users/adidahiya","html_url":"https://github.com/adidahiya","followers_url":"https://api.github.com/users/adidahiya/followers","following_url":"https://api.github.com/users/adidahiya/following{/other_user}","gists_url":"https://api.github.com/users/adidahiya/gists{/gist_id}","starred_url":"https://api.github.com/users/adidahiya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adidahiya/subscriptions","organizations_url":"https://api.github.com/users/adidahiya/orgs","repos_url":"https://api.github.com/users/adidahiya/repos","events_url":"https://api.github.com/users/adidahiya/events{/privacy}","received_events_url":"https://api.github.com/users/adidahiya/received_events","type":"User","site_admin":false},"open_issues":1,"closed_issues":3,"state":"open","created_at":"2016-03-16T20:41:22Z","updated_at":"2016-03-22T19:04:02Z","due_on":null,"closed_at":null},"comments":23,"created_at":"2016-03-21T18:14:14Z","updated_at":"2016-03-24T15:47:31Z","closed_at":"2016-03-22T15:42:50Z","pull_request":{"url":"https://api.github.com/repos/palantir/tslint/pulls/1049","html_url":"https://github.com/palantir/tslint/pull/1049","diff_url":"https://github.com/palantir/tslint/pull/1049.diff","patch_url":"https://github.com/palantir/tslint/pull/1049.patch"},"body":"Allows one to provide directories to custom rules living in a node module using the \"node_module:\" prefix:\r\n\r\n```\r\n{\r\n  rulesDirectory: \"node_module:tslint-eslint-rules/dist/rules\"\r\n  rules: { ... }\r\n}\r\n```\r\n\r\nThis is better than relative paths to node modules, which can behave funky depending on where the node module gets installed. Internally, this uses `require.resolve` to find the location of the node module, which means that it's using node's package finding algorithm, which is good."},"comment":{"url":"https://api.github.com/repos/palantir/tslint/issues/comments/200895731","html_url":"https://github.com/palantir/tslint/pull/1049#issuecomment-200895731","issue_url":"https://api.github.com/repos/palantir/tslint/issues/1049","id":200895731,"user":{"login":"JKillian","id":1400151,"avatar_url":"https://avatars.githubusercontent.com/u/1400151?v=3","gravatar_id":"","url":"https://api.github.com/users/JKillian","html_url":"https://github.com/JKillian","followers_url":"https://api.github.com/users/JKillian/followers","following_url":"https://api.github.com/users/JKillian/following{/other_user}","gists_url":"https://api.github.com/users/JKillian/gists{/gist_id}","starred_url":"https://api.github.com/users/JKillian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JKillian/subscriptions","organizations_url":"https://api.github.com/users/JKillian/orgs","repos_url":"https://api.github.com/users/JKillian/repos","events_url":"https://api.github.com/users/JKillian/events{/privacy}","received_events_url":"https://api.github.com/users/JKillian/received_events","type":"User","site_admin":false},"created_at":"2016-03-24T15:47:31Z","updated_at":"2016-03-24T15:47:31Z","body":"Alright, let's do it this way then. As far as \"extend\", we can just have it use `require.resolve` / `require` directly and not have to deal with any weird resolution logic on our end (since luckily you can `require` JSON files). I don't think we need to look for any magic prefix or anything, let's go with what @blakeembrey suggested and use straight up require. \r\n\r\nAs far as \"rulesDirectory\", since we're pointing to a directory and not a .js or .json file, requiring things is a bit less intuitive and makes less sense. So in this case, we'll simply treat whatever is passed as a path and handle it as such. The only weird part about this is that it's a little strange that the behavior is different here than with extends. Maybe it makes sense to handle them both using require semantics as @blakeembrey suggested?"}}