1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
|
#!/bin/bash
set -euo pipefail
ROOT=$(mktemp -d)
function finish {
rm -rf "$ROOT"
}
trap finish EXIT
REPO_PATH=$(pwd)
cd $ROOT
cat << EOF > index.html
<script>
console.log(1)
</script>
EOF
cat << EOF > .eslintrc.js
module.exports = {
plugins: ["html"],
rules: {
"no-console": "error",
},
}
EOF
cat << EOF | diff -u <(eslint --format compact index.html 2>&1) -
$(pwd)/index.html: line 2, col 1, Error - Unexpected console statement. (no-console)
1 problem
EOF
echo "All passed"
|