Skip to content

Commit

Permalink
Merge pull request #137 from autonomys/feat/af-lint
Browse files Browse the repository at this point in the history
Feat/af lint
  • Loading branch information
Xm0onh authored Jan 14, 2025
2 parents d813a18 + 1452cfb commit e9cac6c
Show file tree
Hide file tree
Showing 4 changed files with 7,485 additions and 4,180 deletions.
1 change: 0 additions & 1 deletion auto-agents-framework/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@ config/
dsn-kol-schemas.json
memories/
!src/config/

113 changes: 113 additions & 0 deletions auto-agents-framework/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
import globals from "globals";
import pluginJs from "@eslint/js";
import tseslint from "typescript-eslint";
import prettier from "eslint-plugin-prettier";
import eslintConfigPrettier from "eslint-config-prettier";

/** @type {import('eslint').Linter.Config[]} */
export default [
// TypeScript files configuration
{
files: ["**/*.ts"],
languageOptions: {
ecmaVersion: 2022,
sourceType: "module",
globals: {
...globals.node,
...globals.browser
},
parser: tseslint.parser,
parserOptions: {
project: "./tsconfig.json",
sourceType: "module"
}
},
plugins: {
"@typescript-eslint": tseslint.plugin,
prettier: prettier
},
rules: {
// TypeScript specific rules
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/no-unused-vars": ["warn", {
"argsIgnorePattern": "^_",
"varsIgnorePattern": "^_"
}],
"@typescript-eslint/no-non-null-assertion": "warn",

// General rules
"no-console": ["warn", { allow: ["warn", "error", "info"] }],
"prettier/prettier": "error",

// Character file specific rules
"no-template-curly-in-string": "error",
"no-multi-str": "error",
"prefer-template": "error",
"quotes": ["error", "single", { "avoidEscape": true }],

// Import rules
"sort-imports": ["error", {
"ignoreCase": true,
"ignoreDeclarationSort": true
}]
}
},

// JavaScript files configuration
{
files: ["**/*.{js,mjs,cjs}"],
languageOptions: {
ecmaVersion: 2022,
sourceType: "module",
globals: {
...globals.node,
...globals.browser
}
},
plugins: {
prettier: prettier
},
rules: {
// General rules
"no-console": ["warn", { allow: ["warn", "error", "info"] }],
"prettier/prettier": "error",

// Character file specific rules
"no-template-curly-in-string": "error",
"no-multi-str": "error",
"prefer-template": "error",
"quotes": ["error", "single", { "avoidEscape": true }],

// Import rules
"sort-imports": ["error", {
"ignoreCase": true,
"ignoreDeclarationSort": true
}]
}
},

// Prettier configuration
eslintConfigPrettier,

// Additional configurations for specific file patterns
{
files: ["src/agents/workflows/kol/characters/*.ts"],
rules: {
// Character file specific validations
"@typescript-eslint/naming-convention": [
"error",
{
"selector": "variable",
"format": ["camelCase"],
"filter": {
"regex": "^(name|username|description|personality|expertise|rules|trendFocus|contentFocus|replyStyle|wordsToAvoid|engagementCriteria|walletAddress)$",
"match": true
}
}
],
"no-multi-str": "error",
"no-template-curly-in-string": "error"
}
}
];
24 changes: 18 additions & 6 deletions auto-agents-framework/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@
"copy-characters": "cp -r src/agents/workflows/kol/characters dist/agents/workflows/kol/",
"test": "jest",
"test:watch": "jest --watch",
"test:coverage": "jest --coverage"
"test:coverage": "jest --coverage",
"lint": "eslint \"src/**/*.{js,ts}\"",
"lint:fix": "eslint \"src/**/*.{js,ts}\" --fix",
"lint:characters": "eslint \"src/agents/workflows/kol/characters/*.ts\"",
"lint:characters:fix": "eslint \"src/agents/workflows/kol/characters/*.ts\" --fix"
},
"dependencies": {
"@autonomys/auto-dag-data": "1.2.1",
Expand All @@ -34,16 +38,24 @@
"zod-to-json-schema": "^3.24.1"
},
"devDependencies": {
"@eslint/js": "^9.18.0",
"@tsconfig/node20": "^20.1.4",
"@types/jest": "^29.5.12",
"@types/node": "22.10.0",
"@types/sqlite3": "^3.1.11",
"@typescript-eslint/eslint-plugin": "^8.20.0",
"@typescript-eslint/parser": "^8.20.0",
"eslint": "^9.18.0",
"eslint-config-prettier": "^10.0.1",
"eslint-plugin-prettier": "^5.2.1",
"glob": "^10.3.10",
"globals": "^15.14.0",
"jest": "^29.7.0",
"memfs": "^4.7.7",
"prettier": "^3.2.2",
"ts-jest": "^29.1.2",
"tsx": "^4.7.1",
"typescript": "^5.3.3",
"@types/jest": "^29.5.12",
"jest": "^29.7.0",
"ts-jest": "^29.1.2",
"glob": "^10.3.10",
"memfs": "^4.7.7"
"typescript-eslint": "^8.20.0"
}
}
Loading

0 comments on commit e9cac6c

Please sign in to comment.