2025-10-04 15:40:30 +02:00
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 : [ 'src/**/*.ts' ] ,
languageOptions : {
parser : tsparser ,
parserOptions : {
ecmaVersion : 2022 ,
sourceType : 'module' ,
project : './tsconfig.json' ,
} ,
globals : {
process : 'readonly' ,
fetch : 'readonly' ,
setInterval : 'readonly' ,
2025-11-08 10:39:27 +00:00
NodeJS : 'readonly' ,
2025-10-04 15:40:30 +02:00
} ,
} ,
plugins : {
'@typescript-eslint' : tseslint ,
} ,
rules : {
indent : [ 'error' , 2 , { SwitchCase : 1 } ] ,
'max-len' : [ 'error' , { code : 140 , ignoreUrls : true , ignoreStrings : true } ] ,
'no-unused-vars' : 'off' ,
'@typescript-eslint/no-unused-vars' : [
'error' ,
{
argsIgnorePattern : '^_' ,
varsIgnorePattern : '^_' ,
} ,
] ,
'@typescript-eslint/no-explicit-any' : 'error' ,
'@typescript-eslint/explicit-function-return-type' : [ 'error' , { allowExpressions : true } ] ,
'@typescript-eslint/naming-convention' : [
'error' ,
{
selector : 'variable' ,
format : [ 'camelCase' , 'UPPER_CASE' ] ,
filter : {
regex : '^__' ,
match : false ,
} ,
} ,
{
selector : 'function' ,
format : [ 'camelCase' ] ,
} ,
{
selector : 'typeLike' ,
format : [ 'PascalCase' ] ,
} ,
] ,
'no-console' : 'error' ,
complexity : 'off' ,
'max-lines' : 'off' ,
'max-statements' : 'off' ,
} ,
} ,
2026-03-03 20:58:01 +00:00
{
name : 'arch/no-fixed-delays' ,
rules : {
'no-restricted-syntax' : [
'error' ,
{
selector : "CallExpression[callee.property.name='waitForTimeout']" ,
message :
'[BANNED] waitForTimeout is a fixed delay. → Subscribe to events instead (eth_newFilter for on-chain, waitForSelector/waitForURL for DOM). → Polling with timeout is acceptable only if no event source exists. → See AGENTS.md #Engineering Principles.' ,
} ,
{
selector :
"NewExpression[callee.name='Promise'] > ArrowFunctionExpression CallExpression[callee.name='setTimeout']" ,
message :
'[BANNED] Promise+setTimeout sleep pattern. → Use event subscription or polling with timeout instead. → See AGENTS.md #Engineering Principles.' ,
} ,
] ,
} ,
} ,
2025-10-04 15:40:30 +02:00
eslintConfigPrettier ,
] ;