Skip to content

Commit

Permalink
added github action to verify linting and formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
plxity committed Dec 5, 2024
1 parent ba8a2fc commit 2c000e5
Show file tree
Hide file tree
Showing 11 changed files with 822 additions and 34 deletions.
3 changes: 0 additions & 3 deletions .git-blame-ignore-revs

This file was deleted.

38 changes: 38 additions & 0 deletions .github/workflows/lint_js.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Check Linting and Formatting (JS)

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

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

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

- 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: cd js && pnpm install --frozen-lockfile

- name: Run ESLint
run: pnpm run lint --config
continue-on-error: false

- name: Run Prettier
run: pnpm run prettier:check
continue-on-error: false
36 changes: 36 additions & 0 deletions js/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import globals from "globals";
import tseslint from "typescript-eslint";


/** @type {import('eslint').Linter.Config[]} */
export default [
{files: ["**/*.{js,mjs,cjs,ts}"]},
{languageOptions: { globals: globals.browser }},
...tseslint.configs.recommended,
{
rules: {
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/no-require-imports": "warn",
"no-prototype-builtins": "off",
"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-non-null-asserted-optional-chain": "off",
"no-unsafe-optional-chaining": "off",
"no-extra-boolean-cast": "off",
"no-console": "warn",
"@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/no-unused-vars": [
"warn", // or "error"
{
"argsIgnorePattern": "^_",
"varsIgnorePattern": "^_",
"caughtErrorsIgnorePattern": "^_"
}
]
},
},
];
11 changes: 8 additions & 3 deletions js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
"openapispec:generate": "npx @hey-api/openapi-ts",
"run:cli": "ts-node src/cli/index.ts",
"run:sample": "ts-node sample.ts",
"eslint": "eslint src/**/*.{ts,js}",
"prettier": "prettier --write src/**/*.{ts,js}"
"eslint": "eslint src/**/*.{ts,js} --max-warnings=177",
"prettier": "prettier --write src/**/*.{ts,js}",
"prettier:check": "prettier --check src/**/*.{ts,js}"
},
"bin": {
"composio-js": "./lib/src/cli/index",
Expand All @@ -25,6 +26,7 @@
"license": "ISC",
"devDependencies": {
"@cloudflare/workers-types": "^4.20240718.0",
"@eslint/js": "^9.16.0",
"@hey-api/openapi-ts": "^0.52.4",
"@jest/globals": "^29.7.0",
"@swc/core": "^1.7.10",
Expand All @@ -37,15 +39,19 @@
"@types/uuid": "^10.0.0",
"@types/winston": "^2.4.4",
"clean-webpack-plugin": "^4.0.0",
"eslint": "^9.16.0",
"fork-ts-checker-webpack-plugin": "^9.0.2",
"globals": "^15.13.0",
"jest": "^29.7.0",
"jest-html-reporters": "^3.1.7",
"prettier": "^3.4.2",
"regenerator-runtime": "^0.14.1",
"terser-webpack-plugin": "^5.3.10",
"ts-jest": "^29.1.2",
"ts-loader": "^9.5.1",
"typedoc": "^0.25.13",
"typescript": "^5.4.5",
"typescript-eslint": "^8.17.0",
"webpack": "^5.91.0",
"webpack-cli": "^5.1.4",
"wrangler": "^3.63.1"
Expand Down Expand Up @@ -73,7 +79,6 @@
"langchain": "^0.2.11",
"open": "^8.4.0",
"openai": "^4.50.0",
"prettier": "^3.4.2",
"pusher-js": "8.4.0-rc2",
"resolve-package-path": "^4.0.3",
"ts-node": "^10.9.2",
Expand Down
Loading

0 comments on commit 2c000e5

Please sign in to comment.