Skip to content

Commit

Permalink
adjust npm based linters
Browse files Browse the repository at this point in the history
  • Loading branch information
fmigneault committed Apr 27, 2024
1 parent 83fabe1 commit 0008328
Show file tree
Hide file tree
Showing 8 changed files with 182 additions and 50 deletions.
29 changes: 17 additions & 12 deletions .github/ISSUE_TEMPLATE/bug-report.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,35 @@
---
name: Bug Report
about: Create a report to help us improve
title: \[BUG\]
title: \[BUG]
labels: bug
assignees: fmigneault

---

**Describe the bug**
## Describe the bug

<!--
A clear and concise description of what the bug is.
-->

## To Reproduce

**To Reproduce**
Steps to reproduce the behavior:

1. Deploy process with payload '...'
2. Execute using payload '....'
3. Result '....'
4. Error message '...'

**Expected behavior**
## Expected behavior

<!--
A clear and concise description of what you expected to happen.
-->

**Screenshots**
If applicable, add screenshots to help explain your problem.
## Environment

**Desktop (please complete the following information):**
- OS: \[e.g. Linux|Windows\] (if running locally)
- Browser \[e.g. chrome, safari\] (if running as a service)
- Instance: URL
- Version \["1.2.3", see `/version` endpoint\]
- OS: \[e.g. Linux|Windows] (if running locally)
- Browser \[e.g. chrome, safari] (if running as a service)
- Instance: URL
- Version \["1.2.3", see `/version` endpoint]
28 changes: 19 additions & 9 deletions .github/ISSUE_TEMPLATE/feature-request.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,31 @@
---
name: Feature Request
about: Suggest an idea for this project
title: \[Feature\]
title: \[Feature]
labels: feature
assignees: fmigneault

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is.
Ex. I would like to be able to authenticate using \[...\]
## Describe the request

<!--
A clear and concise description of what the problem is.
-->

## Expected behavior

**Describe the solution you'd like**
A clear and concise description of what you want to happen.
<!--
A clear and concise description of what you expected to happen.
-->

**Describe alternatives you've considered**
## Alternatives considered

<!--
A clear and concise description of any alternative solutions or features you've considered.
-->

## Additional context

**Additional context**
<!--
Add any other context or screenshots about the feature request here.
-->
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ share

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

## Makefile
Expand Down
13 changes: 13 additions & 0 deletions .remarkignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# To save time scanning
.idea/
.vscode/
*.egg-info/
downloads/
env/

# actual items to ignore
.pytest_cache/
node_modules/
docs/_build/
docs/build/
reports/
13 changes: 0 additions & 13 deletions .stylelintrc.json

This file was deleted.

68 changes: 54 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -341,18 +341,24 @@ install-dev: conda-env install-xargs ## install package requirements for develop

# install locally to ensure they can be found by config extending them
.PHONY: install-npm
install-npm: ## install npm package manager if it 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 \
)
@[ `npm ls 2>/dev/null | grep stylelint-config-standard | wc -l` = 1 ] || ( \
echo "Install required libraries for style checks." && \

.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 | grep -v UNMET | wc -l` = 1 ] || ( \
echo "Install required dependencies for CSS checks." && \
npm install --save-dev \
stylelint \
stylelint-scss \
stylelint-config-standard \
stylelint-csstree-validator \
)

.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 | grep -v UNMET | wc -l` = 1 ] || ( \
echo "Install required dependencies for Markdown checks." && \
npm install --save-dev
)

## --- Launchers targets --- ##
Expand Down Expand Up @@ -512,7 +518,7 @@ mkdir-reports:
# autogen check variants with pre-install of dependencies using the '-only' target references
CHECKS_EXCLUDE ?=
CHECKS_PYTHON := pep8 lint security doc8 docf links imports types
CHECKS_NPM := css
CHECKS_NPM := css md
CHECKS_PYTHON := $(filter-out $(CHECKS_EXCLUDE),$(CHECKS_PYTHON))
CHECKS_NPM := $(filter-out $(CHECKS_EXCLUDE),$(CHECKS_NPM))
CHECKS := $(CHECKS_PYTHON) $(CHECKS_NPM)
Expand Down Expand Up @@ -606,15 +612,34 @@ check-types-only: mkdir-reports ## run typing validation
.PHONY: check-css-only
check-css-only: mkdir-reports
@echo "Running CSS style checks..."
@npx stylelint \
--config "$(APP_ROOT)/.stylelintrc.json" \
@npx --no-install stylelint \
--config "$(APP_ROOT)/package.json" \
--output-file "$(REPORTS_DIR)/fixed-css.txt" \
"$(APP_ROOT)/**/*.css"

.PHONY: check-css
check-css: install-npm-stylelint check-css-only ## check CSS linting after dependency installation

# must pass 2 search paths because '<dir>/.<subdir>' are somehow not correctly detected with only the top-level <dir>
.PHONY: check-md-only
check-md-only: mkdir-reports ## check Markdown linting
@echo "Running Markdown style checks..."
@npx --no-install remark \
--inspect --frail \
--silently-ignore \
--stdout --color \
--rc-path "$(APP_ROOT)/package.json" \
--ignore-path "$(APP_ROOT)/.remarkignore" \
"$(APP_ROOT)" "$(APP_ROOT)/.*/" \
> "$(REPORTS_DIR)/check-md.txt"

.PHONY: check-md
check-md: install-npm-remarklint check-md-only ## check Markdown linting after dependency installation

# autogen fix variants with pre-install of dependencies using the '-only' target references
FIXES_EXCLUDE ?=
FIXES_PYTHON := imports lint docf fstring
FIXES_NPM := css
FIXES_NPM := css md
FIXES_PYTHON := $(filter-out $(FIXES_EXCLUDE),$(FIXES_PYTHON))
FIXES_NPM := $(filter-out $(FIXES_EXCLUDE),$(FIXES_NPM))
FIXES := $(FIXES_PYTHON) $(FIXES_NPM)
Expand Down Expand Up @@ -672,17 +697,32 @@ fix-fstring-only: mkdir-reports ## fix code string formats substitutions to f-s
1> >(tee "$(REPORTS_DIR)/fixed-fstring.txt")'

.PHONY: fix-css
fix-css: install-npm fix-css-only
fix-css: install-npm-stylelint fix-css-only

.PHONY: fix-css-only
fix-css-only: mkdir-reports ## fix CSS styles 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"

# must pass 2 search paths because '<dir>/.<subdir>' are somehow not correctly detected with only the top-level <dir>
.PHONY: fix-md-only
fix-md-only: mkdir-reports ## fix Markdown linting problems automatically
@echo "Running Markdown style checks..."
@npx --no-install remark \
--output --frail \
--silently-ignore \
--rc-path "$(APP_ROOT)/package.json" \
--ignore-path "$(APP_ROOT)/.remarkignore" \
"$(APP_ROOT)" "$(APP_ROOT)/.*/" \
2>&1 | tee "$(REPORTS_DIR)/fixed-md.txt"

.PHONY: fix-md
fix-md: install-npm-remarklint fix-md-only ## fix Markdown linting problems after dependency installation

## --- Test targets --- ##

.PHONY: test
Expand Down
2 changes: 1 addition & 1 deletion docker/hooks/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Files placed in this directory are for additional/override DockerHub auto-build hook procedures.
see: https://docs.docker.com/docker-hub/builds/advanced/
see: [https://docs.docker.com/docker-hub/builds/advanced/](https://docs.docker.com/docker-hub/builds/advanced/)

Hook directory must be placed as sibling to the referenced Dockerfile location in the automated build configuration.
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 0008328

Please sign in to comment.