Skip to content

Commit

Permalink
chore: minify delta
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeagle committed Jul 16, 2024
1 parent a5a3a52 commit 465d7e5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 31 deletions.
16 changes: 8 additions & 8 deletions example/lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -83,25 +83,25 @@ bazel build ${args[@]} $@
# TODO: Maybe this could be hermetic with bazel run @aspect_bazel_lib//tools:jq or sth
if [ $machine == "Windows" ]; then
# jq on windows outputs CRLF which breaks this script. https://github.com/jqlang/jq/issues/92
valid_outputs=$(jq --arg ext .txt --raw-output "$filter" "$buildevents" | tr -d '\r')
valid_reports=$(jq --arg ext .txt --raw-output "$filter" "$buildevents" | tr -d '\r')
else
valid_outputs=$(jq --arg ext .txt --raw-output "$filter" "$buildevents")
valid_reports=$(jq --arg ext .txt --raw-output "$filter" "$buildevents")
fi

# Show the results.
while IFS= read -r output; do
while IFS= read -r report; do
# Exclude coverage reports, and check if the output is empty.
if [[ "$output" == *coverage.dat ]] || [[ ! -s "$output" ]]; then
if [[ "$report" == *coverage.dat ]] || [[ ! -s "$report" ]]; then
# Report is empty. No linting errors.
continue
fi
echo "From ${output}:"
cat "${output}"
echo "From ${report}:"
cat "${report}"
echo
done <<<"$valid_outputs"
done <<<"$valid_reports"

if [ -n "$fix" ]; then
valid_patches=$valid_outputs
valid_patches=$valid_reports
while IFS= read -r patch; do
# Exclude coverage, and check if the patch is empty.
if [[ "$patch" == *coverage.dat ]] || [[ ! -s "$patch" ]]; then
Expand Down
24 changes: 1 addition & 23 deletions lint/eslint.bazel-formatter.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,7 @@
// Fork of 'compact' plugin that prints relative paths.
// This allows an editor to navigate to the location of the lint warning even though we present
// eslint with paths underneath a bazel sandbox folder.

/**
* Vendored from https://github.com/eslint/eslint/blob/331cf62024b6c7ad4067c14c593f116576c3c861/lib/cli-engine/formatters/compact.js
Copyright OpenJS Foundation and other contributors, <www.openjsf.org>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
// from https://github.com/eslint/eslint/blob/331cf62024b6c7ad4067c14c593f116576c3c861/lib/cli-engine/formatters/compact.js
const path = require("node:path");

/**
Expand Down

0 comments on commit 465d7e5

Please sign in to comment.