Last active
August 28, 2024 05:54
-
-
Save watson/453fc63cace521fcdadc to your computer and use it in GitHub Desktop.
Revisions
-
watson revised this gist
Aug 9, 2015 . 1 changed file with 6 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -38,6 +38,12 @@ Note that this is by no means foolproof as it will also convert the double quote find . -path ./node_modules -prune -o -type f -name '*.js' -exec sed -i '' -e 's/ *,/,/g' {} \; ``` **Ensure one a single space around equal signs:** ``` find . -path ./node_modules -prune -o -type f -name '*.js' -exec sed -i '' -e 's/ *= */ = /g' {} \; ``` **Remove space in front of colons:** ``` -
watson revised this gist
Jul 25, 2015 . 1 changed file with 7 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -32,12 +32,18 @@ find . -path ./node_modules -prune -o -type f -name '*.js' -exec sed -i '' -E -e Note that this is by no means foolproof as it will also convert the double quotes inside the string `'foo"bar'`! **Remove space in front of commas:** ``` find . -path ./node_modules -prune -o -type f -name '*.js' -exec sed -i '' -e 's/ *,/,/g' {} \; ``` **Remove space in front of colons:** ``` find . -path ./node_modules -prune -o -type f -name '*.js' -exec sed -i '' -e 's/ *:/:/g' {} \; ``` **Remove trailing line space:** ``` -
watson revised this gist
Jul 25, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -30,7 +30,7 @@ find . -path ./node_modules -prune -o -type f -name '*.js' -exec sed -i '' -E -e find . -path ./node_modules -prune -o -type f -name '*.js' -exec sed -i '' -E -e "s/\"/'/g" {} \; ``` Note that this is by no means foolproof as it will also convert the double quotes inside the string `'foo"bar'`! **Remove space in front of colons:** -
watson revised this gist
Jul 25, 2015 . 1 changed file with 4 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,5 @@ The [standard](https://github.com/feross/standard) code style linter is a great tool by Feross - check it out! **Remove trailing semicolons:** ``` @@ -24,12 +26,12 @@ find . -path ./node_modules -prune -o -type f -name '*.js' -exec sed -i '' -E -e **Use single quotes when defining strings:** ``` find . -path ./node_modules -prune -o -type f -name '*.js' -exec sed -i '' -E -e "s/\"/'/g" {} \; ``` Note that this is by no means not foolproof as it will also convert the double quotes in the string `'foo"bar'`! **Remove space in front of colons:** ``` -
watson created this gist
Jul 25, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,43 @@ **Remove trailing semicolons:** ``` find . -path ./node_modules -prune -o -type f -name '*.js' -exec sed -i '' -e 's/;$//' {} \; ``` **Ensure space between `function` and opening bracket:** ``` find . -path ./node_modules -prune -o -type f -name '*.js' -exec sed -i '' -e 's/function(/function (/g' {} \; ``` **Ensure space after colons in object literal:** ``` find . -path ./node_modules -prune -o -type f -name '*.js' -exec sed -i '' -E -e 's/:([^ ])/: \1/g' {} \; ``` **Ensure space after commas in object literal:** ``` find . -path ./node_modules -prune -o -type f -name '*.js' -exec sed -i '' -E -e 's/,([^ ])/, \1/g' {} \; ``` **Use single quotes when defining strings:** Note that this is by no means not foolprof as it will also convert the double quotes in the string `'foo"bar'`! ``` find . -path ./node_modules -prune -o -type f -name '*.js' -exec sed -i '' -E -e "s/\"/'/g" {} \; ``` **Remove space in front of colons:** ``` find . -path ./node_modules -prune -o -type f -name '*.js' -exec sed -i '' -e 's/ *,/,/g' {} \; ``` **Remove trailing line space:** ``` find . -path ./node_modules -prune -o -type f -name '*.js' -exec sed -i '' -e 's/ *$//' {} \; ```