{"action":"opened","issue":{"url":"https://api.github.com/repos/eslint/eslint/issues/2862","labels_url":"https://api.github.com/repos/eslint/eslint/issues/2862/labels{/name}","comments_url":"https://api.github.com/repos/eslint/eslint/issues/2862/comments","events_url":"https://api.github.com/repos/eslint/eslint/issues/2862/events","html_url":"https://github.com/eslint/eslint/issues/2862","id":91446063,"number":2862,"title":"--ext test.js not working with multi-dot notation","user":{"login":"kentcdodds","id":1500684,"avatar_url":"https://avatars.githubusercontent.com/u/1500684?v=3","gravatar_id":"","url":"https://api.github.com/users/kentcdodds","html_url":"https://github.com/kentcdodds","followers_url":"https://api.github.com/users/kentcdodds/followers","following_url":"https://api.github.com/users/kentcdodds/following{/other_user}","gists_url":"https://api.github.com/users/kentcdodds/gists{/gist_id}","starred_url":"https://api.github.com/users/kentcdodds/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kentcdodds/subscriptions","organizations_url":"https://api.github.com/users/kentcdodds/orgs","repos_url":"https://api.github.com/users/kentcdodds/repos","events_url":"https://api.github.com/users/kentcdodds/events{/privacy}","received_events_url":"https://api.github.com/users/kentcdodds/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-06-27T10:54:07Z","updated_at":"2015-06-27T10:54:07Z","closed_at":null,"body":"Here's a reproducible example:\r\n\r\n```\r\n~/Desktop\r\n😄  $ echo \"console.log('hi mom');\" > temp.test.js\r\n~/Desktop\r\n😄  $ eslint . --ext test.js\r\n~/Desktop\r\n😄  $ eslint .\r\n\r\ntemp.test.js\r\n  1:0   error  Unexpected console statement  no-console\r\n  1:0   error  \"console\" is not defined      no-undef\r\n  1:12  error  Strings must use doublequote  quotes\r\n\r\n✖ 3 problems (3 errors, 0 warnings)\r\n\r\n~/Desktop\r\n😄  $ eslint . --ext .test.js\r\n~/Desktop\r\n😄  $ eslint . --ext js\r\n~/Desktop\r\n😄  $ eslint . --ext .js\r\n\r\ntemp.test.js\r\n  1:0   error  Unexpected console statement  no-console\r\n  1:0   error  \"console\" is not defined      no-undef\r\n  1:12  error  Strings must use doublequote  quotes\r\n\r\n✖ 3 problems (3 errors, 0 warnings)\r\n```\r\n\r\nIt's arguable whether this is expected behavior, but it would certainly be nice if the `--ext` worked more like \"files ending in x\" rather than \"matching x from the last dot to the end of the filename\"\r\n\r\nOn this note, I asked/suggested something [on Gitter](https://gitter.im/eslint/eslint?at=558e7998666fd9af67366bd2) a moment ago that I think would solve my true use-case for something like this:\r\n\r\n> Hey friends, is it possible to scope eslint to scope eslint config to files matching a naming convention? For example, I want all of my `*.test.js` files to have the `env`of `mocha` in addition to `browser`.\r\n> I would actually really like this for a bunch of things because I have different rules between my tests and my code (max-len for longer `it` descriptions, or max-nested-callbacks for nesting `describe`s with `it`s). Would be very cool if the `.eslintrc` allowed me to specify a subset of overrides that apply only to my test files. I suppose I could accomplish this with webpack loaders........ hmmmm... yeah :-)\r\n> But not having to manage that myself and being able to include it right in my `.eslintrc` would be magical. Has there been discussion about this before?\r\n> Oh, and by the way, I mix my test files with my source files, so I can't simply plop an `.eslintrc` into my test directory because that doesn't exist. I think this is fairly common.\r\n\r\n@bebraw suggested the `--ext` option which lead to discovering and reporting this bug/feature request. But I would really like something like this:\r\n\r\n```javascript\r\n{\r\n  // common config goes up here\r\n  \"ext\": [\r\n    {\r\n      \"test\": \"\\\\.(test|mock)\\\\.js$\", // regex matching anything ending in .test.js or .mock.js\r\n      \"config\": {\r\n        // config overrides for test/mock files here\r\n      }\r\n    },\r\n    {\r\n      \"test\": \"^((?!\\.(test|mock)\\.).)*\\.js$\", // regex matching anything not including .test. or .mock.\r\n      \"config\": {\r\n        // config overrides for non-test/mock files here\r\n      }\r\n    }\r\n  ]\r\n}\r\n```\r\n\r\nThis would be fantastically flexible and support a great deal of use cases and conventions without sacrificing simplicity (in my mind anyway). Feedback welcome!"}}