Skip to content

Commit ea571de

Browse files
fix: eslint (#12)
* chore: eslint config setup * chore: updated the build test workflow * chore: setup pnpm workflow * chore: build errors * chore: updated the push step
1 parent e641778 commit ea571de

File tree

9 files changed

+389
-294
lines changed

9 files changed

+389
-294
lines changed

.github/workflows/build-test.yaml

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,33 @@
1-
name: Publish Node SDK to npm
1+
name: Build and Test Node SDK
22

33
on:
44
pull_request:
55
branches:
66
- main
7-
7+
types: ["opened", "synchronize", "reopened"]
88
jobs:
9-
build:
9+
build-lint:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- uses: actions/checkout@v4
13+
14+
- name: Set up Node.js
15+
uses: actions/setup-node@v4
16+
17+
- name: Enable corepack
18+
run: corepack enable pnpm
19+
1320
- name: Install dependencies
14-
run: pnpm install
21+
run: pnpm install --frozen-lockfile
22+
23+
- name: Run lint
24+
run: pnpm run check:lint
25+
26+
- name: Run format
27+
run: pnpm run check:format
28+
29+
- name: Run build
30+
run: pnpm run build
31+
32+
- name: Run tests
33+
run: pnpm run test

eslint.config.mjs

Lines changed: 42 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,45 @@
1-
import js from "@eslint/js";
21
import globals from "globals";
2+
import pluginJs from "@eslint/js";
33
import tseslint from "typescript-eslint";
4-
import { defineConfig } from "eslint/config";
4+
import unusedImports from "eslint-plugin-unused-imports";
55

6-
export default defineConfig([
7-
{ files: ["**/*.{js,mjs,cjs,ts,mts,cts}"], plugins: { js }, extends: ["js/recommended"] },
8-
{ files: ["**/*.{js,mjs,cjs,ts,mts,cts}"], languageOptions: { globals: globals.browser } },
9-
tseslint.configs.recommended,
10-
]);
6+
export default [
7+
{
8+
files: ["**/*.ts", "**/*.js"],
9+
languageOptions: {
10+
globals: globals.node,
11+
},
12+
},
13+
pluginJs.configs.recommended,
14+
...tseslint.configs.recommended,
15+
{
16+
plugins: {
17+
"unused-imports": unusedImports,
18+
},
19+
rules: {
20+
// Set the rule severity to "warn" (or 1) for explicit any types
21+
"@typescript-eslint/no-explicit-any": "warn",
22+
23+
// Disable the core ESLint and TypeScript no-unused-vars rules
24+
"no-unused-vars": "off",
25+
"@typescript-eslint/no-unused-vars": "off",
26+
27+
// Use the correct rule names from the unused-imports plugin
28+
"unused-imports/no-unused-imports": "error",
29+
"unused-imports/no-unused-vars": [
30+
"warn",
31+
{
32+
vars: "all",
33+
varsIgnorePattern: "^_",
34+
args: "after-used",
35+
argsIgnorePattern: "^_",
36+
},
37+
],
38+
// Standard ESLint rules from the built-in configs are available
39+
"no-console": "warn",
40+
"no-undef": "error",
41+
"no-unused-expressions": "error",
42+
"no-unused-labels": "error",
43+
},
44+
},
45+
];

package.json

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
"description": "Node.js SDK for Plane API",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",
7+
"files": [
8+
"dist/**/*",
9+
"README.md"
10+
],
711
"scripts": {
812
"build": "tsc",
913
"dev": "tsc --watch",
@@ -13,9 +17,11 @@
1317
"test:all": "pnpm test:unit && pnpm test:e2e",
1418
"test:watch": "jest --watch",
1519
"test:coverage": "jest --coverage",
16-
"lint": "eslint src/**/*.ts",
17-
"format": "prettier --write src/**/*.ts",
18-
"clean": "rm -rf dist"
20+
"clean": "rm -rf dist && rm -rf node_modules",
21+
"check:lint": "eslint src/**/*.ts",
22+
"fix:lint": "eslint src/**/*.ts --fix",
23+
"check:format": "prettier --check src/**/*.ts",
24+
"fix:format": "prettier --write src/**/*.ts"
1925
},
2026
"keywords": [
2127
"plane",
@@ -31,22 +37,22 @@
3137
"ts-jest": "^29.4.4"
3238
},
3339
"devDependencies": {
40+
"@eslint/js": "^9.38.0",
3441
"@types/jest": "^29.0.0",
3542
"@types/node": "^20.0.0",
36-
"@typescript-eslint/eslint-plugin": "^6.0.0",
37-
"@typescript-eslint/parser": "^6.0.0",
38-
"eslint": "^8.0.0",
43+
"@typescript-eslint/eslint-plugin": "^8.46.2",
44+
"@typescript-eslint/parser": "^8.46.2",
45+
"eslint": "9.38.0",
46+
"eslint-plugin-unused-imports": "^4.3.0",
47+
"globals": "^16.4.0",
3948
"jest": "^29.0.0",
40-
"prettier": "^3.0.0",
49+
"prettier": "3.6.2",
4150
"ts-node": "^10.9.0",
42-
"typescript": "^5.0.0"
51+
"typescript": "5.9.3",
52+
"typescript-eslint": "^8.46.2"
4353
},
44-
"files": [
45-
"dist/**/*",
46-
"README.md"
47-
],
48-
"packageManager": "[email protected]",
54+
"packageManager": "[email protected]",
4955
"engines": {
50-
"node": ">=16.0.0"
56+
"node": ">=20.0.0"
5157
}
5258
}

0 commit comments

Comments
 (0)