From 2333364047a6def6b001461bfcfc6b658c92294b Mon Sep 17 00:00:00 2001 From: Thibault Kruse Date: Tue, 16 Aug 2016 00:46:13 +0200 Subject: [PATCH] Refactor remark plugin configuration into package.json, add link validation --- scripts/Makefile | 10 +++---- scripts/nodejs/package.json | 52 ++++++++++++++++++++++++++------- scripts/nodejs/remark/.remarkrc | 31 -------------------- 3 files changed, 47 insertions(+), 46 deletions(-) delete mode 100644 scripts/nodejs/remark/.remarkrc diff --git a/scripts/Makefile b/scripts/Makefile index 39c53c3..ce30ae7 100644 --- a/scripts/Makefile +++ b/scripts/Makefile @@ -36,16 +36,16 @@ distclean: #### check markdown -## run remark markdown checker based on configuration in .remarkrc +## run remark markdown checker based on configuration in package.json .PHONY: check-markdown -check-markdown: nodejs/node_modules/remark nodejs/remark/.remarkrc $(SOURCEPATH) $(BUILD_DIR) Makefile +check-markdown: nodejs/node_modules/remark nodejs/package.json $(SOURCEPATH) $(BUILD_DIR) Makefile ## run remark, paste output to temporary file - cd nodejs; ./node_modules/.bin/remark ../$(SOURCEPATH) --no-color -q --config-path ./remark/.remarkrc 1> ../$(BUILD_DIR)/$(SOURCEFILE).fixed --frail + cd nodejs; ./node_modules/.bin/remark ../$(SOURCEPATH) --no-color -q 1> ../$(BUILD_DIR)/$(SOURCEFILE).fixed --frail ## show a diff with changes remark suggests .PHONY: show-diff -show-diff: nodejs/node_modules/remark nodejs/remark/.remarkrc $(SOURCEPATH) $(BUILD_DIR) Makefile - cd nodejs; ./node_modules/.bin/remark ../$(SOURCEPATH) --no-color -q --config-path ./remark/.remarkrc 1> ../$(BUILD_DIR)/$(SOURCEFILE).fixed +show-diff: nodejs/node_modules/remark nodejs/package.json $(SOURCEPATH) $(BUILD_DIR) Makefile + cd nodejs; ./node_modules/.bin/remark ../$(SOURCEPATH) --no-color -q 1> ../$(BUILD_DIR)/$(SOURCEFILE).fixed ## compare temporary file to original, error and fail with message if differences exist diff $(SOURCEPATH) $(BUILD_DIR)/$(SOURCEFILE).fixed -u3 || \ (echo "Error: remark found bad markdown syntax, see output above" && false) diff --git a/scripts/nodejs/package.json b/scripts/nodejs/package.json index 133637b..0f94c26 100644 --- a/scripts/nodejs/package.json +++ b/scripts/nodejs/package.json @@ -1,12 +1,44 @@ { - "name": "CppCoreGuidelinesCheck", - "version": "0.0.0", - "description": "CppCoreGuidelines Check", - "private": true, - "dependencies": { - "remark": "^4.2.2", - "remark-lint": "^4.0.2", - "remark-lint-sentence-newline": "^2.0.0", - "remark-validate-links": "^4.1.0" - } + "name": "CppCoreGuidelinesCheck", + "version": "0.0.0", + "description": "CppCoreGuidelines Check", + "private": true, + "dependencies": { + "remark": "^4.2.2", + "remark-lint": "^4.0.2", + "remark-lint-sentence-newline": "^2.0.0", + "remark-validate-links": "^4.1.0", + "remark-lint-are-links-valid": "^1.0.2" + }, + "remarkConfig": { + "plugins": { + "remark-lint": { + "unordered-list-marker-style": "consistent", + "list-item-bullet-indent": false, + "list-item-indent": false, + "list-item-spacing": false, + "no-html": false, + "maximum-line-length": false, + "no-file-name-mixed-case": false, + "heading-increment": false, + "no-multiple-toplevel-headings": false, + "no-consecutive-blank-lines": false, + "maximum-line-length": 9000, + "maximum-heading-length": 300, + "no-heading-punctuation": false, + "no-duplicate-headings": false, + "emphasis-marker": "*", + "no-tabs": false, + "blockquote-indentation": false, + "strong-marker": "*", + "external": ["remark-lint-are-links-valid"] + } + }, + "settings": { + "bullet": "*", + "listItemIndent": "1", + "strong": "*", + "emphasis": "*" + } + } } diff --git a/scripts/nodejs/remark/.remarkrc b/scripts/nodejs/remark/.remarkrc deleted file mode 100644 index 48e13f4..0000000 --- a/scripts/nodejs/remark/.remarkrc +++ /dev/null @@ -1,31 +0,0 @@ -{ -"plugins": { - "remark-lint": { - "unordered-list-marker-style": "consistent", - "list-item-bullet-indent": false, - "list-item-indent": false, - "list-item-spacing": false, - "no-html": false, - "maximum-line-length": false, - "no-file-name-mixed-case": false, - "heading-increment": false, - "no-multiple-toplevel-headings": false, - "no-consecutive-blank-lines": false, - "maximum-line-length": 9000, - "maximum-heading-length": 300, - "no-heading-punctuation": false, - "no-duplicate-headings": false, - "emphasis-marker": "*", - "no-tabs": false, - "blockquote-indentation": false, - "strong-marker": "*" - } - }, - "settings": { - "bullet": "*", - "listItemIndent": "1", - "strong": "*", - "emphasis": "*" - } - -}