influxdata / influxdata/docs-v2

Scripts in .ci/scripts/ are never linted and report 'process is not defined'

Open
#7,618 0 comments 0 reactions 0 assignees View on GitHub
area:ci
Dominant language
JavaScript
Stars
82
Forks
326
Avg merge
1d 1h
Merged PRs (30d)
82

Description

## Summary

JavaScript under `.ci/scripts/` is not covered by the ESLint hook or by ESLint's
Node globals configuration. Running ESLint against those files by hand reports
`'process' is not defined` for every use, because they fall through to the
browser-globals config.

## Evidence

```
$ npx eslint .ci/scripts/check-release-notes-version.js
344:5 error 'process' is not defined no-undef
344:59 error 'process' is not defined no-undef
...
✖ 13 problems (7 errors, 6 warnings)
```

Two gaps combine:

- `lefthook.yml` -- the `lint-js` hook globs only `assets/js/*.{js,ts}`, so
`.ci/scripts/**` is never linted on commit.
- `eslint.config.js` -- the Node-globals block covers `helper-scripts/**/*.js`
and `scripts/**/*.js`, but not `.ci/scripts/**/*.js`.

Prettier is unaffected: its hook globs `*.{css,js,ts,jsx,tsx}`, so staged
`.ci/scripts` files are formatted, and existing files there are Prettier-clean.

## Impact

CI scripts are the code most likely to fail silently in a way nobody notices, and
they get the least static checking of any JavaScript in the repo. Anyone who does
run ESLint on them sees a wall of false `no-undef` errors, which trains people to
ignore the output.

## Suggested fix

Add `.ci/scripts/**/*.js` to the Node-globals block in `eslint.config.js`, then
extend the `lint-js` glob to cover it. Expect to fix real findings in the
existing scripts once the false `no-undef` noise is gone.

## Notes

Found while adding `.ci/scripts/check-v1-shared-drift.js` during the InfluxDB v1
shared-content migration. That script has unit tests
(`check-v1-shared-drift.test.js`, run via `node --test`), but no lint coverage --
same as its neighbors.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with lefthook.yml and eslint.config.js, then run npx eslint .ci/scripts/check-release-notes-version.js to separate false globals errors from real findings. Check the existing .ci/scripts files, including check-v1-shared-drift.js and its check-v1-shared-drift.test.js test run via node --test. Done means the scripts are covered by the hook and Node globals configuration, with remaining lint findings addressed.

Written by the indexing model from the issue text.

Assessment

Tech stack
eslint, javascript, node.js
Domain
ci-cd, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.