Skip to content

Commit

Permalink
fix prettier task and add the lint and fix tasks; fix runs `e…
Browse files Browse the repository at this point in the history
…slint --fix` while the `lint` task runs `eslint` as-is.
  • Loading branch information
GerHobbelt committed Sep 19, 2018
1 parent 0ea4193 commit 498b1b0
Show file tree
Hide file tree
Showing 4 changed files with 903 additions and 10 deletions.
18 changes: 14 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ help:
@echo "make combine"
@echo " Run MathJax combiner, which combines the packed library source files"
@echo ""
@echo "make lint"
@echo "make fix"
@echo " Run ESLint on all sources. Execute 'make fix' task have ESLint auto-fix issues in the code."
@echo ""
@echo "make prettier"
@echo " Run MathJax prettifier, which pretty-prints the combined library files"
@echo ""
Expand All @@ -49,7 +53,7 @@ help:
all: config pack combine prettier

$(CUSTOM): default.cfg
@cp default.cfg $(CUSTOM);
@echo "Copy default.cfg to $(CUSTOM)"
@echo "Configuration file '$(CUSTOM)' created.";
@echo "Edit this file and run 'make config'.";
@exit 1
Expand All @@ -58,7 +62,7 @@ $(CUSTOM).pl: $(CUSTOM)
@echo "Creating Perl config file..."
@cp $(CUSTOM) $(CUSTOM).pl
@echo >> $(CUSTOM).pl # ensure that the config file ends by a new line
@echo "MFTRACE_PATH=`$(WHICH) $(MFTRACE)`" >> $(CUSTOM).pl
#@echo "MFTRACE_PATH=`$(WHICH) $(MFTRACE)`" >> $(CUSTOM).pl
@$(SED) -i "s|^\([A-Z_0-9]*\)=\(.*\)|$$\1='\2';|" $(CUSTOM).pl
@echo "1;" >> $(CUSTOM).pl

Expand All @@ -73,8 +77,14 @@ pack: config
combine: config
$(MAKE) -C combiner all

lint:
cd $(MATHJAXDIR)/mathjax/ ; eslint unpacked/

fix:
cd $(MATHJAXDIR)/mathjax/ ; eslint --fix unpacked/

prettier:
node globber/glob4prettier.js $(MATHJAXDIR)/mathjax/MathJax.js | xargs prettier --write --print-width 120
node globber/glob4prettier.js $(MATHJAXDIR)/mathjax/ | xargs prettier --write --print-width 120 --loglevel log

misc: operator-dictionary MML-entities

Expand All @@ -92,5 +102,5 @@ clean-destination: config
# this assumes MATHJAXDIR is a *relative path* for the perl tools in combiner and packer:
-rm -rf $(MATHJAXDIR)/mathjax/config/ $(MATHJAXDIR)/mathjax/localization/ $(MATHJAXDIR)/mathjax/extensions/ $(MATHJAXDIR)/mathjax/jax/

.PHONY: help fonts pack combine clean clean-destination prettier misc operator-dictionary MML-entities all
.PHONY: help lint fix fonts pack combine clean clean-destination prettier misc operator-dictionary MML-entities all

1 change: 1 addition & 0 deletions globber/glob4prettier.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ var options = {
nodir: true,
ignore: [
"latest.js",
"config/default.js",
"**/config.js",
"node_modules/**",
"unpacked/**",
Expand Down
Loading

0 comments on commit 498b1b0

Please sign in to comment.