{"action":"opened","issue":{"url":"https://api.github.com/repos/eslint/eslint/issues/10484","repository_url":"https://api.github.com/repos/eslint/eslint","labels_url":"https://api.github.com/repos/eslint/eslint/issues/10484/labels{/name}","comments_url":"https://api.github.com/repos/eslint/eslint/issues/10484/comments","events_url":"https://api.github.com/repos/eslint/eslint/issues/10484/events","html_url":"https://github.com/eslint/eslint/issues/10484","id":332992546,"node_id":"MDU6SXNzdWUzMzI5OTI1NDY=","number":10484,"title":"Add the possibility to ignore some constructors in no-new","user":{"login":"leipert","id":2906107,"node_id":"MDQ6VXNlcjI5MDYxMDc=","avatar_url":"https://avatars3.githubusercontent.com/u/2906107?v=4","gravatar_id":"","url":"https://api.github.com/users/leipert","html_url":"https://github.com/leipert","followers_url":"https://api.github.com/users/leipert/followers","following_url":"https://api.github.com/users/leipert/following{/other_user}","gists_url":"https://api.github.com/users/leipert/gists{/gist_id}","starred_url":"https://api.github.com/users/leipert/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leipert/subscriptions","organizations_url":"https://api.github.com/users/leipert/orgs","repos_url":"https://api.github.com/users/leipert/repos","events_url":"https://api.github.com/users/leipert/events{/privacy}","received_events_url":"https://api.github.com/users/leipert/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-06-16T14:57:40Z","updated_at":"2018-06-16T14:57:40Z","closed_at":null,"author_association":"NONE","body":"**What rule do you want to change?**\r\n\r\n`no-new`\r\n\r\n**Does this change cause the rule to produce more or fewer warnings?**\r\n\r\n- fewer\r\n\r\n**How will the change be implemented? (New option, new default behavior, etc.)?**\r\n\r\n- By default all side-effect usages of `new` will be reported, like now\r\n- You have the possibility to add constructors to an option, which will then be allowed. \r\n\r\nLike: \r\n```yml\r\nno-new:\r\n  - error\r\n  - ignore:\r\n      - Vue\r\n```\r\n\r\n**Please provide some example code that this change will affect:**\r\n\r\nWe often initialize Vue components with this pattern:\r\n\r\n```js\r\nimport Component from './components/component';\r\n\r\ndocument.addEventListener('DOMContentLoaded', () => {\r\n  const element = document.getElementById('id');\r\n  new Vue({\r\n    el: element,\r\n    components: {\r\n      Component,\r\n    },\r\n    render(createElement) {\r\n      return createElement('component', {\r\n        props: { ...element.dataset },\r\n      });\r\n    },\r\n   })\r\n})\r\n```\r\n\r\nSee our open issues here:\r\n- https://gitlab.com/gitlab-org/gitlab-ce/issues/42783 \r\n- https://gitlab.com/gitlab-org/gitlab-ce/issues/42306\r\n\r\n**What does the rule currently do for this code?**\r\n\r\nThrow an error. There are several workarounds for this, that are not nice:\r\n1. add `eslint-disable`, this really adds up if you have a lot of components.\r\n2. return the result of `new Vue` in the function, but this makes no sense, as no function caller is actually using it\r\n\r\n**What will the rule do after it's changed?**\r\n\r\nThrow no new error.\r\n"}}
{"actor":{"display_login":"leipert"}}