Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: remove eslint, use biome. #9

Merged
merged 2 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .eslintignore

This file was deleted.

35 changes: 0 additions & 35 deletions .eslintrc.json

This file was deleted.

5 changes: 0 additions & 5 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@ updates:
labels:
- "npm"
- "dependencies"
groups:
linter:
patterns:
- "eslint*"
- "@typescript-eslint*"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
Expand Down
10 changes: 4 additions & 6 deletions .github/workflows/eslint.yml → .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Linting with ESLint
name: Build and Lint

on:
push:
Expand All @@ -11,14 +11,12 @@ jobs:
timeout-minutes: 5
strategy:
matrix:
node-version: [18.x, 20.x]
node-version: [18.x, 20.x, 22.x]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Install modules
run: npm install
- name: Run ESLint
run: npm run lint
- run: npm install
- run: npm test
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ npm install
npm start
```

### Linting
### Testing

Run ESLint for code formatting and linting:
Run the TypeScript compilation, code formatting and linting:

```zsh
npm run lint
npm test
```

## Using Steps in Workflow Builder
Expand Down
6 changes: 5 additions & 1 deletion app.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { App, BlockAction, LogLevel } from '@slack/bolt';
import { App, type BlockAction, LogLevel } from '@slack/bolt';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👨‍🍳 🤌 just a pinch of BlockAction here

import { config } from 'dotenv';

config();
Expand Down Expand Up @@ -51,15 +51,19 @@ app.action<BlockAction>('sample_button', async ({ body, client, complete, fail }
// Functions should be marked as successfully completed using `complete` or
// as having failed using `fail`, else they'll remain in an 'In progress' state.
// Learn more at https://api.slack.com/automation/interactive-messages
// biome-ignore lint/style/noNonNullAssertion: we know this button comes from a function, so `fail` is available.
await complete!({ outputs: { user_id: user.id } });

await client.chat.update({
// biome-ignore lint/style/noNonNullAssertion: we know this button was posted to a channel, so `channel` is available.
channel: channel!.id,
// biome-ignore lint/style/noNonNullAssertion: we know this button was posted to a channel, so `message` is available.
ts: message!.ts,
text: 'Function completed successfully!',
});
} catch (error) {
console.error(error);
// biome-ignore lint/style/noNonNullAssertion: we know this button comes from a function, so `fail` is available.
fail!({ error: `Failed to handle a function request: ${error}` });
}
});
Expand Down
32 changes: 32 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"$schema": "https://biomejs.dev/schemas/1.8.3/schema.json",
"formatter": {
"enabled": true,
"formatWithErrors": false,
"ignore": [],
"attributePosition": "auto",
"indentStyle": "space",
"indentWidth": 2,
"lineWidth": 120,
"lineEnding": "lf"
},
"javascript": {
"formatter": {
"quoteStyle": "single"
}
},
"linter": {
"enabled": true,
"rules": {
"recommended": true
}
},
"organizeImports": {
"enabled": true
},
"vcs": {
"enabled": true,
"clientKind": "git",
"useIgnoreFile": true
}
}
Loading