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

Run yarn lint and prettier in CI #1674

Merged
merged 15 commits into from
Oct 14, 2024
Merged

Run yarn lint and prettier in CI #1674

merged 15 commits into from
Oct 14, 2024

Commits on Oct 14, 2024

  1. Run yarn lint in CI

    We’ve had some trouble with different people’s editors disagreeing about
    formatting, so I’d like to make our formatting checks in CI to have it
    consistent.
    
    I expect this to fail initially, but hopefully it won’t take much work
    to get it passing.
    emdash-ie committed Oct 14, 2024
    Configuration menu
    Copy the full SHA
    d68c49e View commit details
    Browse the repository at this point in the history
  2. Update @typescript-eslint/parser

    I was getting a warning that our version of typescript is too new for
    our version of this package: updating removes the warning.
    emdash-ie committed Oct 14, 2024
    Configuration menu
    Copy the full SHA
    7993d0d View commit details
    Browse the repository at this point in the history
  3. Replace tslint with typescript-eslint, updates

    TSLint is deprecated, and the suggested replacement is
    typescript-eslint.
    
    This commit also updates eslint, prettier, and eslint-plugin-prettier,
    and adds eslint-config-prettier.
    emdash-ie committed Oct 14, 2024
    Configuration menu
    Copy the full SHA
    72a455a View commit details
    Browse the repository at this point in the history
  4. Run prettier directly rather than via eslint

    Prettier’s docs [recommend it be run directly rather than via
    eslint](https://prettier.io/docs/en/integrating-with-linters.html), so
    this commit removes eslint-plugin-prettier and runs it directly within
    the lint scripts in package.json.
    emdash-ie committed Oct 14, 2024
    Configuration menu
    Copy the full SHA
    1629bf8 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    638aa48 View commit details
    Browse the repository at this point in the history
  6. Fix .prettierrc symlink in root

    I’m guessing the path to fronts-client was updated, and the symlink
    wasn’t.
    emdash-ie committed Oct 14, 2024
    Configuration menu
    Copy the full SHA
    74c3a12 View commit details
    Browse the repository at this point in the history
  7. Format everything with prettier

    To produce this diff, I ran `yarn lint-fix`.
    emdash-ie committed Oct 14, 2024
    Configuration menu
    Copy the full SHA
    309162a View commit details
    Browse the repository at this point in the history
  8. Update .editorconfig files to match prettier

    The @guardian/prettier config uses tabs for indentation, so this commit
    changes the .editorconfig files to match.
    
    (Since the .prettierrc is linked at the root, I think I need to update
    both .editorconfig files.)
    emdash-ie committed Oct 14, 2024
    Configuration menu
    Copy the full SHA
    01ed780 View commit details
    Browse the repository at this point in the history
  9. Format tables nicely in readme

    My editor has some auto-formatting that makes these tables much nicer to
    read in the markdown source: unless anyone objects I figure it’s an
    improvement?
    emdash-ie committed Oct 14, 2024
    Configuration menu
    Copy the full SHA
    701df3e View commit details
    Browse the repository at this point in the history
  10. Update readme

    - remove mentions of TSLint
    - recommend setting up editor integration for Prettier
    emdash-ie committed Oct 14, 2024
    Configuration menu
    Copy the full SHA
    4bc374d View commit details
    Browse the repository at this point in the history
  11. Steal isError from tslint

    Now that I’ve removed TSLint, this import is failing the build. To fix
    the build, this commit copies the definition of isError from my local
    node_modules.
    
    I took a look at #1277, which
    introduced this, and I didn’t see any explanation for this bit of code:
    it seems strange to import something from tslint (which is a dev
    dependency) for this, which makes me wonder if it was deliberate?
    
    Either way, I believe the check is necessary: I initially tried removing
    it, but that broke some tests.
    emdash-ie committed Oct 14, 2024
    Configuration menu
    Copy the full SHA
    cf98a63 View commit details
    Browse the repository at this point in the history
  12. Remove tslint comments

    Now that we’re not using TSLint, these comments aren’t doing anything.
    I’ll reintroduce the equivalents for eslint if they’re required.
    emdash-ie committed Oct 14, 2024
    Configuration menu
    Copy the full SHA
    5e05d71 View commit details
    Browse the repository at this point in the history
  13. Add formatting commit to .git-blame-ignore-revs

    In a recent commit I ran prettier to format the code, which produced a
    very big diff. This diff can get in the way of blaming with git, so Iʼve
    recorded the commit ref in .git-blame-ignore-revs, which facilitates
    telling git (using the config option blame.ignoreRevsFile) to ignore the
    commit when blaming. (Iʼll add this config to the setup script shortly.)
    emdash-ie committed Oct 14, 2024
    Configuration menu
    Copy the full SHA
    f1aa439 View commit details
    Browse the repository at this point in the history
  14. Configure git to use .git-blame-ignore-revs

    This change configures git to ignore the commits listed in
    .git-blame-ignore-revs when blaming, which prevents formatting commits
    from obscuring more meaningful blame info.
    emdash-ie committed Oct 14, 2024
    Configuration menu
    Copy the full SHA
    8f4af68 View commit details
    Browse the repository at this point in the history
  15. Apply eslint suggestion: single quotes

    While I see it, this was being flagged by eslint as a non-breaking
    warning: might as well follow the suggestion to silence the warning.
    emdash-ie committed Oct 14, 2024
    Configuration menu
    Copy the full SHA
    1bd8e9b View commit details
    Browse the repository at this point in the history