diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml new file mode 100644 index 00000000..070cd982 --- /dev/null +++ b/.github/workflows/docs.yaml @@ -0,0 +1,25 @@ +name: "Format Docs" +on: + push: + tags: + - "[0-9]+.[0-9]+.[0-9]+" + - "[0-9]+.[0-9]+.[0-9]+-rc[0-9]+" + branches: [main] + # Path filters aren't evaluated for tags - https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#onpushpull_requestpull_request_targetpathspaths-ignore + paths: + - "**/*.md" + pull_request: + paths: + - "**/*.md" + workflow_dispatch: # Manually + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + - name: Install dependencies + run: npm install prettier + - name: Lint + run: npx prettier --check **/*.md diff --git a/.github/workflows/ui.yaml b/.github/workflows/ui.yaml index 33f3849e..32264bb3 100644 --- a/.github/workflows/ui.yaml +++ b/.github/workflows/ui.yaml @@ -40,7 +40,7 @@ jobs: - name: Install dependencies run: npm ci - name: Lint - run: npm run lint + run: npm run lint:code # test: # runs-on: ubuntu-latest # permissions: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index cb217906..b8f4cbbf 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -27,5 +27,5 @@ repos: rev: v2.7.1 hooks: - id: prettier - types_or: [css, javascript, json, yaml] + types_or: [css, javascript, json, yaml, markdown] exclude: .github/workflows/.*\.yaml diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 387e16f7..d49718f8 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -65,7 +65,8 @@ service is as simple as: ``` npm run vendor && npm run build -npm test +npm run lint +npm run format ``` ## Coding Style diff --git a/package.json b/package.json index b1ce4a61..426e6bd7 100644 --- a/package.json +++ b/package.json @@ -8,8 +8,13 @@ "build:assets": "mkdir -p build && cp -r src/unified_graphics/static/geo build/geo && cp src/unified_graphics/static/*icon.* build", "clean": "del build/", "test": "echo 'No tests' && exit 1", - "lint": "prettier --check --plugin-search-dir=. . && eslint . --ignore-pattern '**/*.min.js' --ignore-pattern '**/htmlcov/**' --ignore-pattern '**/vendor/*' && stylelint src/**/*.css", - "format": "prettier --write --plugin-search-dir=. . && stylelint --fix src/**/*.css", + "lint": "run-p lint:prettier:docs lint:prettier:code lint:eslint lint:css", + "lint:code": "run-p lint:prettier:code lint:eslint lint:css", + "lint:css": "stylelint src/**/*.css", + "lint:eslint": "eslint . --ignore-pattern '**/*.min.js' --ignore-pattern '**/htmlcov/**' --ignore-pattern '**/vendor/*'", + "lint:prettier:docs": "prettier --check '**/*.md'", + "lint:prettier:code": "prettier --check '.' '!**/*.md'", + "format": "prettier --write . && stylelint --fix src/**/*.css", "vendor": "run-p vendor:*", "vendor:lodash": "echo 'export * from \"lodash-es\"' | rollup --plugin @rollup/plugin-node-resolve --file src/unified_graphics/static/js/vendor/lodash.js --format es", "vendor:d3": "echo 'export * from \"d3\"' | rollup --plugin @rollup/plugin-node-resolve --file src/unified_graphics/static/js/vendor/d3.js --format es"