Skip to content
This repository was archived by the owner on Jul 19, 2023. It is now read-only.

Commit f187530

Browse files
committed
Use .gitignore to exclude files for linting
1 parent 7828caf commit f187530

File tree

3 files changed

+18
-14
lines changed

3 files changed

+18
-14
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ your **package.json** file than using this plugin.
1414

1515
<img src=https://raw.githubusercontent.com/center-key/gulp-w3c-html-validator/main/screenshot.png alt=screenshot>
1616

17-
## 1) Setup
17+
## A) Setup
1818
Install module into your project:
1919
```shell
2020
$ npm install --save-dev gulp-w3c-html-validator
2121
```
2222

23-
## 2) Define Task
23+
## B) Define Task
2424
Create a task in your **gulpfile.js**:
2525
```javascript
2626
// Imports
@@ -40,8 +40,8 @@ const task = {
4040
gulp.task('validate-html', task.validateHtml);
4141
```
4242

43-
## 3) Options
44-
### analyzer()
43+
## C) Options
44+
### 1. analyzer()
4545
| Name (key) | Type | Default | Description |
4646
| :--------------- | :---------------------- | :------------------------------- | :------------------------------------------------------------------- |
4747
| `checkUrl` | **string** | `'https://validator.w3.org/nu/'` | W3C validation API endpoint. |
@@ -63,13 +63,13 @@ const task = {
6363
};
6464
```
6565

66-
### reporter()
66+
### 2. reporter()
6767
| Name (key) | Type | Default | Description |
6868
| --------------- | ----------- | --------| ------------------------------------------------------------------------------------- |
6969
| `maxMessageLen` | **number** | `null` | Trim validation messages to not exceed a maximum length. |
7070
| `throwErrors` | **boolean** | `false` | Throw an [error](https://github.com/gulpjs/plugin-error) for HTTP validation failure. |
7171

72-
## 4) Custom Reporting
72+
## D) Custom Reporting
7373
The `analyzer()` adds the validation results onto each file object in the `w3cHtmlValidator` field,
7474
which contains a `validates` (**boolean**) field and a `messages` (**array**) field.
7575

package.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,11 @@
6969
},
7070
"scripts": {
7171
"step:01": "rimraf build dist **/.DS_Store",
72-
"step:02": "jshint . --exclude node_modules,build,dist",
72+
"step:02": "jshint . --exclude-path .gitignore",
7373
"step:03": "eslint --max-warnings 0 . --ext .ts",
7474
"step:04": "tsc",
7575
"step:05": "tsc --module UMD --outDir build/umd",
76-
"step:06": "cpy build/umd/html-validator.js build --rename=html-validator.umd.cjs --flat=true",
76+
"step:06": "copy-file build/umd/html-validator.js build/html-validator.umd.cjs",
7777
"step:07": "add-dist-header build dist",
7878
"pretest": "npm-run-all step:*",
7979
"test": "mocha spec --timeout 5000"
@@ -87,12 +87,13 @@
8787
"devDependencies": {
8888
"@types/node": "~18.7",
8989
"@types/through2": "~2.0",
90-
"@typescript-eslint/eslint-plugin": "~5.37",
91-
"@typescript-eslint/parser": "~5.37",
90+
"@typescript-eslint/eslint-plugin": "~5.38",
91+
"@typescript-eslint/parser": "~5.38",
9292
"add-dist-header": "~0.2",
9393
"assert-deep-strict-equal": "~1.0",
94-
"cpy-cli": "~4.2",
95-
"eslint": "~8.23",
94+
"copy-file-util": "~0.1",
95+
"copy-folder-cli": "~0.1",
96+
"eslint": "~8.24",
9697
"jshint": "~2.13",
9798
"mocha": "~10.0",
9899
"npm-run-all2": "~6.0",

task-runner.sh.command

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ setupTools() {
1515
echo $banner
1616
echo $(echo $banner | sed s/./=/g)
1717
pwd
18-
test -d .git && git pull --ff-only
18+
test -d .git || { echo "Project must be in a git repository."; exit; }
19+
git restore dist/* &>/dev/null
20+
git pull --ff-only
1921
echo
2022
echo "Node.js:"
2123
which node || { echo "Need to install Node.js: https://nodejs.org"; exit; }
@@ -32,9 +34,10 @@ releaseInstructions() {
3234
package=https://raw.githubusercontent.com/$repository/main/package.json
3335
version=v$(grep '"version"' package.json | awk -F'"' '{print $4}')
3436
pushed=v$(curl --silent $package | grep '"version":' | awk -F'"' '{print $4}')
37+
minorVersion=$(echo ${pushed:1} | awk -F"." '{ print $1 "." $2 }')
3538
released=$(git tag | tail -1)
3639
published=v$(npm view $repository version)
37-
minorVersion=$(echo ${pushed:1} | awk -F"." '{ print $1 "." $2 }')
40+
test $? -ne 0 && echo "NOTE: Ignore error if package is not yet published."
3841
echo "Local changes:"
3942
git status --short
4043
echo

0 commit comments

Comments
 (0)