{"action":"created","issue":{"url":"https://api.github.com/repos/eslint/eslint/issues/1689","labels_url":"https://api.github.com/repos/eslint/eslint/issues/1689/labels{/name}","comments_url":"https://api.github.com/repos/eslint/eslint/issues/1689/comments","events_url":"https://api.github.com/repos/eslint/eslint/issues/1689/events","html_url":"https://github.com/eslint/eslint/pull/1689","id":54916035,"number":1689,"title":"Add allowPattern option to dot-notation rule","user":{"login":"tschaub","id":41094,"avatar_url":"https://avatars.githubusercontent.com/u/41094?v=3","gravatar_id":"","url":"https://api.github.com/users/tschaub","html_url":"https://github.com/tschaub","followers_url":"https://api.github.com/users/tschaub/followers","following_url":"https://api.github.com/users/tschaub/following{/other_user}","gists_url":"https://api.github.com/users/tschaub/gists{/gist_id}","starred_url":"https://api.github.com/users/tschaub/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tschaub/subscriptions","organizations_url":"https://api.github.com/users/tschaub/orgs","repos_url":"https://api.github.com/users/tschaub/repos","events_url":"https://api.github.com/users/tschaub/events{/privacy}","received_events_url":"https://api.github.com/users/tschaub/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-01-20T17:51:57Z","updated_at":"2015-01-20T20:09:39Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/eslint/eslint/pulls/1689","html_url":"https://github.com/eslint/eslint/pull/1689","diff_url":"https://github.com/eslint/eslint/pull/1689.diff","patch_url":"https://github.com/eslint/eslint/pull/1689.patch"},"body":"This adds an `allowPattern` option to the `dot-notation` rule for allowing exceptions to the rule.  If a string pattern is provided, it will be used to create a RegExp for testing property names.  In member expressions where the property name matches the `allowPattern`, bracket notation will be allowed.\r\n\r\nFor example, with this rule configuration:\r\n```js\r\n  \"rules\": {\r\n    \"dot-notation\": [2, {\"allowPattern\": \"^[a-z]+(_[a-z]+)+$\"}]\r\n  }\r\n```\r\n\r\nThe following would not be treated as an error:\r\n```js\r\nvar data = {};\r\ndata['foo_bar'] = 42;\r\n```\r\n\r\nWhile the following would be treated as an error:\r\n```js\r\nvar data = {};\r\ndata['fooBar'] = 42; // better written as data.fooBar\r\n```\r\n\r\nThe example above allows the `dot-notation` rule to be used in conjunction with the `camelcase` rule - allowing snake_case properties to be assigned with bracket notation (for example when generating data to be sent to an external service).\r\n\r\nFixes #1679.\r\n"},"comment":{"url":"https://api.github.com/repos/eslint/eslint/issues/comments/70723533","html_url":"https://github.com/eslint/eslint/pull/1689#issuecomment-70723533","issue_url":"https://api.github.com/repos/eslint/eslint/issues/1689","id":70723533,"user":{"login":"nzakas","id":38546,"avatar_url":"https://avatars.githubusercontent.com/u/38546?v=3","gravatar_id":"","url":"https://api.github.com/users/nzakas","html_url":"https://github.com/nzakas","followers_url":"https://api.github.com/users/nzakas/followers","following_url":"https://api.github.com/users/nzakas/following{/other_user}","gists_url":"https://api.github.com/users/nzakas/gists{/gist_id}","starred_url":"https://api.github.com/users/nzakas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nzakas/subscriptions","organizations_url":"https://api.github.com/users/nzakas/orgs","repos_url":"https://api.github.com/users/nzakas/repos","events_url":"https://api.github.com/users/nzakas/events{/privacy}","received_events_url":"https://api.github.com/users/nzakas/received_events","type":"User","site_admin":false},"created_at":"2015-01-20T20:09:39Z","updated_at":"2015-01-20T20:09:39Z","body":"This is a good start. Please take a moment to reformat your commit summary to be in this form: \"Update: desc (fixes #1679)\".\r\n\r\nAlso, you may want to take a moment to read our contribution guidelines:\r\nhttp://eslint.org/docs/developer-guide/contributing.html\r\n\r\nOur CLA is here: http://eslint.org/cla, which basically says you give us the right to use the code you create.\r\n\r\nThanks!"}}