Skip to content

Commit

Permalink
feat: Add lint and prettier check in workflow (#955)
Browse files Browse the repository at this point in the history
Co-authored-by: Himanshu Dixit <[email protected]>
  • Loading branch information
plxity and himanshu-dixit authored Dec 9, 2024
1 parent 5d7a303 commit 7dce021
Show file tree
Hide file tree
Showing 92 changed files with 12,636 additions and 10,346 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/lint_js.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Check Linting and Formatting (JS)

on:
push:
paths:
- '**/*.js'
- '**/*.ts'
pull_request:
paths:
- '**/*.js'
- '**/*.ts'

jobs:
lint-and-prettify:
runs-on: ubuntu-latest

defaults:
run:
working-directory: js

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Install pnpm
run: npm install -g pnpm

- name: Install packages in js folder
run: pnpm install --frozen-lockfile

- name: Run ESLint
run: pnpm run eslint
continue-on-error: false

- name: Run Prettier
run: pnpm run prettier:check
continue-on-error: false
24 changes: 24 additions & 0 deletions js/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@

{
"arrowParens": "always",
"bracketSpacing": true,
"endOfLine": "lf",
"htmlWhitespaceSensitivity": "css",
"insertPragma": false,
"singleAttributePerLine": false,
"bracketSameLine": false,
"jsxBracketSameLine": false,
"jsxSingleQuote": false,
"printWidth": 80,
"proseWrap": "preserve",
"quoteProps": "as-needed",
"requirePragma": false,
"semi": true,
"singleQuote": false,
"tabWidth": 2,
"trailingComma": "es5",
"useTabs": false,
"embeddedLanguageFormatting": "auto",
"vueIndentScriptAndStyle": false,
"experimentalTernaries": false
}
21 changes: 12 additions & 9 deletions js/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,30 +1,34 @@
import globals from "globals";
import pluginJs from "@eslint/js";
import tseslint from "typescript-eslint";
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';


/** @type {import('eslint').Linter.Config[]} */
export default [
{languageOptions: { globals: globals.node },},
pluginJs.configs.recommended,
// eslintPluginPrettierRecommended,
{files: ["src/**/*.{ts,js}"]},
{languageOptions: { globals: globals.browser }},
...tseslint.configs.recommended,
{
rules: {
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/no-require-imports": "warn",
"@typescript-eslint/no-unsafe-function-type": "off",
"no-prototype-builtins": "off",
"@typescript-eslint/ban-types": "error",
"max-lines-per-function": ["error", 250],
"no-unused-vars": "off",
"@typescript-eslint/ban-ts-comment": "off",
"no-constant-condition": "off",
"no-ex-assign": "off",
"no-constant-binary-expression": "off",
"@typescript-eslint/no-empty-object-type": "warn",
"@typescript-eslint/no-non-null-asserted-optional-chain": "off",
"no-unsafe-optional-chaining": "off",
"no-extra-boolean-cast": "off",
"no-console": "error",
"no-var": "warn",
"prefer-const": "warn",
"no-console": "warn",
"@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/no-unused-vars": [
"warn", // or "error"
"warn",
{
"argsIgnorePattern": "^_",
"varsIgnorePattern": "^_",
Expand All @@ -34,4 +38,3 @@ export default [
},
},
];

65 changes: 35 additions & 30 deletions js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "composio-core",
"version": "0.3.2",
"description": "",
"main": "dist/src/index.js",
"main": "dist/index.js",
"scripts": {
"test": "jest --testMatch=\"**/*.spec.ts\"",
"test:watch": "jest --testMatch=\"**/*.spec.ts\" --watch",
Expand All @@ -11,14 +11,16 @@
"openapispec:generate": "npx @hey-api/openapi-ts",
"run:cli": "ts-node src/cli/index.ts",
"run:sample": "ts-node sample.ts",
"build": "rollup -c rollup.config.mjs",
"eslint": "eslint 'src/**/*.{ts,js}' --max-warnings=281",
"prettier": "prettier --write 'src/**/*.{ts,js,cjs}'",
"prettier:check": "prettier --check 'src/**/*.{ts,js,mjs,cjs}'",
"build": "rollup -c rollup.config.mjs && ./setup_cli.sh",
"lint": "eslint 'src/**/*.ts'",
"prettier": "prettier --write 'src/**/*.ts'",
"format": "pnpm lint && pnpm prettier"
},
"bin": {
"composio-js": "./dist/src/cli/index",
"composio": "./dist/src/cli/index"
"composio-js": "./dist/cli/index",
"composio": "./dist/cli/index"
},
"lint-staged": {
"src/**/*.{js,jsx,ts,tsx}": "eslint --fix"
Expand All @@ -27,11 +29,22 @@
"author": "Utkarsh Dixit <[email protected]>",
"license": "ISC",
"devDependencies": {
"@ai-sdk/openai": "^0.0.36",
"@cloudflare/workers-types": "^4.20240718.0",
"@e2b/code-interpreter": "^0.0.8",
"@e2b/sdk": "^0.16.1",
"@eslint/js": "^9.16.0",
"@faker-js/faker": "^8.4.1",
"@hey-api/client-axios": "^0.2.3",
"@hey-api/openapi-ts": "^0.52.4",
"@hono/node-server": "^1.12.0",
"@jest/globals": "^29.7.0",
"@rollup/plugin-commonjs": "^25.0.7",
"@langchain/core": "^0.2.18",
"@langchain/openai": "^0.2.5",
"@rollup/plugin-commonjs": "^25.0.8",
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-replace": "^6.0.1",
"@rollup/plugin-typescript": "^11.1.6",
"@swc/core": "^1.7.10",
"@swc/helpers": "^0.5.12",
Expand All @@ -42,53 +55,45 @@
"@types/node": "^20.14.2",
"@types/uuid": "^10.0.0",
"@types/winston": "^2.4.4",
"axios-mock-adapter": "^2.1.0",
"jest": "^29.7.0",
"jest-html-reporters": "^3.1.7",
"regenerator-runtime": "^0.14.1",
"rollup": "^4.9.1",
"rollup-plugin-dts": "^6.1.0",
"ts-jest": "^29.1.2",
"ts-loader": "^9.5.1",
"tslib": "^2.6.2",
"typedoc": "^0.25.13",
"typescript": "^5.4.5",
"wrangler": "^3.63.1",
"@ai-sdk/openai": "^0.0.36",
"@e2b/code-interpreter": "^0.0.8",
"@e2b/sdk": "^0.16.1",
"@faker-js/faker": "^8.4.1",
"@hey-api/client-axios": "^0.2.3",
"@hono/node-server": "^1.12.0",
"@langchain/core": "^0.2.18",
"@langchain/openai": "^0.2.5",
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-replace": "^6.0.1",
"ai": "^3.2.22",
"axios": "^1.7.2",
"axios-mock-adapter": "^2.1.0",
"chalk": "^4",
"cli-progress": "^3.12.0",
"colors": "^1.4.0",
"commander": "^12.1.0",
"dockerode": "^4.0.2",
"e2b": "^0.16.1",
"enumify": "^2.0.0",
"eslint": "^9.16.0",
"globals": "^15.13.0",
"hono": "^4.4.11",
"inquirer": "^10.2.2",
"jest": "^29.7.0",
"jest-html-reporters": "^3.1.7",
"langchain": "^0.2.11",
"open": "^8.4.0",
"openai": "^4.50.0",
"prettier": "^3.4.2",
"pusher-js": "8.4.0-rc2",
"regenerator-runtime": "^0.14.1",
"resolve-package-path": "^4.0.3",
"rollup": "^4.9.1",
"rollup-plugin-dts": "^6.1.0",
"rollup-plugin-terser": "^7.0.2",
"ts-jest": "^29.1.2",
"ts-loader": "^9.5.1",
"ts-node": "^10.9.2",
"tslib": "^2.6.2",
"typedoc": "^0.25.13",
"typescript": "^5.4.5",
"typescript-eslint": "^8.17.0",
"uuid": "^10.0.0",
"winston": "^3.13.1",
"wrangler": "^3.63.1",
"zod": "^3.23.8",
"zod-to-json-schema": "^3.23.2"
},
"dependencies": {
},
"publishConfig": {
"access": "public"
}
Expand Down
Loading

0 comments on commit 7dce021

Please sign in to comment.