Repository navigation
feat: adopt @sasjs/lint 4.1.0 - #460
Conversation
Bumps @sasjs/lint 2.7.0 -> 4.1.0 in api/. 3.0.0 turns on noUndeclaredMacros and noUnusedMacros. The api's own default configuration (api/src/utils/lintConfig.ts - seeded to the drive root and used as the fallback) does not name either rule, so the Studio gains both: a buffer that invokes a macro without declaring it in the header is flagged, and a header entry the file never uses is flagged too. The macros that ship with SAS are always considered declared, so only project macros are reported. The rules apply to everyone rather than being pinned off. 4.0.0 makes an absent setting fall back to its documented default. The api is unaffected: its default configuration names maxLineLength and hasMacroNameInMend explicitly, and both were already on. 4.1.0 adds the noUnusedLibnames rule, off by default, with ignoredLibnames and the per-file @sasjslint block in the header. Verified: npm ci, tsc --noEmit (clean against 4.1.0, so the LintConfig, lintText and formatText usage is unchanged), and the api suite run on both sides and compared. 4.1.0 and 2.7.0 give identical results - 18 failed / 19 passed suites, 306 failed / 181 passed tests of 487 - with an identical failing-suite list, so the bump changes no suite's outcome. The 18 are the specs that need a live server and MongoDB. The code controller spec, which covers /code/lint and /code/format, is not among them and passes on both.
There was a problem hiding this comment.
Reviewed the full diff for sasjs/server #460 (api/package.json + api/package-lock.json: @sasjs/lint 2.7.0 -> 4.1.0) plus repo-level hardening (CI audit gates, .npmrc, gitleaks hook, release config).
Findings:
- .github/workflows/build.yml:66 - the "Audit Web dependencies" step runs
npm audit --audit-level=high, which is not strict: moderate and low advisories pass the gate. The documented reason (react-router moderate advisories pending react-router-dom 7) is understood, but the gate must fail on any production vulnerability. Use the default level or --audit-level=low and track the react-router migration separately, or scope with --omit=dev. - Commit subject "feat: adopt @sasjs/lint 4.1.0" is a pure dependency bump. semantic-release (.releaserc) will cut a minor release from it. A lint toolchain bump is chore(deps)/build, not a new capability; use "chore(deps): bump @sasjs/lint to 4.1.0" unless a lint behaviour change is user-visible.
- CI is not green at this head: security, lint, build-web and build-api have passed, but "Container build and scan" is still in progress (mergeable_state unstable). Not ready to merge until it completes.
3 findings above for review.
|
🎉 This PR is included in version 1.19.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
|
Adding the targeted confirmation for the lint/format endpoints, since the body only cited it indirectly (via the full-suite comparison). 10/10 pass - the same ten tests that #459 cited when it adopted 2.7.0. So the Worth noting for anyone running this spec by hand: it completes in about seven seconds, but jest does not exit afterwards, so a wrapper timeout looks like a hang. That is the missing |
Summary
Bumps
@sasjs/lint2.7.0 -> 4.1.0 inapi/-api/package.jsonplus both lockfile entries (2 files, 5 lines).What lands with it
noUndeclaredMacros/noUnusedMacroson by defaultnoUnusedLibnamesrule, off by defaultThe Studio gains the two macro rules
api/src/utils/lintConfig.tscarries the api's own default configuration - it is seeded to the drive root as/.sasjslintat startup, and it is the fallback when that file cannot be read. It does not namenoUndeclaredMacrosornoUnusedMacros, so under 3.0.0 both are now on:A Studio buffer that invokes a macro without declaring it in the header is now flagged, and a header entry the file never uses is flagged too. The macros that ship with SAS -
%scan,%sysfuncand the other macro functions, along with the language keywords such as%ifand%do- are always considered declared, so only project macros are reported.The rules are applied to everyone rather than pinned off in the api's default config. #459 treated
noSingleAsteriskCommentsas opt-in, but that was to protect an installed base; there is none here, so the lint defaults stand.noUnusedLibnamesstays off, as it is off by default in 4.1.0.4.0.0 does not affect the api
The api's default configuration names
maxLineLength(80) andhasMacroNameInMend(true) explicitly, so the change that makes an omitted setting fall back to its documented default has nothing to act on. Every setting 4.0.0 touches is explicit there, andhasDoxygenHeader: falseis preserved.Verification
npm ci- installs cleanly, lockfile in sync.npx tsc --noEmit- clean against 4.1.0, so theLintConfig,lintTextandformatTextusage inlintConfig.ts,lintProgram.tsandcontrollers/code.tsis unchanged.The failing-suite list is identical too, so the bump changes no suite's outcome. All 18 are the specs that need a live server and a MongoDB binary (
auth,localLogin,sessionCookie,permission,user,drive,appStreamListing, ...).The code controller spec, which covers the
/code/lintand/code/formatendpoints, is not among them - it passes on both sides.No source change is needed.