Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added better linting support inside of the sequence adaptation #1389

Merged
merged 2 commits into from
Jul 25, 2024

Conversation

cohansen
Copy link
Contributor

@cohansen cohansen commented Jul 18, 2024

This PR changes the sequence adaptation API in the following way to add linting to both the input and output format.
It also changes the diagnostics to now work as intended so that the adaptation can fully overwrite existing diagnostics rather than them always being appended.

   inputFormat: {
+   linter: globalThis.SequenceAdaptation?.INPUT_FORMAT?.LINTER ?? undefined,
   },
- lint: globalThis.SequenceAdaptation?.LINT ?? undefined,
   outputFormat: {
+   linter: globalThis.SequenceAdaptation?.OUTPUT_FORMAT?.LINTER ?? undefined,
   },

Here's a custom adaptation that you can fiddle with to test the input / output linting:

(() => {
  globalThis.SequenceAdaptation = {
    INPUT_FORMAT: {
      LINTER: inputLinter,
      NAME: "Input Format",
    },
    OUTPUT_FORMAT: {
      LINTER: outputLinter,
      NAME: "Output Format",
    },
  };
})();

function inputLinter(diagnostics, commandDictionary, view, node) {
  diagnostics.push({
    actions: [],
    from: 0,
    message: `This is a custom linting error that appears at 0,0`,
    severity: 'error',
    to: 0,
  });

  return diagnostics;
}

function outputLinter(diagnostics, commandDictionary, view, node) {
  // This is an example of overwriting all of the existing lint errors from native Aerie.
  diagnostics = [];

  return diagnostics;
}

@cohansen cohansen self-assigned this Jul 18, 2024
@cohansen cohansen requested a review from a team as a code owner July 18, 2024 20:47
@cohansen cohansen requested review from AaronPlave, duranb and joswig July 18, 2024 20:47
@mattdailis mattdailis added the sequencing Anything related to the sequencing domain label Jul 19, 2024
@cohansen cohansen force-pushed the feature/change-sequence-adaptation-linting branch from 6a7446c to 01fcf8d Compare July 25, 2024 15:35
Copy link
Collaborator

@duranb duranb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@cohansen cohansen merged commit dd26e67 into develop Jul 25, 2024
5 checks passed
@cohansen cohansen deleted the feature/change-sequence-adaptation-linting branch July 25, 2024 18:21
JosephVolosin pushed a commit that referenced this pull request Aug 20, 2024
* Added better linting support inside of the sequence adaptation

* Renamed SequenceAdaptationI and fixed a type in MODIFY_OUTPUT
JosephVolosin pushed a commit that referenced this pull request Oct 21, 2024
* Added better linting support inside of the sequence adaptation

* Renamed SequenceAdaptationI and fixed a type in MODIFY_OUTPUT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sequencing Anything related to the sequencing domain
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants