Replace try/catch with tryJSONparse
This commit is contained in:
parent
fefb8f332c
commit
b89fb440f7
|
@ -207,13 +207,14 @@ function showLintHelp() {
|
||||||
function setupStylelintSettingsEvents() {
|
function setupStylelintSettingsEvents() {
|
||||||
let timer;
|
let timer;
|
||||||
$('#help-popup .save').addEventListener('click', () => {
|
$('#help-popup .save').addEventListener('click', () => {
|
||||||
try {
|
const json = tryJSONparse($('#help-popup textarea').value);
|
||||||
setStylelintRules(JSON.parse($('#help-popup textarea').value).rules);
|
if (json && json.rules) {
|
||||||
|
setStylelintRules(json.rules);
|
||||||
// it is possible to have stylelint rules popup open & switch to csslint
|
// it is possible to have stylelint rules popup open & switch to csslint
|
||||||
if (prefs.get('editor.linter') === 'stylelint') {
|
if (prefs.get('editor.linter') === 'stylelint') {
|
||||||
updateLinter('stylelint');
|
updateLinter('stylelint');
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} else {
|
||||||
$('#help-popup .error').classList.add('show');
|
$('#help-popup .error').classList.add('show');
|
||||||
clearTimeout(timer);
|
clearTimeout(timer);
|
||||||
timer = setTimeout(() => {
|
timer = setTimeout(() => {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user