How to use the codesandbox-api.actions.correction function in codesandbox-api

To help you get started, we’ve selected a few codesandbox-api examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github codesandbox / codesandbox-client / packages / app / src / sandbox / eval / transpiled-module.ts View on Github external
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',
          })
        );
      });
    }
github codesandbox / codesandbox-client / src / sandbox / eval / transpiled-module.js View on Github external
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',
                })
              );
            });
          }
github codesandbox / codesandbox-client / packages / app / src / sandbox / eval / transpilers / worker-transpiler.ts View on Github external
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,
github codesandbox / codesandbox-client / packages / app / src / sandbox / eval / presets / vue-cli / index.js View on Github external
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',
                })
              );
            };
          }
github codesandbox / codesandbox-client / packages / app / src / app / components / CodeEditor / VSCode / index.tsx View on Github external
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
      );
    }
  };
github codesandbox / codesandbox-client / packages / app / src / app / components / CodeEditor / Monaco / index.js View on Github external
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,
                  })
                );
              });
            }
github codesandbox / codesandbox-client / packages / app / src / app / overmind / effects / vscode / Linter.ts View on Github external
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),
            })
          );
        });
github codesandbox / codesandbox-client / packages / app / src / app / components / CodeEditor / Monaco / index.js View on Github external
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,
                  })
                );
              });
            }
github codesandbox / codesandbox-client / packages / app / src / app / overmind / effects / vscode / Linter.ts View on Github external
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),
            })
          );
        });
      }
github codesandbox / codesandbox-client / packages / app / src / app / overmind / effects / vscode / ModelsHandler.ts View on Github external
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];
        }
      }
    );

codesandbox-api

[![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier) [![Greenkeeper badge](https://badges.greenkeeper.io/alexjoverm/typescript-library-starter.svg)](https://greenkeeper.io/) [![Travi

MIT
Latest version published 4 years ago

Package Health Score

73 / 100
Full package analysis

Similar packages