Skip to content

Commit

Permalink
test: apply eslint to .js files as well
Browse files Browse the repository at this point in the history
We want to lint all our JavaScript code, this would trip over
tools/webpack-make.js as it's a shell script. Ignorning it still gives
an eslint warning so this has to be converted to a proper JavaScript
file.
  • Loading branch information
jelly committed Oct 27, 2023
1 parent 0f31099 commit cbfb1a0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions test/static-code
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ set -eu
# note: `set -e` is not active during the tests.

find_scripts() {
# Helper to find all Python files in the tree
# Helper to find all scripts in the tree
(
# Any non-binary file which contains a python3 shebang
# Any non-binary file which contains a given shebang
git grep --cached -lIz '^#!.*'"$1"
# Any file ending in '.py'
# Any file ending in the provided regex
git ls-files -z "$2"
) | sort -z | uniq -z
}
Expand Down Expand Up @@ -69,7 +69,7 @@ test_js_translatable_strings() {
if [ "${WITH_PARTIAL_TREE:-0}" = 0 ]; then
test_eslint() {
test -x node_modules/.bin/eslint -a -x /usr/bin/node || skip 'no eslint'
find_scripts 'node' '*.js?' | xargs -0 node_modules/.bin/eslint
find_scripts 'node' '*.js' '*.js?' | xargs -0 node_modules/.bin/eslint
}
fi

Expand Down
6 changes: 3 additions & 3 deletions tools/webpack-make.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/sh
echo "This got renamed to ./build.js. Please see HACKING.md"
exit 1
#!/bin/env node
console.error("This got renamed to ./build.js. Please see HACKING.md");
process.exit(1);

0 comments on commit cbfb1a0

Please sign in to comment.