diff --git a/lib/main.js b/lib/main.js index 3c738020..41f69d9a 100644 --- a/lib/main.js +++ b/lib/main.js @@ -33,6 +33,7 @@ module.exports = { // Add the current scopes Array.prototype.push.apply(_this.scopes, scopes); })); + var embeddedScope = 'source.js.embedded.html'; this.subscriptions.add(atom.config.observe('linter-eslint.lintHtmlFiles', function (lintHtmlFiles) { if (lintHtmlFiles) { @@ -41,6 +42,7 @@ module.exports = { _this.scopes.splice(_this.scopes.indexOf(embeddedScope), 1); } })); + this.subscriptions.add(atom.workspace.observeTextEditors(function (editor) { editor.onDidSave(function () { if (_this.scopes.indexOf(editor.getGrammar().scopeName) !== -1 && atom.config.get('linter-eslint.fixOnSave')) { @@ -54,6 +56,7 @@ module.exports = { } }); })); + this.subscriptions.add(atom.commands.add('atom-text-editor', { 'linter-eslint:fix-file': function linterEslintFixFile() { var textEditor = atom.workspace.getActiveTextEditor(); diff --git a/lib/worker.js b/lib/worker.js index 8f842880..26534dcc 100644 --- a/lib/worker.js +++ b/lib/worker.js @@ -39,6 +39,7 @@ function lintJob(argv, contents, eslint, configPath, config) { return !ignoredMessages.includes(e.message); }); } + function fixJob(argv, eslint) { try { eslint.execute(argv); diff --git a/spec/.eslintrc b/spec/.eslintrc deleted file mode 100644 index 52414395..00000000 --- a/spec/.eslintrc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "env": { - "jasmine": true, - "atomtest": true - } -} diff --git a/spec/.eslintrc.js b/spec/.eslintrc.js new file mode 100644 index 00000000..6c640eeb --- /dev/null +++ b/spec/.eslintrc.js @@ -0,0 +1,6 @@ +module.exports = { + env: { + jasmine: true, + atomtest: true + } +} diff --git a/src/main.js b/src/main.js index c4dafafb..d825bc23 100644 --- a/src/main.js +++ b/src/main.js @@ -22,6 +22,7 @@ module.exports = { // Add the current scopes Array.prototype.push.apply(this.scopes, scopes) })) + const embeddedScope = 'source.js.embedded.html' this.subscriptions.add(atom.config.observe('linter-eslint.lintHtmlFiles', (lintHtmlFiles) => { if (lintHtmlFiles) { @@ -30,6 +31,7 @@ module.exports = { this.scopes.splice(this.scopes.indexOf(embeddedScope), 1) } })) + this.subscriptions.add(atom.workspace.observeTextEditors((editor) => { editor.onDidSave(() => { if (this.scopes.indexOf(editor.getGrammar().scopeName) !== -1 && @@ -44,6 +46,7 @@ module.exports = { } }) })) + this.subscriptions.add(atom.commands.add('atom-text-editor', { 'linter-eslint:fix-file': () => { const textEditor = atom.workspace.getActiveTextEditor() diff --git a/src/worker.js b/src/worker.js index b049c3c8..d63811e1 100644 --- a/src/worker.js +++ b/src/worker.js @@ -30,6 +30,7 @@ function lintJob(argv, contents, eslint, configPath, config) { return global.__LINTER_ESLINT_RESPONSE .filter(e => !ignoredMessages.includes(e.message)) } + function fixJob(argv, eslint) { try { eslint.execute(argv)