- landing/eslint.config.js: ban imports from web-app paths (rule 1),
direct RPC clients from viem/@wagmi/vue (rule 2), and axios (rule 4)
- web-app/eslint.config.js: ban string interpolation inside GraphQL
query/mutation property values (rule 3); fixes 4 pre-existing violations
in usePositionDashboard, usePositions, useSnatchNotifications,
useWalletDashboard by migrating to variables: {} pattern
- services/ponder/eslint.config.js: ban findMany() calls that lack a
limit parameter to prevent unbounded indexed-data growth (rule 5)
All error messages follow the [what is wrong][rule][how to fix][where to
read more] template so agents and humans fix on the first try.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
89 lines
2.2 KiB
JavaScript
89 lines
2.2 KiB
JavaScript
import eslint from '@eslint/js';
|
|
import tseslint from '@typescript-eslint/eslint-plugin';
|
|
import tsparser from '@typescript-eslint/parser';
|
|
import eslintConfigPrettier from 'eslint-config-prettier';
|
|
|
|
export default [
|
|
eslint.configs.recommended,
|
|
{
|
|
files: ['**/*.ts'],
|
|
languageOptions: {
|
|
parser: tsparser,
|
|
parserOptions: {
|
|
project: './tsconfig.json',
|
|
tsconfigRootDir: import.meta.dirname,
|
|
},
|
|
globals: {
|
|
process: 'readonly',
|
|
console: 'readonly',
|
|
Context: 'readonly',
|
|
},
|
|
},
|
|
plugins: {
|
|
'@typescript-eslint': tseslint,
|
|
},
|
|
rules: {
|
|
// TypeScript
|
|
'@typescript-eslint/no-explicit-any': 'error',
|
|
'@typescript-eslint/no-unused-vars': [
|
|
'error',
|
|
{
|
|
argsIgnorePattern: '^_',
|
|
varsIgnorePattern: '^_',
|
|
},
|
|
],
|
|
'@typescript-eslint/naming-convention': [
|
|
'error',
|
|
{
|
|
selector: 'function',
|
|
format: ['camelCase'],
|
|
},
|
|
{
|
|
selector: 'variable',
|
|
format: ['camelCase', 'UPPER_CASE'],
|
|
},
|
|
{
|
|
selector: 'typeLike',
|
|
format: ['PascalCase'],
|
|
},
|
|
],
|
|
|
|
// Style
|
|
'prefer-const': 'error',
|
|
indent: ['error', 2, { SwitchCase: 1 }],
|
|
'max-len': [
|
|
'error',
|
|
{
|
|
code: 140,
|
|
ignoreStrings: true,
|
|
ignoreTemplateLiterals: true,
|
|
ignoreUrls: true,
|
|
},
|
|
],
|
|
|
|
// Console
|
|
'no-console': 'error',
|
|
|
|
// Complexity (off)
|
|
complexity: 'off',
|
|
'max-depth': 'off',
|
|
'max-nested-callbacks': 'off',
|
|
'max-params': 'off',
|
|
'max-statements': 'off',
|
|
},
|
|
},
|
|
{
|
|
name: 'arch/ponder-bounded-queries',
|
|
rules: {
|
|
'no-restricted-syntax': [
|
|
'error',
|
|
{
|
|
selector: "CallExpression[callee.property.name='findMany']:not(:has(Property[key.name='limit']))",
|
|
message:
|
|
"Ponder findMany() called without a limit parameter. Unbounded queries will grow without limit as the chain is indexed — never use findMany() without a limit. Always specify `limit` in the options object. Use the ring buffer pattern from docs/ARCHITECTURE.md.",
|
|
},
|
|
],
|
|
},
|
|
},
|
|
eslintConfigPrettier,
|
|
];
|