Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,9 @@ jobs:
- run:
name: Test plotly bundles againt unexpected characters
command: npm run no-bad-char
- run:
name: Display function constructors in plotly.js bundle
command: npm run log-new-func
- run:
name: Test certain bundles against function constructors
command: npm run no-new-func
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"watch": "node tasks/watch.js",
"lint": "eslint --version && eslint .",
"lint-fix": "eslint . --fix || true",
"log-new-func": "eslint --no-ignore --no-eslintrc --no-inline-config --rule '{no-new-func: error}' dist/plotly.js 2>&1 | ./tasks/show_eval_lines.sh",
"no-new-func": "eslint --no-ignore --no-eslintrc --no-inline-config --rule '{no-new-func: error}' $(find dist -type f -iname '*.js' | grep -v plotly-gl* | grep -v plotly-with-meta.* | grep -v plotly.js | grep -v plotly.min.js)",
"no-bad-char": "eslint --no-ignore --no-eslintrc --no-inline-config --rule '{no-misleading-character-class: error}' $(find dist -type f -iname '*.js' | grep plotly)",
"no-dup-keys": "eslint --no-ignore --no-eslintrc --no-inline-config --rule '{no-dupe-keys: error}' $(find dist -type f -iname '*.js' | grep plotly)",
Expand Down
26 changes: 26 additions & 0 deletions tasks/show_eval_lines.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#! /bin/bash
err=0
src=""
while IFS= read -r str
do
if [[ "$str" == *"plotly.js/dist"* ]]; then
src="$str"
fi

if [[ "$str" == *"error The Function constructor is eval no-new-func"* ]]; then
str=${str%error*}
col=${str#*:}
row=${str%:*}
pre=$((row-10))
err=$((err+1))
echo "________________________________________________________________________________"
sed -n "${pre},${row}p" "$src"

for ((i = 0 ; i <= col + 10 ; i++)); do
echo -n "^"
done
echo

echo "Count: $err | Line: $row"
fi
done