-
Notifications
You must be signed in to change notification settings - Fork 55
feat: pre-commit type checking and lint - web #2279
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
kyrers
merged 15 commits into
feat/pre-commit-type-check
from
feat/pre-commit-type-check-web
May 22, 2026
Merged
Changes from 9 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
9845a7e
chore: minor fixes to web check style and types scripts + add to pre-…
kyrers a8cc056
fix: enable noImplicitAny for stricter type checking
kyrers eaad005
chore: auto fixable lint errors
kyrers f7769a8
chore: update eslint config to ignore local generated contract hooks
kyrers 477b525
chore: update eslint config to ignore local graphql generated files
kyrers 38473cb
fix: complete lint fixes
kyrers 8e10400
fix: complete type fixes
kyrers bb76797
fix: improve error handling in usePolicyRegistryEvent
kyrers b431026
chore: add README to shared ESLint config + new root type checking s…
kyrers 5d37038
chore: update ESLint config to restrict imports using the '~' prefix …
kyrers 016f52a
fix: update type casts for Classic Commit and Vote components
kyrers 03850cb
fix: replace parseInt with Number.parseInt
kyrers bad5273
fix: remove mistaken comment
kyrers 0b71e53
fix: memoize context value in HomePageProvider
kyrers aa1ce26
fix: simplify type casting for DEFAULT_CHAIN.id
kyrers File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| # @kleros/kleros-v2-eslint-config | ||
|
|
||
| Shared ESLint configuration to be used across the Kleros v2 monorepo. | ||
|
|
||
| ## Usage | ||
|
|
||
| Workspaces that don't need custom rules can use the default config with a one-line `eslint.config.mjs`: | ||
|
|
||
| ```js | ||
| export { default } from "@kleros/kleros-v2-eslint-config/flat.config.mjs"; | ||
| ``` | ||
|
|
||
| ## Flat-config migration shim | ||
|
|
||
| ESLint 9 requires the flat config format (`eslint.config.*`) and no longer reads legacy `.eslintrc` files automatically. `flat.config.mjs` uses `FlatCompat` to translate the legacy `.eslintrc.js` into a flat config, so the existing rules continue to apply. | ||
|
|
||
| ## What's in the config | ||
|
|
||
| ### Parser & environments | ||
|
|
||
| - **Parser:** `@typescript-eslint/parser` | ||
| - **`parserOptions.ecmaVersion`:** `2020` | ||
| - **Environments enabled:** `browser`, `node`, `es6`, `es2020`, `mocha` | ||
|
|
||
| ### Extended configs | ||
|
|
||
| - `eslint:recommended` — ESLint's built-in baseline rules | ||
| - `plugin:@typescript-eslint/recommended` — TypeScript-aware rules | ||
| - `plugin:prettier/recommended` — runs Prettier as an ESLint rule and disables conflicting style rules | ||
| - `plugin:import/recommended` — import/export hygiene | ||
|
|
||
| ### Plugins | ||
|
|
||
| `@typescript-eslint`, `prettier`, `import`, `n` (Node). | ||
|
|
||
| ### Custom rule overrides | ||
|
|
||
| | Rule | Setting | Why | | ||
| | ------------------------------------- | ------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| | `no-unused-vars` | `off` | Replaced by the TS-aware variant. | | ||
| | `@typescript-eslint/no-unused-vars` | `error`, with `varsIgnorePattern` / `argsIgnorePattern` | Prefix a name with `_` (e.g. `_unused`, `_1`) or use an `ignored` / `Ignored` suffix to deliberately silence the rule for intentional placeholders. | | ||
| | `prettier/prettier` | `error` | Formatting violations fail lint. | | ||
| | `import/no-unresolved` | `error`, `commonjs: true` | Catches imports that won't resolve at runtime, including CJS `require` paths. | | ||
| | `n/no-unsupported-features/es-syntax` | `error`, `ignores: ["modules"]` | Flags ES syntax not supported by the configured Node target, but allows ES modules. | | ||
| | `n/no-missing-import` | `off` | Resolution is handled by `import/no-unresolved` + the TS resolver. | | ||
|
|
||
| ### Resolver settings | ||
|
|
||
| Imports are resolved via: | ||
|
|
||
| - `eslint-import-resolver-typescript` (uses each workspace's `tsconfig.json`) | ||
| - Node resolver, with extensions `.js`, `.jsx`, `.ts`, `.tsx` |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,3 @@ | ||
| //Declaration for @reality.eth/reality-eth-lib, which ships no TypeScript types and causes "noImplicitAny" errors. | ||
| //Remove this shim whenever the library exports types or is not needed. | ||
| declare module "@reality.eth/reality-eth-lib/formatters/question.js"; |
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| { | ||
| "*.{js,jsx,ts,tsx}": [ | ||
| "eslint --fix --no-error-on-unmatched-pattern", | ||
| "prettier --write --no-error-on-unmatched-pattern" | ||
| ] | ||
| } |
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.