Repository navigation
feat(eslint-config): add opt-in strict rule set - #97
Conversation
strict rule set
Set up the please workspace (.please/, docs/knowledge, docs/adr index) and add the track for an opt-in strict rule set. Refs #96
c3f8829 to
ee4aa49
Compare
Deploying code-style with
|
| Latest commit: |
8c9a23f
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://3790e565.code-style.pages.dev |
| Branch Preview URL: | https://tracks-opt-in-strict-rules-2.code-style.pages.dev |
There was a problem hiding this comment.
Code Review
This pull request introduces comprehensive workspace configuration, documentation, and planning files for the @pleaseai/code-style project. It establishes a workspace index, configuration settings, a new implementation track for an opt-in strict rule set, and extensive domain knowledge documents covering product guidelines, tech stack, and workflows. The reviewer identified a minor typo in docs/knowledge/product.md where the path for @pleaseai/prettier-config was misspelled as packages/perttier-config instead of packages/prettier-config.
Not up to standards ⛔🔴 Issues
|
| Category | Results |
|---|---|
| ErrorProne | 6 high |
| Security | 1 high |
🟢 Metrics 130 complexity · 0 duplication
Metric Results Complexity 130 Duplication 0
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
Tag each plan task with the spec requirements it covers. Refs #96
- T001: strict option adds no-promise-executor-return, eqeqeq 'always', unicorn/prefer-set-has and ts/no-confusing-non-null-assertion - Tests: passed Refs #96 [/please:implement]
- T002: merge eslint-plugin-import-x's no-self-import into antfu's import plugin (default mode); canonical mode uses eslint-plugin-import natively - Tests: passed Refs #96 [/please:implement]
- T003: enable strict in eslint.config.ts and replace 86 loose null comparisons with strict checks chosen from the operand type - Tests: passed Refs #96 [/please:implement]
- T004: add Strict Rules sections to both READMEs and the en/ko advanced docs pages, polish the strict JSDoc, list eslint-plugin-import-x in tech-stack.md - Tests: passed Refs #96 [/please:implement]
Refs #96 [/please:implement]
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
…ort plugin object strict now leaves out any rule the user set through antfu's per-plugin override options (javascript, typescript, unicorn, imports, and the deprecated top-level overrides), so FR-7 holds for those paths too. The no-self-import merge is cached per original plugin, so a user config that registers the same import plugin object no longer fails with "Cannot redefine plugin".
…elf-import import-x's default resolver skips .ts files, so extensionless and .js self-imports in TypeScript went unreported. Under strict in the default plugin mode, a pleaseai/strict/import-resolver config now gives import-x a node resolver with TypeScript extensions and .js -> .ts aliases. It sits before the user configs, so a consumer's own resolver settings still win.
…uginNames eslint-plugin-import's default node resolver skips .ts files and has no .js -> .ts alias, so strict import/no-self-import missed TypeScript self-imports in canonical mode. Add eslint-import-resolver-typescript as a dependency and point import/resolver at this package's own copy by absolute path, since eslint-plugin-import resolves resolvers relative to the linted file. The TypeScript self-import tests now run in both modes.
…overs antfu applies typescript, overridesTypeAware and test overrides only to its own file globs, so dropping those rules from the whole strict block also turned them off for JS files, while test overrides lost to strict in test files. Strict now drops only unscoped overrides (javascript, unicorn, imports) and re-applies the scoped ones after its block, on the same files antfu uses.
A hard-coded list of override groups kept missing groups (e18e, regexp, stylistic, perfectionist, ...) and counted overrides of disabled groups. The strict block no longer drops rules. Once configs resolve, every antfu config before it that took one of the consumer's overrides for a strict rule is re-applied right after it, on that config's own files, so the override wins exactly where antfu applied it.
…ks in the default mode The default plugin mode now gives import-x eslint-import-resolver-typescript's createTypeScriptImportResolver, so a module that imports itself through a tsconfig paths alias is reported in both plugin modes.
… fallback The strict TypeScript resolver is dropped when a consumer config sets a resolver for every file, and excludes the files a file-scoped consumer resolver covers.
…tive plugin reads Only the resolver keys the active import plugin reads count as a consumer resolver, and the files a consumer resolver config skips through its own ignores keep the strict TypeScript fallback.
… one Any config that sets a resolver key the active import plugin reads, including import-x/resolve, now removes the strict TypeScript fallback for every file, replacing the per-file scope narrowing. The docs note that canonicalPluginNames still needs the optional peer eslint-plugin-import.
Merge the strict resolver config builders, cache the no-self-import merge in a WeakMap and load only that rule from import-x, skip strictOverrides when nothing needs re-applying, and share one lint helper across the strict tests.
[Medium impact] The changes appear safe to merge; no actionable new issue was found. SummaryAdds an opt-in
Reviews (5) · Last reviewed commit: "test(eslint-config): assert ESLint rejec..." · Reviewed by Greptile |
There was a problem hiding this comment.
cubic analysis
All reported issues were addressed across 65 files
Linked issue analysis
Linked issue: pleaseai/code-style#96: track: opt-in-strict-rules-20261121
| Status | Acceptance criteria | Notes |
|---|---|---|
| ✅ | Keep strict rules opt-in and off by default | The option defaults off, and the PR enables it explicitly in this repository’s ESLint config. |
| ✅ | Enable the five specified checks without type information | The PR lists all five rules, and strict-rule tests cover the configuration and import-plugin modes. |
| ✅ | Allow consumers to override individual strict rules | The PR re-applies consumer overrides after the strict block and describes tests for override behavior. |
| ✅ | Turn strict on here and resolve its findings | The root config enables strict, and the diff replaces loose null comparisons and adjusts affected code. |
| Document strict and record its first-run finding counts | The README additions document the option, but the provided diff does not show strict finding counts. |
Architecture diagram
sequenceDiagram
participant User as Consumer Project
participant Config as pleaseai() Config Builder
participant Antfu as @antfu/eslint-config
participant Strict as strict.ts Rules
participant ImportX as eslint-plugin-import-x
participant Resolver as eslint-import-resolver-typescript
participant ESLint as ESLint Engine
Note over User,ESLint: Config Resolution Phase
User->>Config: pleaseai({ strict: true })
Config->>Antfu: composer = antfu(options)
Config->>Config: Check canonicalPluginNames flag
alt Default mode (no canonicalPluginNames)
Config->>Strict: strict({ importPlugin: 'import' })
Strict-->>Config: strict rules config
Config->>Antfu: insertBefore('antfu/disables/scripts', strictConfigs)
Config->>Config: Schedule strictOverrides onResolved
Config->>ImportX: Dynamic import no-self-import rule
ImportX-->>Config: Rule object
Config->>Antfu: replacePlugin('import', mergedPlugin)
Config->>Resolver: createTypeScriptImportResolver()
Resolver-->>Config: Resolver settings
Config->>Antfu: insertBefore with resolver config
else Canonical mode (canonicalPluginNames: true)
Config->>Strict: strict({ importPlugin: 'import' })
Strict-->>Config: strict rules config
Config->>Antfu: insertBefore('antfu/disables/scripts', strictConfigs)
Config->>Config: Resolve resolver path via createRequire
Config->>Antfu: insertBefore with absolute resolver path
Note over Config: eslint-plugin-import provides rule natively
end
Config-->>User: Resolved config array
Note over User,ESLint: Linting Phase
User->>ESLint: Lint files with resolved config
ESLint->>ESLint: Apply strict rules to JS/TS files
alt Consumer overrides exist
ESLint->>Config: strictOverrides(configs, options)
Config->>Config: Find rules with consumer overrides
Config->>Config: Re-apply overrides after strict block
end
alt Resolver conflict detected
Config->>Config: Check for consumer resolver settings
alt Consumer sets resolver key
Config->>Config: Remove strict resolver fallback
Note over Config: Consumer's resolver owns all resolution
else No consumer resolver
Config->>Resolver: Resolve imports (extensionless, .js→.ts, paths aliases)
Resolver-->>ESLint: Resolved module paths
end
end
ESLint->>ImportX: Execute no-self-import rule
ImportX->>Resolver: Resolve import specifiers
Resolver-->>ImportX: Resolved paths
ImportX-->>ESLint: Self-import findings
alt Strict rule violations found
ESLint-->>User: Error-level findings
else All rules pass
ESLint-->>User: Clean lint results
end
Reply with feedback, questions, or to request a fix.
Turn on auto-fix | Re-trigger cubic
- reject a package.json that is not a JSON object in readPackageJson, sharing the check with antislop through isJsonObject (resolves TD-002) - assert import/no-self-import survives turning off another strict rule - correct the track plan and spec to the shipped rule id and resolver, and tick the verified checklists - fix stale knowledge docs (commit types, integration checks, strict feature, dead AGENTS.md links) and note the fixture exclusion in docs
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces an opt-in strict rule set to @pleaseai/eslint-config based on cloudflare/oxlint-config, enabling rules such as no-promise-executor-return, strict eqeqeq, unicorn/prefer-set-has, ts/no-confusing-non-null-assertion, and import/no-self-import. The repository itself has been updated to use this strict configuration, resolving numerous loose equality checks. Feedback on the changes suggests refactoring the isJsonObject type guard in packages/cli/src/fs-utils.ts to use a generic named interface rather than asserting PackageJson directly, which improves type safety and avoids triggering the 'quality/no-known-value-widening' lint rule.
There was a problem hiding this comment.
All reported issues were addressed across 12 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
Turn on auto-fix | Re-trigger cubic
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces an opt-in strict rule set to @pleaseai/eslint-config based on cloudflare/oxlint-config, enabling rules like no-promise-executor-return, strict eqeqeq, unicorn/prefer-set-has, ts/no-confusing-non-null-assertion, and import/no-self-import. It integrates eslint-plugin-import-x and eslint-import-resolver-typescript to support self-import detection and TypeScript resolution. The codebase has been updated to resolve new strict lint findings, and comprehensive tests and documentation have been added. The review feedback highlights a potential runtime crash in setsResolver when a user-defined ESLint flat config contains a null or non-object settings property, and recommends adding defensive checks before using the in operator.
…r a consumer resolver
|
/gemini review |
There was a problem hiding this comment.
All reported issues were addressed across 2 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
Turn on auto-fix | Re-trigger cubic
There was a problem hiding this comment.
Code Review
This pull request introduces a new opt-in strict rule set to @pleaseai/eslint-config, which enables stricter linting rules adopted from Cloudflare's oxlint configuration, including no-promise-executor-return, strict eqeqeq (disallowing loose null checks), unicorn/prefer-set-has, ts/no-confusing-non-null-assertion, and import/no-self-import. To support these rules, eslint-plugin-import-x and eslint-import-resolver-typescript have been added as dependencies. Additionally, the repository's own codebase has been updated to comply with these strict rules by refactoring loose null/undefined checks to strict comparisons, and comprehensive tests and documentation have been added. As there are no review comments provided, I have no further feedback to provide on this pull request.
Code Review ✅ Approved 🟡 Medium riskThe opt-in strict rules and package.json validation change lint and CLI behavior; consumers may see new lint errors or rejection of malformed metadata. Adds an opt-in VerificationRules No rules evaluated Functional validation Not enabledAuto-approval Approved For more verification details, comment OptionsAuto-apply is off → Gitar will not commit updates to this branch. Comment with these commands to change the behavior for this request:
Important Your trial ends in 5 days — upgrade now to keep code review, CI analysis, auto-apply, custom automations, and more. Was this helpful? React with 👍 / 👎 | Gitar |
|



