From fe4cc7b59f6b9a4451033b5d06a939e62212197d Mon Sep 17 00:00:00 2001 From: eight Date: Fri, 31 Aug 2018 23:17:42 +0800 Subject: [PATCH] Fix: logic to get correct linter --- edit/linter-stylelint.js | 6 ++++-- edit/source-editor.js | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/edit/linter-stylelint.js b/edit/linter-stylelint.js index a1bcfadf..1546515d 100644 --- a/edit/linter-stylelint.js +++ b/edit/linter-stylelint.js @@ -175,10 +175,12 @@ var stylelint = (() => { // eslint-disable-line no-var let preparing; linter.register((text, options, cm) => { - if (prefs.get('editor.linter') !== 'stylelint' && cm.getOption('mode') !== 'stylus') { + if ( + !prefs.get('editor.linter') || + cm.getOption('mode') === 'css' && prefs.get('editor.linter') !== 'stylelint' + ) { return; } - debugger; return prepareConfig() .then(() => editorWorker.stylelint(text, config)) .then(({results}) => { diff --git a/edit/source-editor.js b/edit/source-editor.js index dcc1a4f1..dd429883 100644 --- a/edit/source-editor.js +++ b/edit/source-editor.js @@ -109,7 +109,7 @@ function createSourceEditor(style) { function getCurrentLinter() { const name = prefs.get('editor.linter'); - if (cm.getOption('mode') === 'stylus' && name === 'csslint') { + if (cm.getOption('mode') !== 'css' && name === 'csslint') { return 'stylelint'; } return name;