diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..3c51ced --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,27 @@ +name: lint + +on: + push: + branches: ["main", "master"] + pull_request: + branches: ["main", "master"] + +jobs: + eslint: + runs-on: ubuntu-latest + name: ESLint + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 22 + + - name: Install dependencies + run: npm install + + - name: Lint + run: npm run lint diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 0000000..f4e401c --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,14 @@ +import tseslint from 'typescript-eslint' + +export default tseslint.config( + { + ignores: ['build/**', 'node_modules/**'], + }, + ...tseslint.configs.recommended, + { + rules: { + '@typescript-eslint/no-explicit-any': 'warn', + '@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }], + }, + } +) diff --git a/package.json b/package.json index 0f0998f..08706ec 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,7 @@ ], "scripts": { "build": "tsc", + "lint": "eslint .", "test": "npx tsx --test tests/**/*.test.ts", "prepublishOnly": "npm run build" }, @@ -27,8 +28,10 @@ }, "devDependencies": { "@types/node": "^20.19.37", + "eslint": "^9.0.0", "tsx": "^4.21.0", - "typescript": "^5.9.3" + "typescript": "^5.9.3", + "typescript-eslint": "^8.0.0" }, "license": "MIT" }