Fix: logic to get correct linter

This commit is contained in:
eight 2018-08-31 23:17:42 +08:00
parent ed3ec6215c
commit fe4cc7b59f
2 changed files with 5 additions and 3 deletions

View File

@ -175,10 +175,12 @@ var stylelint = (() => { // eslint-disable-line no-var
let preparing; let preparing;
linter.register((text, options, cm) => { 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; return;
} }
debugger;
return prepareConfig() return prepareConfig()
.then(() => editorWorker.stylelint(text, config)) .then(() => editorWorker.stylelint(text, config))
.then(({results}) => { .then(({results}) => {

View File

@ -109,7 +109,7 @@ function createSourceEditor(style) {
function getCurrentLinter() { function getCurrentLinter() {
const name = prefs.get('editor.linter'); const name = prefs.get('editor.linter');
if (cm.getOption('mode') === 'stylus' && name === 'csslint') { if (cm.getOption('mode') !== 'css' && name === 'csslint') {
return 'stylelint'; return 'stylelint';
} }
return name; return name;