chore: align ESLint rules with the monorepo's portable ruleset#54
Open
varin-nair-factory wants to merge 1 commit into
Open
chore: align ESLint rules with the monorepo's portable ruleset#54varin-nair-factory wants to merge 1 commit into
varin-nair-factory wants to merge 1 commit into
Conversation
Port the portable, non-custom, non-React rules from factory-mono-alpha's shared @factory/eslint-config into our ESLint 9 flat config, so the public SDK enforces the same standards as the internal source of truth. Added rules: no-empty-object-type (error), no-require-imports, no-barrel-files, import/no-default-export, import/named, import/no-extraneous-dependencies, import/extensions, eslint-comments/no-unused-disable, no-void, default-case, no-constant-condition, no-param-reassign, no-promise-executor-return, prefer-promise-reject-errors, prefer-arrow-callback, no-restricted-syntax (incl. ExportAllDeclaration ban), and vitest/expect-expect + valid-expect for tests. Excluded the monorepo's factory/* custom-plugin rules (not installable from npm) and React/Next rules (no React here). Refactored to comply: deleted the unused src/protocol/index.ts export* barrel and converted src/index.ts to explicit named re-exports. Public-API barrels are exempted from no-barrel-files (matching the monorepo's index.ts exemption). Fixed all resulting violations. New devDeps: eslint-plugin-no-barrel-files, eslint-plugin-eslint-comments, @vitest/eslint-plugin. Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Aligns this public SDK's ESLint config with the portable subset of the private monorepo's shared
@factory/eslint-config, so we enforce the same standards as the internal source of truth.Approach
The monorepo uses ESLint 8 + legacy
.eslintrc+ airbnb + a custom in-repo plugin; this repo uses ESLint 9 flat config, so a literal copy is impossible. We ported only the rules that are portable and relevant to a standalone library.Rules added (matching the monorepo)
@typescript-eslint/no-empty-object-type(off → error)@typescript-eslint/no-require-importsno-barrel-files/no-barrel-filesimport/no-default-export,import/named,import/no-extraneous-dependencies,import/extensionseslint-comments/no-unused-disableno-void,default-case,no-constant-condition,no-param-reassign,no-promise-executor-return,prefer-promise-reject-errors,prefer-arrow-callbackno-restricted-syntax(for-in, labels, with, ExportAllDeclaration ban)vitest/expect-expect,vitest/valid-expectDeliberately excluded
factory/*rules — custom in-repo plugin (~80 rules), not installable from npm, and encode monorepo-specific concerns (feature flags,@factory/environment, structured logging).Refactors to comply (strict, no carve-outs for our own code)
src/protocol/index.ts— it was an unusedexport *barrel (nothing imported it; tests import the subfiles directly). Violated bothno-barrel-filesand theExportAllDeclarationban.src/index.ts— convertedexport *to explicit named re-exports, preserving every public-API name (verified againsttests/public-api.test.ts).src/index.ts,src/schemas/index.ts,src/daemon/index.ts) are exempted fromno-barrel-filesvia a scoped override — matching the monorepo's ownindex.tsexemption infactory-package.js.no-promise-executor-return(wrapped setTimeout executors),vitest/expect-expect(added real assertions),no-empty-object-type(empty interfaces → type aliases),default-case,no-void,no-param-reassign.New devDependencies
eslint-plugin-no-barrel-files,eslint-plugin-eslint-comments,@vitest/eslint-plugin.Prettier
Already byte-identical to the monorepo's
.prettierrc— no change needed.Verification
npm run lint— clean (0 errors)npm run typecheck+npm run typecheck:examples— cleannpm run format:check— cleannpm test— 911 passingNote
Branch is based on TIER-1 (
main); the TIER-2 PR (#53) is independent and not yet merged, so the test count here is 911 (not 916). No tests were removed.