Skip to content

feat(eslint): Node-only base with opt-in browser and Vitest globals - #58

Merged
Shinrai merged 1 commit into
nextfrom
feat/eslint-node-layer
Nov 28, 2026
Merged

Shinrai merged 1 commit into
nextfrom
feat/eslint-node-layer

Conversation

@cldmv-bot

@cldmv-bot cldmv-bot Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

The eslint base is now a Node-only layer: globals.node, and no browser or Vitest globals. Browser globals (window, self, document, ...) are reported in a script, and tests have to import describe, it and expect from vitest. Two named exports add them back where a repository needs them:

  • withBrowserGlobals(files?), for code that runs in a browser
  • withVitestGlobals(files?), for repos whose Vitest config sets test.globals: true

.configs/** is no longer ignored, so a repo's own tool configs get linted with the Node layer. There are tests for each case, and the README documents the helpers.

It only makes the lint stricter where it was silent, which the README's versioning section counts as a minor. Consumers fix whatever it now finds in their dev-tool bump PRs.

Resolves #43

The base now declares globals.node only, so window, self, document and the
other browser globals are reported in a Node script (a missing `self` import
in a slothlet package now lints red), and tests must import describe, it and
expect from vitest. Two named exports add them back where a repository needs
them: withBrowserGlobals(files) and withVitestGlobals(files), the latter for
repos whose Vitest config sets test.globals: true. `.configs/**` is no longer
ignored, so a repository's own tool configs are linted with the Node layer.

This only makes the lint stricter where it was silent, which the README's
versioning policy treats as a minor.

Resolves #43
@cldmv-bot cldmv-bot Bot added ! feature → next v4 flow: contributor PR targeting the next integration branch type: feature Implements new functionality — a PR or issue that adds a feature area: tests Touches test files, fixtures, or test infrastructure type: documentation Relates to docs, README updates, guides, or inline code comments labels Nov 28, 2026
@Shinrai
Shinrai merged commit 828830b into next Nov 28, 2026
37 checks passed
@cldmv-bot
cldmv-bot Bot deleted the feat/eslint-node-layer branch November 28, 2026 07:38
cldmv-bot Bot added a commit that referenced this pull request Nov 28, 2026
# `@cldmv/configs` v1.5.0 Changelog

**Release Date**: November 2026
**Release Type**: Minor
**Branch**: `next` → `master`

---

## Overview

The ESLint base is now a Node-only layer. Browser globals and Vitest globals are opt-in through two new named exports, and a repository's own `.configs/` files are linted. This only makes the lint stricter where it was silent: code that relied on a browser global, or a test that used `describe` without importing it, now gets a `no-undef` error to fix.

The package also declares its dev toolchain floor in `devEngines`, takes `@cldmv/eslint-plugin-jsonv` 2, and refreshes the dev tools. `fix-headers.json`, `prettier.json`, `prettierignore`, `vitest.config.mjs` and the `cldmv-configs` CLI are unchanged.

---

## ✨ Features

### Node-only ESLint base, with opt-in browser and Vitest globals ([#58](#58), fixes [#43](#43))

The base used to declare `globals.node` and `globals.browser` for every script, and the Vitest globals for every `tests/**/*.test.vitest.mjs` file, so `window`, `self`, `document` and `name` never tripped `no-undef` in a Node package, and a test that forgot `import { describe, it } from "vitest"` linted clean. For packages built on slothlet, where `self` is a runtime binding that has to be imported, a missing import went unnoticed.

Now:

- The default export declares `globals.node` only.
- `withBrowserGlobals(files?)` returns a block with `globals.browser` for the given files (default: every `**/*.{js,mjs,cjs}` script), for code that really runs in a browser.
- `withVitestGlobals(files?)` returns a block with the Vitest globals, read-only, for the given files (default: `tests/**/*.test.vitest.mjs`). Use it only when the repository's Vitest config sets `test.globals: true`.
- `.configs/**` is no longer ignored, so an unused or unspread import in a repository's own tool configs is reported.

```js
import base, { withBrowserGlobals, withVitestGlobals } from "@cldmv/configs/eslint.config.mjs";

export default [...base, withBrowserGlobals(["src/browser/**/*.mjs"]), withVitestGlobals()];
```

The README's Versioning section counts a change that only makes a tool stricter where it was silent as a minor. The tests lint sample code end to end for each case.

---

## 🐛 Bug Fixes

### The dev toolchain floor is declared in `devEngines` ([#45](#45))

configs only runs as a consuming repository's dev tooling, so it still declares no runtime `engines`. The 22.22.0 floor that Vitest 5 needs now goes in `devEngines` (`onFail: "error"`), and the CI and publish workflows test from Node.js 22.22.0 instead of 22.12.0.

---

## 🔧 CI & tooling

- `ci.yml` adopts the CLDMV/.github v4.46.0 concurrency block, so superseded runs on `next`, `hotfixes` and the release PR are cancelled and only release pushes always finish ([#57](#57), fixes [#56](#56)).
- `ci.yml` is synced with the v4.43.0 template ([#55](#55)).
- The `sync-release-notes.yml` companion workflow syncs release bodies from these changelog files and creates missing version tags ([#52](#52)).
- `dependabot.yml` takes the npm groups from the CLDMV/.github v4.47.0 template, so the CLDMV dev tools move in one PR ([#59](#59)).

## 📚 Documentation

- **NEW:** [docs/changelog/v1/v1.5.0.md](https://github.com/CLDMV/configs/blob/v1.5.0/docs/changelog/v1/v1.5.0.md), this changelog.
- README: the ESLint sections describe the Node-only base, the `.configs/` linting and the two `with*Globals()` helpers ([#58](#58)).
- README What's New promoted to v1.5.0.

## 🔧 Dependencies

- **For consumers:** `@cldmv/eslint-plugin-jsonv` `^1.0.17` → `^2.0.0`. The base only spreads the plugin object and its recommended config for `*.jsonv` files, which 2.0.0 didn't change ([#59](#59)).
- **Dev tooling in this repository:** `@cldmv/vitest-runner` 1.11.3, `@cldmv/jsonv` and `@cldmv/prettier-plugin-jsonv` 1.2.3, `@cldmv/fix-headers` 2.6.0, `eslint` 10.16.0, `prettier` 3.10.1 and `vitest` 5.1.2 ([#47](#47), [#59](#59)).

---

## Upgrade notes

- After updating, run the repository's `lint`. Expect `no-undef` for browser globals in Node code (import what you meant, or add `withBrowserGlobals()` for real browser files) and for Vitest globals in tests (import them from `vitest`, or add `withVitestGlobals()` if the Vitest config sets `test.globals: true`). Expect lint findings in `.configs/` files too.
- Nothing else changes: the other configs and the CLI behave as in [v1.4.0](https://github.com/CLDMV/configs/blob/v1.5.0/docs/changelog/v1/v1.4.0.md).



<details>
<summary>👥 Contributors</summary>

- @Shinrai

</details>

---

<!-- coverage-start -->

![coverage](https://img.shields.io/badge/coverage-100.0%25-brightgreen?style=for-the-badge&logo=vitest&logoColor=white)

| Metric | Coverage |
|--------|----------|
| Statements | 100.0% |
| Branches   | 100.0% |
| Functions  | 100.0% |
| Lines      | 100.0% |

*Avg: **100.0%** · `a774c27` · Node lts/**

<!-- coverage-end -->

<!-- co-authors -->

Co-authored-by: Shinrai <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: tests Touches test files, fixtures, or test infrastructure ! feature → next v4 flow: contributor PR targeting the next integration branch type: documentation Relates to docs, README updates, guides, or inline code comments type: feature Implements new functionality — a PR or issue that adds a feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant