Skip to content

style(lib): implements Neostandard for codebase styling guide - #250

Merged
UlisesGascon merged 5 commits into
pillarjs:5.0from
mfdebian:implement-standard-style
Jun 13, 2026
Merged

UlisesGascon merged 5 commits into
pillarjs:5.0from
mfdebian:implement-standard-style

Conversation

@mfdebian

@mfdebian mfdebian commented Mar 25, 2026 •

Copy link
Copy Markdown
Contributor

This PR adds and implements Neostandard for styling the codebase. It changes no behaviors, including how we were linting markdown files, no rules have been deprecated/eliminated in this migration, they now just live under Neostandard's implementation (or added explicitly in one case).

It follows the same conventions used in iconv-lite except for quotes (iconv-lite uses double quotes).

ESlint dependencies needed upgrading and/or removal, for instance the old eslint-plugin-markdown has been replaced by @eslint/markdown and eslint has been upgraded to version 9.x

I removed .eslintrc.yml and .eslintignore files and replaced them with eslint.config.mjs to follow the new ESlint version formats.

The config:

  • Uses neostandard() as the base ruleset, covers all previously configured rules except no-console
  • no-console: error is kept explicitly (neostandard intentionally omits it as a project preference)
  • Vitest globals (describe, test, expect, beforeAll, etc.) declared for test/**/*.js
  • Ignored paths (coverage/, .nyc_output/) moved from .eslintignore into the config
  • Uses @eslint/markdown's processor config (equivalent to the old plugin:markdown/recommended + processor: 'markdown/markdown') to lint JS code blocks inside .md files
  • no-path-concat (removed from ESLint 9 core) is now enforced as n/no-path-concat via eslint-plugin-n
  • All formatting rules (eol-last, no-trailing-spaces, etc.) are now under the @stylistic/ prefix, managed by @stylistic/eslint-plugin
  • no-multiple-empty-lines is now slightly stricter: also enforces maxBOF: 0 (no empty lines at the beginning of a file)
  • n/handle-callback-err is newly enforced by Neostandard (was not in the previous config)

For the code style changes:

  • Semicolons removed from all lib, test, and example files. This was applied automatically via eslint --fix following iconv-lite style.
  • snake_case variables have been renamed to camelCase in lib/hbs.js and lib/async.js to comply with neostandard's camelcase rule:
  • else if brace style in lib/async.js moved to same line as closing } (@stylistic/brace-style)
  • /\-/g → /-/g in lib/hbs.js (no-useless-escape)
  • cb('Async Title') → cb(null, 'Async Title') in test/async_helpers.test.js (n/no-callback-literal)

closes #224

edit: One (or two) big caveats I realized only after opening the PR:

A new version of Vite (version 7) is being used under the hood by vitest, and since it uses rolldown which uses the styleText API from node:util that was only added in Node.js 20.12, it was breaking CI on Node 18 and 19. To fix this I tried pinning vitest to a specific version, but the true fix was actually to override vite to version 6.0.0.

Another issue is Neostandard transitively depends on find-up, which in its current version is an ESM-only package. Node.js only gained the ability to require() ESM modules in version 22, so loading neostandard's config crashes on anything older, the fix was to skip the linting step completely for Node versions < 22.

Let me know your thoughts about this, I didn't want to drop support for some Node.js versions just because of devDependencies. But I'm not sure exactly how to proceed @UlisesGascon @bjohansebas.

@mfdebian mfdebian mentioned this pull request Mar 25, 2026
10 of 13 tasks
@bjohansebas
bjohansebas self-requested a review April 1, 2026 17:55

@UlisesGascon UlisesGascon left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work @mfdebian!

Comment thread .github/workflows/ci.yml
run: ${{ matrix.node-version == '18' && 'npm test' || 'npm run test-ci' }}

- name: Lint code
if: matrix.node-version >= '22'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am comfortable with this workaround! We just need the linter to run once "technically"

@UlisesGascon
UlisesGascon merged commit 2031684 into pillarjs:5.0 Jun 13, 2026
17 checks passed
@UlisesGascon UlisesGascon mentioned this pull request Oct 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants