• 
      

    Fix linting in CodeMirror.

    Review Request #12854 — Created March 1, 2023 and submitted

    Information

    Review Board
    release-6.x

    Reviewers

    The updates for pulling in CodeMirror and other libraries from
    node_modules were a little bit incomplete, with the shipped copy of
    jsonlint not being 100% compatible with CodeMirror. Christian had begun
    to add an adapter to properly interface the parse method, but that file
    never made it. This was first apparent in a test failure with our
    bundles, but the "My Account" page wasn't doing linting correctly.

    I've added in the (missing) jsonlint/index.ts file, which re-exports
    jsonlint with a parse() method that's compatible with CodeMirror.

    Once we had the linter adapter in place, I noticed that even though
    linter errors were getting through to CodeMirror, they weren't showing
    up in the editor. The problem was that we had an older version of the
    CodeMirror CSS shipped inside our lib/css/ directory, and that didn't
    include the right rules for the linter gutter. Rather than just copy
    over the newer versions, I've changed it so we include node_modules in
    our include path, and added a new 3rdparty.less file that explicitly
    imports CSS from node_modules packages. This way when we update our
    dependencies, we'll pull in new CSS files automatically.

    • Opened the "My Account" page and saw that if I put in broken JSON for
      a custom API token, that I correctly saw the error icon in the linter
      gutter.
    • Ran tests in reviewboard/tests.py
    Summary ID
    Fix linting in CodeMirror.
    The updates for pulling in CodeMirror and other libraries from node_modules were a little bit incomplete, with the shipped copy of jsonlint not being 100% compatible with CodeMirror. Christian had begun to add an adapter to properly interface the parse method, but that file never made it. This was first apparent in a test failure with our bundles, but the "My Account" page wasn't doing linting correctly. I've added in the (missing) jsonlint/index.ts file, which re-exports jsonlint with a `parse()` method that's compatible with CodeMirror. Once we had the linter adapter in place, I noticed that even though linter errors were getting through to CodeMirror, they weren't showing up in the editor. The problem was that we had an older version of the CodeMirror CSS shipped inside our lib/css/ directory, and that didn't include the right rules for the linter gutter. Rather than just copy over the newer versions, I've changed it so we include node_modules in our include path, and added a new 3rdparty.less file that explicitly imports CSS from node_modules packages. This way when we update our dependencies, we'll pull in new CSS files automatically. Testing Done: - Opened the "My Account" page and saw that if I put in broken JSON for a custom API token, that I correctly saw the error icon in the linter gutter. - Ran tests in reviewboard/tests.py
    7aecab625947961510fbb2f3178dbe57c65bc3f9
    chipx86
    1. Awesome! Thank you for doing this :)

    2. 
        
    david
    Review request changed
    Status:
    Completed
    Change Summary:
    Pushed to release-6.x (67d58f9)