• Trent Apted's avatar
    Add a linter to the chromium-side of chrome://media-app · 1f34fdb9
    Trent Apted authored
    Linters are cool.
    
    PRESUBMIT.py is the one that was in ui/file_manager, but with the path
    adjusted so it can find `web_dev_style`.
    
    .eslintrc.js is the one from ui/webui but with
    
      'parserOptions': {
        'ecmaVersion': 2018,
        'sourceType': 'module',
      },
    
    added. This is needed to support `await` and spread syntax, and matches
    our closure typechecking flags.
    
    Note we also inherit the .eslintrc.js configuration in src/.eslintrc.js.
    
    
    Fixes were mostly achieved by
      ./third_party/node/linux/node-linux-x64/bin/node \
          third_party/node/node_modules/eslint/bin/eslint.js \
          chromeos/components/media_app_ui/{test,resources/{js,mock}} --fix
    
    
    The remaining bits were:
     -  document.getElementById is a restricted keyword. Recommendation is
    to use resources/js/util.js, but I'm not sure we need/want that
    dependency. Found a workaround (querySelector), but we might add that
    dependency in a follow-up. (Where we use getElementById is placeholder/
    experimental code currently).
     -  linter didn't like declaring a "namespace" like media_app. Changed
    to declare pageHandler directly.
     -  linter also couldn't automatically fix the `==` -> `===`.
    
    Bug: b/152284689
    Change-Id: Ib12765ade3cc5f3a9f46448ad8741eb3b8434737
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2119336Reviewed-by: default avatarPatti <patricialor@chromium.org>
    Commit-Queue: Trent Apted <tapted@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#753523}
    1f34fdb9
launch.js 6.34 KB