{"action":"created","issue":{"url":"https://api.github.com/repos/eslint/eslint/issues/3779","labels_url":"https://api.github.com/repos/eslint/eslint/issues/3779/labels{/name}","comments_url":"https://api.github.com/repos/eslint/eslint/issues/3779/comments","events_url":"https://api.github.com/repos/eslint/eslint/issues/3779/events","html_url":"https://github.com/eslint/eslint/issues/3779","id":106192599,"number":3779,"title":"Feature request: Plugin hooks before reading/writing files","user":{"login":"platinumazure","id":284282,"avatar_url":"https://avatars.githubusercontent.com/u/284282?v=3","gravatar_id":"","url":"https://api.github.com/users/platinumazure","html_url":"https://github.com/platinumazure","followers_url":"https://api.github.com/users/platinumazure/followers","following_url":"https://api.github.com/users/platinumazure/following{/other_user}","gists_url":"https://api.github.com/users/platinumazure/gists{/gist_id}","starred_url":"https://api.github.com/users/platinumazure/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/platinumazure/subscriptions","organizations_url":"https://api.github.com/users/platinumazure/orgs","repos_url":"https://api.github.com/users/platinumazure/repos","events_url":"https://api.github.com/users/platinumazure/events{/privacy}","received_events_url":"https://api.github.com/users/platinumazure/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/eslint/eslint/labels/triage","name":"triage","color":"cc317c"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-09-13T00:41:07Z","updated_at":"2015-09-13T17:20:52Z","closed_at":null,"body":"Now that autofix is implemented with ESLint 1.4.0, I'm hugely excited to upgrade the ESLint at my work and start taking advantage of it. (Never mind that we're only on 0.19.0 at this point...)\r\n\r\nThe only problem: We're stuck using TFS at work for source control, which operates by rendering local source files read-only until \"checked out for edit\", at which point they become writable. What this means in practice is, if we want to use autofix, we would need to either preemptively check out every JavaScript file in case of a fix, or we would need to check out files that we know need fixes applied right before that happens.\r\n\r\nI'm certainly not proposing TFS integration here. What I instead would like to see is support for plugin hooks, maybe something like `beforeRead` and `beforeWrite`, which would be invoked on files which match the plugins' extensions right before linting/pre-processing (`beforeRead`) and right before fixing (`beforeWrite`). That way, I could write an `eslint-plugin-tfs` which would pass source code through as is, but which would be able to delegate to the shell or a TFS API to check out files right before autofixing.\r\n\r\nIn my particular use case, I would only need `beforeWrite`. I just mentioned `beforeRead` for completeness, though I imagine it would be rarely used.\r\n\r\nI'm game to try to implement this if needed, but I wanted to make sure this would even be accepted first (as well as make sure I have basically the right direction in mind)."},"comment":{"url":"https://api.github.com/repos/eslint/eslint/issues/comments/139896873","html_url":"https://github.com/eslint/eslint/issues/3779#issuecomment-139896873","issue_url":"https://api.github.com/repos/eslint/eslint/issues/3779","id":139896873,"user":{"login":"sindresorhus","id":170270,"avatar_url":"https://avatars.githubusercontent.com/u/170270?v=3","gravatar_id":"","url":"https://api.github.com/users/sindresorhus","html_url":"https://github.com/sindresorhus","followers_url":"https://api.github.com/users/sindresorhus/followers","following_url":"https://api.github.com/users/sindresorhus/following{/other_user}","gists_url":"https://api.github.com/users/sindresorhus/gists{/gist_id}","starred_url":"https://api.github.com/users/sindresorhus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sindresorhus/subscriptions","organizations_url":"https://api.github.com/users/sindresorhus/orgs","repos_url":"https://api.github.com/users/sindresorhus/repos","events_url":"https://api.github.com/users/sindresorhus/events{/privacy}","received_events_url":"https://api.github.com/users/sindresorhus/received_events","type":"User","site_admin":false},"created_at":"2015-09-13T17:20:52Z","updated_at":"2015-09-13T17:20:52Z","body":":-1: You're trying to fix the problem at the wrong level. This way you'll have to open a request on any tool that works on files. You should rather create a [custom FUSE fs](https://github.com/mafintosh/fuse-bindings) for TFS."}}