lint-clippy.mts 863 B

12345678910111213141516171819202122
  1. #!/usr/bin/env zx
  2. import 'zx/globals';
  3. import {
  4. getToolchainArgument,
  5. parseCliArguments,
  6. popArgument,
  7. } from '../helpers/utils.mts';
  8. // Extract the crate directory from the command-line arguments.
  9. const { manifestPath, args } = parseCliArguments();
  10. // Configure additional arguments here, e.g.:
  11. // ['--arg1', '--arg2', ...args]
  12. const clippyArgs = args;
  13. // Note: need to use nightly clippy as frozen-abi proc-macro generates
  14. // a lot of code (frozen-abi is enabled only under nightly due to the
  15. // use of unstable rust feature). Likewise, frozen-abi(-macro) crates'
  16. // unit tests are only compiled under nightly.
  17. const toolchain = getToolchainArgument('lint');
  18. // Check if the `--fix` argument is present.
  19. const fix = popArgument(clippyArgs, '--fix');
  20. await $`cargo ${toolchain} clippy --manifest-path ${manifestPath} ${fix ? '--fix' : ''} ${clippyArgs}`;