Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this.warnings.forEach(warning => {
console.warn(warning.message); // eslint-disable-line no-console
dispatch(
actions.correction.show(warning.message, {
line: warning.lineNumber,
column: warning.columnNumber,
path: warning.path,
source: warning.source,
severity: warning.severity || 'warning',
})
);
});
}
this.warnings.forEach(warning => {
console.warn(warning.message); // eslint-disable-line no-console
dispatch(
actions.correction.show(warning.message, {
line: warning.lineNumber,
column: warning.columnNumber,
path: warning.path,
source: warning.source,
severity: 'warning',
})
);
});
}
const { data } = newMessage;
if (data) {
if (data.type === 'error') {
const reconstructedError = parseWorkerError(data.error);
this.runCallbacks(callbacks, reconstructedError);
}
if (data.type === 'warning') {
loaderContext.emitWarning(data.warning);
return;
}
if (data.type === 'clear-warnings') {
dispatch(actions.correction.clear(data.path, data.source));
}
if (data.type === 'resolve-async-transpiled-module') {
// This one is to add an asynchronous transpiled module
const { id, path, options } = data;
try {
const tModule = await loaderContext.resolveTranspiledModuleAsync(
path,
options
);
worker.postMessage({
type: 'resolve-async-transpiled-module-response',
id,
found: true,
Vue.config.warnHandler = (msg, vm, trace) => {
console.error('[Vue warn]: ' + msg + trace);
const file = getFileNameFromVm(vm);
dispatch(
actions.correction.show(msg, {
line: 1,
column: 1,
path: file,
severity: 'warning',
source: 'Vue',
})
);
};
}
updateLintWarnings = async (markers: Array) => {
const currentModule = this.currentModule;
const mode = await getMode(currentModule.title, this.monaco);
if (mode === 'javascript' || mode === 'vue') {
dispatch(
actions.correction.show('Hello World', {
line: 1,
column: 1,
path: '/src/index.js',
source: 'eslint',
severity: 'warning',
})
);
this.monaco.editor.setModelMarkers(
this.editor.getActiveCodeEditor().getModel(),
'eslint',
markers
);
}
};
requestAnimationFrame(() => {
if (this.editor.getModel()) {
const modelPath = this.editor.getModel().uri.path;
dispatch(actions.correction.clear(modelPath, 'eslint'));
if (version === this.editor.getModel().getVersionId()) {
markers.forEach(marker => {
dispatch(
actions.correction.show(marker.message, {
line: marker.startLineNumber,
column: marker.startColumn,
lineEnd: marker.endLineNumber,
columnEnd: marker.endColumn,
source: 'eslint',
severity: marker.severity === 2 ? 'warning' : 'notice',
path: modelPath,
})
);
});
}
private onMessage = event => {
const { markers, version } = event.data;
const activeEditor = this.editor.getActiveCodeEditor();
if (activeEditor && activeEditor.getModel()) {
dispatch(
actions.correction.clear(getCurrentModelPath(this.editor), 'eslint')
);
if (version === activeEditor.getModel().getVersionId()) {
markers.forEach(marker => {
dispatch(
actions.correction.show(marker.message, {
line: marker.startLineNumber,
column: marker.startColumn,
lineEnd: marker.endLineNumber,
columnEnd: marker.endColumn,
source: 'eslint',
severity: marker.severity === 2 ? 'warning' : 'notice',
path: getCurrentModelPath(this.editor),
})
);
});
markers.forEach(marker => {
dispatch(
actions.correction.show(marker.message, {
line: marker.startLineNumber,
column: marker.startColumn,
lineEnd: marker.endLineNumber,
columnEnd: marker.endColumn,
source: 'eslint',
severity: marker.severity === 2 ? 'warning' : 'notice',
path: modelPath,
})
);
});
}
markers.forEach(marker => {
dispatch(
actions.correction.show(marker.message, {
line: marker.startLineNumber,
column: marker.startColumn,
lineEnd: marker.endLineNumber,
columnEnd: marker.endColumn,
source: 'eslint',
severity: marker.severity === 2 ? 'warning' : 'notice',
path: getCurrentModelPath(this.editor),
})
);
});
}
model => {
if (this.moduleModels[model.uri.path]) {
this.moduleModels[model.uri.path].changeListener.dispose();
const csbPath = model.uri.path.replace('/sandbox', '');
dispatch(actions.correction.clear(csbPath, 'eslint'));
delete this.moduleModels[model.uri.path];
}
}
);