Skip to content

Commit

Permalink
Merge pull request #619 from crim-ca/pin-remark-lint
Browse files Browse the repository at this point in the history
  • Loading branch information
fmigneault authored Apr 29, 2024
2 parents 3cbe3ef + a4656da commit 60442fa
Show file tree
Hide file tree
Showing 7 changed files with 97 additions and 57 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ downloads
env

## Node
package.json
package-lock.json
node_modules

Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,14 @@ jobs:
if: ${{ matrix.test-case != 'test-docker' }}
# install package and dependencies directly,
# skip sys/conda setup to use active python
run: make install-sys install-pkg install-pip install-raw install-dev version
run: make install-sys install-pkg install-pip install-raw install-dev install-dev-npm
- name: Display Packages
# skip python setup if running with docker
if: ${{ matrix.test-case != 'test-docker' }}
run: pip freeze
run: |
pip freeze
npm list
make version
#- name: Setup Environment Variables
# uses: c-py/action-dotenv-to-setenv@v2
# with:
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ venv
environment.yml

## Node
package.json
package-lock.json
node_modules

Expand Down
24 changes: 0 additions & 24 deletions .remarkrc

This file was deleted.

12 changes: 0 additions & 12 deletions .stylelintrc.json

This file was deleted.

32 changes: 14 additions & 18 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -271,33 +271,29 @@ install-raw: ## install without any requirements or dependencies (suppose everyt

# install locally to ensure they can be found by config extending them
.PHONY: install-npm
install-npm: ## install npm package manager and dependencies if they cannot be found
install-npm: ## install npm package manager and dependencies if they cannot be found
@[ -f "$(shell which npm)" ] || ( \
echo "Binary package manager npm not found. Attempting to install it."; \
apt-get install npm \
)

.PHONY: install-npm-stylelint
install-npm-stylelint: install-npm ## install stylelint dependency for 'check-css' target using npm
@[ `npm ls 2>/dev/null | grep stylelint-config-standard | wc -l` = 1 ] || ( \
install-npm-stylelint: install-npm ## install stylelint dependency for 'check-css' target using npm
@[ `npm ls 2>/dev/null | grep stylelint-config-standard | grep -v UNMET | wc -l` = 1 ] || ( \
echo "Install required dependencies for CSS checks." && \
npm install "stylelint@<16" "stylelint-config-standard@<35" --save-dev \
npm install --save-dev \
)

.PHONY: install-npm-remarklint
install-npm-remarklint: install-npm ## install remark-lint dependency for 'check-md' target using npm
@[ `npm ls 2>/dev/null | grep remark-lint | wc -l` = 1 ] || ( \
install-npm-remarklint: install-npm ## install remark-lint dependency for 'check-md' target using npm
@[ `npm ls 2>/dev/null | grep remark-lint | grep -v UNMET | wc -l` = 1 ] || ( \
echo "Install required dependencies for Markdown checks." && \
npm install --save-dev \
remark-lint \
remark-gfm \
remark-cli \
remark-lint-maximum-line-length \
remark-lint-checkbox-content-indent \
remark-preset-lint-recommended \
remark-preset-lint-markdown-style-guide \
)

.PHONY: install-dev-npm
install-dev-npm: install-npm install-npm-remarklint install-npm-remarklint ## install all npm development dependencies

## -- Cleanup targets ----------------------------------------------------------------------------------------------- ##

.PHONY: clean
Expand Down Expand Up @@ -602,7 +598,7 @@ check-imports-only: mkdir-reports ## check imports ordering and styles
check-css-only: mkdir-reports ## check CSS linting
@echo "Running CSS style checks..."
@npx --no-install stylelint \
--config "$(APP_ROOT)/.stylelintrc.json" \
--config "$(APP_ROOT)/package.json" \
--output-file "$(REPORTS_DIR)/check-css.txt" \
"$(APP_ROOT)/**/*.css"

Expand All @@ -617,7 +613,7 @@ check-md-only: mkdir-reports ## check Markdown linting
--inspect --frail \
--silently-ignore \
--stdout --color \
--rc-path "$(APP_ROOT)/.remarkrc" \
--rc-path "$(APP_ROOT)/package.json" \
--ignore-path "$(APP_ROOT)/.remarkignore" \
"$(APP_ROOT)" "$(APP_ROOT)/.*/" \
> "$(REPORTS_DIR)/check-md.txt"
Expand Down Expand Up @@ -692,9 +688,9 @@ fix-fstring-only: mkdir-reports
.PHONY: fix-css-only
fix-css-only: mkdir-reports ## fix CSS linting problems automatically
@echo "Fixing CSS style problems..."
@npx stylelint \
@npx --no-install stylelint \
--fix \
--config "$(APP_ROOT)/.stylelintrc.json" \
--config "$(APP_ROOT)/package.json" \
--output-file "$(REPORTS_DIR)/fixed-css.txt" \
"$(APP_ROOT)/**/*.css"

Expand All @@ -708,7 +704,7 @@ fix-md-only: mkdir-reports ## fix Markdown linting problems automatically
@npx --no-install remark \
--output --frail \
--silently-ignore \
--rc-path "$(APP_ROOT)/.remarkrc" \
--rc-path "$(APP_ROOT)/package.json" \
--ignore-path "$(APP_ROOT)/.remarkignore" \
"$(APP_ROOT)" "$(APP_ROOT)/.*/" \
2>&1 | tee "$(REPORTS_DIR)/fixed-md.txt"
Expand Down
77 changes: 77 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
{
"devDependencies": {
"remark-cli": "^12.0.0",
"remark-frontmatter": "^5.0.0",
"remark-gfm": "^4.0.0",
"remark-lint": "^9.1.2",
"remark-lint-checkbox-content-indent": "^4.1.2",
"remark-lint-maximum-line-length": "^3.1.3",
"remark-preset-lint-markdown-style-guide": "^5.1.3",
"remark-preset-lint-recommended": "^6.1.3",
"stylelint": "^15.11.0",
"stylelint-config-standard": "^34.0.0",
"stylelint-scss": "^5.3.2",
"stylelint-csstree-validator": "^3.0.0"
},
"remarkConfig": {
"settings": {
"bullet": "-",
"fence": "`",
"fences": "true",
"listItemIndent": "mixed",
"incrementListMarker": "true",
"resourceLink": "true",
"rule": "-"
},
"plugins": [
"remark-gfm",
"remark-frontmatter",
"remark-preset-lint-markdown-style-guide",
"remark-preset-lint-recommended",
"remark-lint-list-item-content-indent",
"remark-lint-checkbox-content-indent",
[
"lint-fenced-code-marker",
"`"
],
[
"lint-list-item-indent",
"mixed"
],
[
"lint-maximum-line-length",
120
],
[
"lint-ordered-list-marker-style",
"."
],
[
"lint-ordered-list-marker-value",
"ordered"
],
[
"lint-unordered-list-marker-style",
"consistent"
]
]
},
"stylelint": {
"extends": "stylelint-config-standard",
"ignoreFiles": [
"docs/_build/**",
"docs/build/**"
],
"rules": {
"block-no-empty": null,
"color-no-invalid-hex": true,
"color-hex-case": "upper",
"color-hex-length": "long",
"indentation": [
4
],
"property-no-vendor-prefix": null,
"no-descending-specificity": null
}
}
}

0 comments on commit 60442fa

Please sign in to comment.