Summary
Adds a
strictoption to@pleaseai/eslint-configthat turns on non-type-aware rules adopted from cloudflare/oxlint-config:no-promise-executor-return,ts/no-confusing-non-null-assertion,unicorn/prefer-set-has,import/no-self-import, and stricteqeqeq('always'). The option is off by default, and this repository turns it on for itself.opt-in-strict-rules-20261121(spec · plan)import/no-self-importcomes fromeslint-plugin-import-xin the default mode and fromeslint-plugin-importwithcanonicalPluginNames. Both modes resolve TypeScript sources througheslint-import-resolver-typescript, so extensionless,.js, and tsconfigpathsself-imports are reported.eslint-plugin-import-xandeslint-import-resolver-typescriptare regular dependencies, loaded only whenstrictis on.strict: per-groupoverridesare re-applied after the strict block on the files and option group antfu applied them to, and a consumer config that sets a resolver key the active import plugin reads replaces the strict resolver fallback.packages/clireplaces 86 loose== nullcomparisons with strict checks that keep each comparison's meaning.Closes #96
Checklist
bun run build)bun run lint)eslint-config/advanced.mdx)strictis opt-in, off by default)Verification Checklist
bun run buildandbun run testpass (root, HEADde16021: ast-grep-config 3, cli 325, eslint-config 386 pass, 0 fail)mise exec -- bun run lintpasses at the root withstrict: truebun run typecheckandbun run lint:docspass inapps/docs(0 errors; 22 files lint clean)/please:review; note: the AC-012 override test does not also assert thatimport/no-self-importstill reports)Summary by cubic
Adds an opt-in
strictrule set to@pleaseai/eslint-config(closes #96), shipseslint-plugin-import-xandeslint-import-resolver-typescriptas dependencies, and turnsstrict: trueon in this repository.strict: trueenableseqeqeq('always'),no-promise-executor-return,unicorn/prefer-set-has,ts/no-confusing-non-null-assertion, andimport/no-self-importat error level on JS and TS files outside Markdown code blocks.strict; theno-self-importmerge is cached per plugin object, so reusing the same plugin in a user config no longer fails. When detecting a consumer resolver, a non-object settings value is skipped, and ESLint rejects anullsettings value under strict..js, and tsconfigpathsalias imports.canonicalPluginNamesstill needs the optionaleslint-plugin-importpeer.nullcomparisons inpackages/cliwith strict checks chosen from each operand's type, makesreadPackageJsonreject package.json content that is not a JSON object (shared with antislop viaisJsonObject, narrowed to theobjecttype), and excludes the self-importing test fixtures from linting..please/workspace scaffolding and documents the option in both READMEs and the en/ko documentation pages.Written for commit 8c9a23f. Summary will update on new commits.