We don't want to run linters or formatters on the third-party code for
the driver.
We still want them on our "glue" code, hence we only exclude the
/src/ subdirectory.
Set the ESLINT_USE_FLAT_CONFIG=false environment variable when running ESLint. This is to workaround the following errors after ESLint got updated to 9.0.0:
Invalid option '--resolve-plugins-relative-to' - perhaps you meant '--ignore-pattern'?
You're using eslint.config.js, some command line flags are no longer available. Please see https://eslint.org/docs/latest/use/command-line-interface for details.
Also disable the `no-floating-promise` plugin since it starts
failing with the following error in ESLint 9.0.0:
TypeError: context.getScope is not a function
Install and enable ESLint's "no-floating-promise" plugin, to prevent
future bugs when an async function is forgotten to be awaited.
Also add a few awaits to silence the warnings, although in these places
"await" wasn't strictly necessary.
Change the users of the find-files-for-linting.py Python code
(eslient.py and format-code.py) to import it as a Python module rather
than run as a subprocess.
This should avoid unnecessary overhead and data conversions. The change
renames the file to "find_files_for_linting.py" as dashes in file names
aren't Python-friendly.
Add new parameter "--check-only" to the format-code.py script.
It's primarily intended to be used in automated checks, like CI actions,
for checking for improperly-formatted code.
Rewrite the format-code Shell script into Python, and make it support
"--base=..." argument.
The refactoring is for better maintainability, and the "--base" arg
allows reformatting the whole repository instead of the current diff.
Rewrite the eslint helper script into Python and add additional
features:
* --base=<gitref> to only consider files in the given git range,
* --fix to automatically apply fixes when possible.
This contributes to the effort tracked by #937.
find-files-for-linting.py ignores third-party code that we don't
maintain manually within this repository.
This contributes to the effort tracked by #937.
Let the caller specify whether all files need to be linted, or a
diff to a particular git ref needs to be considered.
This contributes to the effort tracked by #937.
Add helper script that runs the ESLint NPM module on all currently
modified JavaScript files.
This can be used manually by developers, and also follow-ups will
automatically execute it on every CI run, as tracked by #937.
Create a separate helper script for finding manually maintained source
files. Currently it's only used for running clang-format from
format-code.sh, but we're planning to add a similar script for JS
linting.
This contributes to the effort tracked by #937.
Add a script that parses llvm-cov's report table and prints the
resulting line coverage percentage for C/C++ code. Run it in the
Continuous Integration script and post the result as an autogenerated
comment on the Pull Request.