Skip to content

Commit

Permalink
# v2023.10.24
Browse files Browse the repository at this point in the history
- jslint - bugfix - Update file jslint_wrapper_vim.vim to fix broken vim-link when linting shell-files.
- ci - add custom-shell-ci hooks to script jslint_ci.sh:
    shCiPublishNpmCustom()
    shCiPublishPypiCustom()
  • Loading branch information
kaizhu256 committed Oct 27, 2023
1 parent 2b7073d commit 825a0da
Show file tree
Hide file tree
Showing 11 changed files with 98 additions and 59 deletions.
4 changes: 2 additions & 2 deletions .ci.sh
Expand Up @@ -280,7 +280,7 @@ import moduleFs from "fs";
npm run test
)}

shCiNpmPublishCustom() {(set -e
shCiPublishNpmCustom() {(set -e
# this function will run custom-code to npm-publish package
npm publish --access public
)}
Expand Down Expand Up @@ -441,7 +441,7 @@ import moduleFs from "fs";
"type": "git",
"url": "https://github.com/jslint-org/jslint.git"
},
"version": "2023.8.20"
"version": "2023.10.24"
}, undefined, 4)
}
].map(async function ({
Expand Down
16 changes: 9 additions & 7 deletions .github/workflows/ci.yml
Expand Up @@ -22,9 +22,9 @@ jobs:
- x64
# - x86
node_version:
- 16
- 18
- 20
# - 22
python_version:
- "3.10"
os:
Expand All @@ -38,9 +38,9 @@ jobs:
v${{ matrix.node_version }}
${{ matrix.architecture }}
${{ matrix.os }}
CI_MATRIX_NAME_MAIN: "node v18 x64 ubuntu-latest"
CI_MATRIX_NAME_MAIN: "node v20 x64 ubuntu-latest"
CI_MATRIX_NODE_VERSION: v${{ matrix.node_version }}
CI_MATRIX_NODE_VERSION_MAIN: v18
CI_MATRIX_NODE_VERSION_MAIN: v20
CI_WORKFLOW_NAME: >
${{ github.workflow }}
- ${{ github.event_name }}
Expand All @@ -53,11 +53,13 @@ jobs:
${{ matrix.os }}
runs-on: ${{ matrix.os }}
steps:
- run: echo "$(date -u +"%Y-%m-%d %TZ") - ${{ env.CI_WORKFLOW_NAME }}" # "
# disable autocrlf in windows
- run: git config --global core.autocrlf false
- run: |
sh -c uname
echo "$(date -u +"%Y-%m-%d %TZ") - ${{ env.CI_WORKFLOW_NAME }}" # "
git config --global core.autocrlf false
# https://github.com/actions/checkout
- uses: actions/checkout@v3
- uses: actions/checkout@v4
# fetch jslint_ci.sh from trusted source
- run: |
git fetch origin alpha --depth=1
Expand All @@ -66,7 +68,7 @@ jobs:
# pre-run .ci.sh
- run: sh jslint_ci.sh shCiPre
# https://github.com/actions/setup-node
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
architecture: ${{ matrix.architecture }}
node-version: ${{ matrix.node_version }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/on_pull_request.yml
Expand Up @@ -14,9 +14,9 @@ jobs:
- x64
# - x86
node_version:
- 16
- 18
- 20
# - 22
os:
- macos-latest
- ubuntu-latest
Expand All @@ -28,9 +28,9 @@ jobs:
v${{ matrix.node_version }}
${{ matrix.architecture }}
${{ matrix.os }}
CI_MATRIX_NAME_MAIN: "node v18 x64 ubuntu-latest"
CI_MATRIX_NAME_MAIN: "node v20 x64 ubuntu-latest"
CI_MATRIX_NODE_VERSION: v${{ matrix.node_version }}
CI_MATRIX_NODE_VERSION_MAIN: v18
CI_MATRIX_NODE_VERSION_MAIN: v20
CI_WORKFLOW_NAME: >
${{ github.workflow }}
- ${{ github.event_name }}
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/publish.yml
Expand Up @@ -17,9 +17,9 @@ jobs:
- x64
# - x86
node_version:
# - 16
- 18
# - 20
# - 18
- 20
# - 22
os:
# - macos-latest
- ubuntu-latest
Expand All @@ -38,30 +38,30 @@ jobs:

# Setup .npmrc file to publish to GitHub Packages
- run: rm -f /home/runner/work/_temp/.npmrc
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node_version }}
architecture: ${{ matrix.architecture }}
registry-url: 'https://npm.pkg.github.com'
# Defaults to the user or organization that owns the workflow file
# scope: '@octocat'
# Publish to GitHub Packages
- run: sh jslint_ci.sh shCiNpmPublish
- run: sh jslint_ci.sh shCiPublishNpm
env:
NODE_AUTH_TOKEN: ${{ secrets.MY_GITHUB_TOKEN }}
NPM_REGISTRY: github

# Setup .npmrc file to publish to npm
- run: rm -f /home/runner/work/_temp/.npmrc
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node_version }}
architecture: ${{ matrix.architecture }}
registry-url: 'https://registry.npmjs.org'
# Publish to npm
- run: sh jslint_ci.sh shCiNpmPublish
- run: sh jslint_ci.sh shCiPublishNpm
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_REGISTRY: npm
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -22,6 +22,7 @@ package-lock.json
*.py[cod]
dist/
htmlcov/
wheelhouse/

