From 825a0da1e5bdd7dc578feeb8b8a90333c00e0a22 Mon Sep 17 00:00:00 2001 From: kai zhu Date: Thu, 26 Oct 2023 22:54:48 -0500 Subject: [PATCH] # 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() --- .ci.sh | 4 +- .github/workflows/ci.yml | 16 ++--- .github/workflows/on_pull_request.yml | 6 +- .github/workflows/publish.yml | 18 +++--- .gitignore | 1 + CHANGELOG.md | 6 ++ README.md | 2 +- jslint.mjs | 4 +- jslint_ci.sh | 90 ++++++++++++++++++--------- jslint_wrapper_vim.vim | 4 +- package.json | 6 +- 11 files changed, 98 insertions(+), 59 deletions(-) diff --git a/.ci.sh b/.ci.sh index 03c5b536e..544722a3f 100644 --- a/.ci.sh +++ b/.ci.sh @@ -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 )} @@ -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 ({ diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3d1765303..e7a19c006 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,9 +22,9 @@ jobs: - x64 # - x86 node_version: - - 16 - 18 - 20 + # - 22 python_version: - "3.10" os: @@ -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 }} @@ -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 @@ -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 }} diff --git a/.github/workflows/on_pull_request.yml b/.github/workflows/on_pull_request.yml index 1f8872ae6..d43fdd64c 100644 --- a/.github/workflows/on_pull_request.yml +++ b/.github/workflows/on_pull_request.yml @@ -14,9 +14,9 @@ jobs: - x64 # - x86 node_version: - - 16 - 18 - 20 + # - 22 os: - macos-latest - ubuntu-latest @@ -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 }} diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index f8052649b..91884185c 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -17,9 +17,9 @@ jobs: - x64 # - x86 node_version: - # - 16 - - 18 - # - 20 + # - 18 + - 20 + # - 22 os: # - macos-latest - ubuntu-latest @@ -38,8 +38,8 @@ 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 }} @@ -47,21 +47,21 @@ jobs: # 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 diff --git a/.gitignore b/.gitignore index 778e87bf6..6d0d36027 100644 --- a/.gitignore +++ b/.gitignore @@ -22,6 +22,7 @@ package-lock.json *.py[cod] dist/ htmlcov/ +wheelhouse/ # vscode *.vsix diff --git a/CHANGELOG.md b/CHANGELOG.md index e71e7cf54..71b29cbac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. diff --git a/README.md b/README.md index 1afacec9b..91087863b 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ Douglas Crockford # Status -| Branch | [master
(v2023.8.20)](https://github.com/jslint-org/jslint/tree/master) | [beta
(Web Demo)](https://github.com/jslint-org/jslint/tree/beta) | [alpha
(Development)](https://github.com/jslint-org/jslint/tree/alpha) | +| Branch | [master
(v2023.10.24)](https://github.com/jslint-org/jslint/tree/master) | [beta
(Web Demo)](https://github.com/jslint-org/jslint/tree/beta) | [alpha
(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) | diff --git a/jslint.mjs b/jslint.mjs index b17ae2c08..54a48b1b4 100644 --- a/jslint.mjs +++ b/jslint.mjs @@ -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. @@ -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 ); } diff --git a/jslint_ci.sh b/jslint_ci.sh index f2dbfe996..534cbee9b 100644 --- a/jslint_ci.sh +++ b/jslint_ci.sh @@ -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)" @@ -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 = {}; @@ -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); + }); } }()); ' "$@" # ' @@ -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 @@ -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 )} @@ -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 @@ -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 \ @@ -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 @@ -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 : diff --git a/jslint_wrapper_vim.vim b/jslint_wrapper_vim.vim index 104e54a1e..f7b897601 100644 --- a/jslint_wrapper_vim.vim +++ b/jslint_wrapper_vim.vim @@ -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..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! diff --git a/package.json b/package.json index a4072e4f6..e1845704a 100644 --- a/package.json +++ b/package.json @@ -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", @@ -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" }