From f4cc3787941f882ef469bdd699802fb3f2a6eccf Mon Sep 17 00:00:00 2001 From: Vamshi Krishna Date: Thu, 21 Apr 2016 22:51:49 +0530 Subject: [PATCH] Fix: 'Fix on Save' should run only in valid file types(fixes #541) (#545) --- lib/main.js | 2 +- src/main.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/main.js b/lib/main.js index ede60809..1e26731e 100644 --- a/lib/main.js +++ b/lib/main.js @@ -93,7 +93,7 @@ module.exports = { })); this.subscriptions.add(atom.workspace.observeTextEditors(function (editor) { editor.onDidSave(function () { - if (atom.config.get('linter-eslint.fixOnSave')) { + if (_this.scopes.indexOf(editor.getGrammar().scopeName) !== -1 && atom.config.get('linter-eslint.fixOnSave')) { _this.worker.request('job', { type: 'fix', config: atom.config.get('linter-eslint'), diff --git a/src/main.js b/src/main.js index 7ad0d43e..6104973d 100644 --- a/src/main.js +++ b/src/main.js @@ -84,7 +84,8 @@ module.exports = { })) this.subscriptions.add(atom.workspace.observeTextEditors((editor) => { editor.onDidSave(() => { - if (atom.config.get('linter-eslint.fixOnSave')) { + if (this.scopes.indexOf(editor.getGrammar().scopeName) !== -1 && + atom.config.get('linter-eslint.fixOnSave')) { this.worker.request('job', { type: 'fix', config: atom.config.get('linter-eslint'),