# vscode
*.vsix
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Expand Up @@ -7,6 +7,12 @@
- jslint - add new warning requiring paren around plus-separated concatenations.
- jslint - try to improve parser to be able to parse jquery.js without stopping.

# v2023.10.24
- jslint - bugfix - Update file jslint_wrapper_vim.vim to fix broken vim-link when linting shell-files.
- ci - add custom-shell-ci hooks to script jslint_ci.sh:
shCiPublishNpmCustom()
shCiPublishPypiCustom()

# v2023.8.20
- ci - Remove ci for nodejs-v19, and add ci for nodejs-v20.
- ci - Remove broken-links to unlicense.org, failing http-link-check.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -3,7 +3,7 @@ Douglas Crockford <douglas@crockford.com>


# Status
| Branch | [master<br>(v2023.8.20)](https://github.com/jslint-org/jslint/tree/master) | [beta<br>(Web Demo)](https://github.com/jslint-org/jslint/tree/beta) | [alpha<br>(Development)](https://github.com/jslint-org/jslint/tree/alpha) |
| Branch | [master<br>(v2023.10.24)](https://github.com/jslint-org/jslint/tree/master) | [beta<br>(Web Demo)](https://github.com/jslint-org/jslint/tree/beta) | [alpha<br>(Development)](https://github.com/jslint-org/jslint/tree/alpha) |
|--:|:--:|:--:|:--:|
| CI | [![ci](https://github.com/jslint-org/jslint/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/jslint-org/jslint/actions?query=branch%3Amaster) | [![ci](https://github.com/jslint-org/jslint/actions/workflows/ci.yml/badge.svg?branch=beta)](https://github.com/jslint-org/jslint/actions?query=branch%3Abeta) | [![ci](https://github.com/jslint-org/jslint/actions/workflows/ci.yml/badge.svg?branch=alpha)](https://github.com/jslint-org/jslint/actions?query=branch%3Aalpha) |
| Coverage | [![coverage](https://jslint-org.github.io/jslint/branch-master/.artifact/coverage/coverage_badge.svg)](https://jslint-org.github.io/jslint/branch-master/.artifact/coverage/index.html) | [![coverage](https://jslint-org.github.io/jslint/branch-beta/.artifact/coverage/coverage_badge.svg)](https://jslint-org.github.io/jslint/branch-beta/.artifact/coverage/index.html) | [![coverage](https://jslint-org.github.io/jslint/branch-alpha/.artifact/coverage/coverage_badge.svg)](https://jslint-org.github.io/jslint/branch-alpha/.artifact/coverage/index.html) |
Expand Down
4 changes: 2 additions & 2 deletions jslint.mjs
Expand Up @@ -163,7 +163,7 @@ let jslint_charset_ascii = (
+ "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_"
+ "`abcdefghijklmnopqrstuvwxyz{|}~\u007f"
);
let jslint_edition = "v2023.8.20";
let jslint_edition = "v2023.10.24";
let jslint_export; // The jslint object to be exported.
let jslint_fudge = 1; // Fudge starting line and starting
// ... column to 1.
Expand Down Expand Up @@ -279,7 +279,7 @@ async function assertErrorThrownAsync(asyncFunc, regexp) {
}
assertOrThrow(err, "No error thrown.");
assertOrThrow(
regexp === undefined || new RegExp(regexp).test(err.message),
!regexp || new RegExp(regexp).test(err.message),
err
);
}
Expand Down
90 changes: 59 additions & 31 deletions jslint_ci.sh
Expand Up @@ -423,7 +423,7 @@ shCiBase() {(set -e
# # this function will run custom-code for base-ci
# return
# )}
# shCiLintCustom2() {(set -e
# shCiLintCustom() {(set -e
# # this function will run custom-code to lint files
# )}
export GITHUB_BRANCH0="$(git rev-parse --abbrev-ref HEAD)"
Expand All @@ -441,6 +441,7 @@ globalThis.assert(
if [ "$(git branch --show-current)" = alpha ]
then
node --input-type=module --eval '
import moduleChildProcess from "child_process";
import moduleFs from "fs";
(async function () {
let fileDict = {};
Expand Down Expand Up @@ -501,7 +502,13 @@ import moduleFs from "fs";
}
}));
if (fileModified) {
throw new Error("modified file " + fileModified);
moduleChildProcess.spawn(
"git",
["diff"],
{stdio: ["ignore", 1, 2]}
).on("exit", function () {
throw new Error("modified file " + fileModified);
});
}
}());
' "$@" # '
Expand Down Expand Up @@ -585,14 +592,35 @@ shCiMatrixIsmainNodeversion() {(set -e
&& [ "$CI_MATRIX_NODE_VERSION" = "$CI_MATRIX_NODE_VERSION_MAIN" ]
)}

shCiNpmPublish() {(set -e
# this function will npm-publish package
# shCiNpmPublishCustom() {(set -e
shCiPre() {(set -e
# this function will run pre-ci
# shCiPreCustom() {(set -e
# # this function will run custom-code for pre-ci
# return
# )}
if [ -f ./myci2.sh ]
then
. ./myci2.sh :
shMyciInit
fi
if (command -v shCiPreCustom >/dev/null)
then
shCiPreCustom
fi
if (command -v shCiPreCustom2 >/dev/null)
then
shCiPreCustom2
fi
)}

shCiPublishNpm() {(set -e
# this function will publish npm-package
# shCiPublishNpmCustom() {(set -e
# # this function will run custom-code to npm-publish package
# # npm publish --access public
# )}
if ! ([ -f package.json ] \
&& grep -q '^ "shCiNpmPublish": 1,$' package.json)
&& grep -q '^ "shCiPublishNpm": 1,$' package.json)
then
return
fi
Expand All @@ -605,30 +633,26 @@ shCiNpmPublish() {(set -e
"s|^ \"name\":.*| \"name\": \"@$GITHUB_REPOSITORY\",|" \
package.json
fi
if (command -v shCiNpmPublishCustom >/dev/null)
if (command -v shCiPublishNpmCustom >/dev/null)
then
shCiNpmPublishCustom
shCiPublishNpmCustom
fi
)}

shCiPre() {(set -e
# this function will run pre-ci
# shCiPreCustom() {(set -e
# # this function will run custom-code for pre-ci
# return
shCiPublishPypi() {(set -e
# this function will publish pypi-package
# shCiPublishPypiCustom() {(set -e
# # this function will run custom-code to npm-publish package
# # npm publish --access public
# )}
if [ -f ./myci2.sh ]
if ! ([ -f pyproject.toml ] \
&& grep -q '^shCiPublishPypi = 1$' pyproject.toml)
then
. ./myci2.sh :
shMyciInit
fi
if (command -v shCiPreCustom >/dev/null)
then
shCiPreCustom
return
fi
if (command -v shCiPreCustom2 >/dev/null)
if (command -v shCiPublishPypiCustom >/dev/null)
then
shCiPreCustom2
shCiPublishPypiCustom
fi
)}

Expand Down Expand Up @@ -826,17 +850,18 @@ shGitCommitPushOrSquash() {(set -e
COMMIT_MESSAGE="${1:-$(git diff HEAD --stat)}"
COMMIT_LIMIT="$2"
MODE_NOBACKUP="$3"
MODE_FORCE="$4"
MODE_SQUASH="$4"
git commit -am "$COMMIT_MESSAGE" || true
COMMIT_COUNT="$(git rev-list --count HEAD)"
if (! [ "$COMMIT_COUNT" -gt "$COMMIT_LIMIT" ] &>/dev/null)
if [ "$COMMIT_COUNT" -gt "$COMMIT_LIMIT" ]
then
if [ "$MODE_FORCE" = force ]
then
shGitCmdWithGithubToken push origin "$BRANCH" -f
else
shGitCmdWithGithubToken push origin "$BRANCH"
fi
MODE_SQUASH=squash
fi
printf "shGitCommitPushOrSquash COMMIT_COUNT=$COMMIT_COUNT \
COMMIT_LIMIT=$COMMIT_LIMIT MODE_SQUASH=$MODE_SQUASH\n"
if [ "$MODE_SQUASH" != squash ]
then
shGitCmdWithGithubToken push origin "$BRANCH"
return
fi
# backup
Expand All @@ -860,6 +885,7 @@ shGitCommitPushOrSquash() {(set -e
shGitGc() {(set -e
# this function will gc unreachable .git objects
# http://stackoverflow.com/questions/3797907/how-to-remove-unused-objects-from-a-git-repository
git remote prune origin
git \
-c gc.reflogExpire=0 \
-c gc.reflogExpireUnreachable=0 \
Expand Down Expand Up @@ -1507,6 +1533,7 @@ shImageLogoCreate() {(set -e
return
fi
# screenshot asset_image_logo_512.png
mkdir -p .artifact
shBrowserScreenshot asset_image_logo_512.html \
--window-size=512x512 \
-screenshot=.artifact/asset_image_logo_512.png
Expand Down Expand Up @@ -3504,9 +3531,10 @@ fi
unset shCiBaseCustom2
unset shCiLintCustom
unset shCiLintCustom2
unset shCiNpmPublishCustom
unset shCiPreCustom
unset shCiPreCustom2
unset shCiPublishNpmCustom
unset shCiPublishPypiCustom
if [ -f ./myci2.sh ]
then
. ./myci2.sh :
Expand Down
4 changes: 3 additions & 1 deletion jslint_wrapper_vim.vim
Expand Up @@ -39,7 +39,9 @@ function! SaveAndJslint(bang)
"" save file
if a:bang == "!" | write! | else | write | endif
"" jslint file (via nodejs)
let &l:errorformat = "%f:%n:%l:%c:%m"
let &l:errorformat =
\ "%f.<node -e>.js:%n:%l:%c:%m," .
\ "%f:%n:%l:%c:%m"
let &l:makeprg = "node \"" . $HOME . "/.vim/jslint.mjs\" jslint_wrapper_vim"
\ . " \"" . fnamemodify(bufname("%"), ":p") . "\""
silent make! | cwindow | redraw!
Expand Down
6 changes: 3 additions & 3 deletions package.json
Expand Up @@ -5,7 +5,7 @@
"bugs": {
"url": "https://github.com/jslint-org/jslint/issues"
},
"counter": 7,
"counter": 0,
"description": "JSLint, The JavaScript Code Quality and Coverage Tool",
"exports": {
"default": "./jslint_wrapper_cjs.cjs",
Expand Down Expand Up @@ -33,7 +33,7 @@
"test2": "sh jslint_ci.sh shCiBase"
},
"shCiArtifactUpload": 1,
"shCiNpmPublish": 1,
"shCiPublishNpm": 1,
"type": "module",
"version": "2023.8.20"
"version": "2023.10.24"
}

0 comments on commit 825a0da

Please sign in to comment.