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;
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}) => {

View File

@ -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;