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

Linter #119

Merged
merged 11 commits into from
Feb 11, 2025
Merged
Show file tree
Hide file tree
Changes from 6 commits
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
43 changes: 36 additions & 7 deletions .github/workflows/just_do_it.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
workflow_dispatch:

jobs:
checkout_and_install:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -16,9 +16,38 @@
with:
node-version: lts/*

- name: Install dependencies
run: |
npm ci
npm run lint
npm run test
npm run build
- name: Clean Install
run: npm ci

- name: Lint
run: npm run lint

test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: lts/*

- name: Clean Install
run: npm ci

- name: Test
run: npm run test

build:
Comment on lines +26 to +40

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions Job or Workflow does not set permissions
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: lts/*

- name: Clean Install
run: npm ci

- name: Build
run: npm run build
Comment on lines +41 to +53

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions Job or Workflow does not set permissions
3 changes: 3 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
npm run lint
npm run build
npm run test
19 changes: 9 additions & 10 deletions app.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import { installStore } from '@/lib/services';

import { App } from '@slack/bolt';
import { LogLevel } from '@slack/logger';

import { config } from '@/config';
import { healthEndpoint } from '@/lib/routes/health';
import { logger as customLogger } from '@/logger';
import { withNamespace } from '@/logger';

import '@/lib/stringExtensions';
import '@/lib/dateExtensions';
Expand Down Expand Up @@ -36,6 +34,7 @@ import { register as shortcutsRegister } from '@/shortcuts';
import { installService } from '@/lib/services';
import { pointdPalInstallationStore } from '@/lib/installationStore';

const appLogger = withNamespace('pointd-pal');
const app = new App({
signingSecret: config.get('slack.signingSecret'),
clientId: config.get('slack.clientId'),
Expand Down Expand Up @@ -78,23 +77,23 @@ const app = new App({
logger: {
getLevel: () => config.get('logLevel') as LogLevel,
setLevel: (level: LogLevel) => config.set('logLevel', level),
debug: (...msg) => customLogger.debug(msg),
info: (...msg) => customLogger.info(msg),
warn: (...msg) => customLogger.warn(msg),
error: (...msg) => customLogger.error(msg),
setName: (name: string) => customLogger.label(name),
debug: (...msg) => appLogger.debug(msg),
info: (...msg) => appLogger.info(msg),
warn: (...msg) => appLogger.warn(msg),
error: (...msg) => appLogger.error(msg),
setName: (name: string) => appLogger.label(name),
},
});

void (async () => {
customLogger.info(
appLogger.info(
'Before we start the apps we will validate that all installations are up to date by running migrations. Please hold on...',
);
await installService.migrateAll();
// Start your app
await app.start({ port: config.get('port') });

customLogger.info(`⚡️ Bolt app is running at localhost:${config.get('port')}!`);
appLogger.info(`⚡️ Bolt app is running at localhost:${config.get('port')}!`);
})();

messagesCryptoRegister(app);
Expand Down
7 changes: 1 addition & 6 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
services:
pointd-pal:
container_name: pointd-pal
build:
context: .
dockerfile: Dockerfile
image: ghcr.io/o-mutt/pointd-pal:latest
ports:
- 3000:3000
volumes:
- ./:/home/node/app
- /home/node/app/node_modules
environment:
- CHOKIDAR_USEPOLLING=true
depends_on:
Expand Down
11 changes: 10 additions & 1 deletion eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended'
import jestPlugin from 'eslint-plugin-jest';
import tseslint from 'typescript-eslint';
import eslint from '@eslint/js';
import globals from 'globals';

export default tseslint.config(
{
Expand Down Expand Up @@ -30,8 +31,16 @@ export default tseslint.config(
},
{
// enable jest rules on test files
files: ['test/**', '**/*.test.ts', '**/*.spec.ts'],
files: ['test/**', '**/*.test.*', '**/*.spec.*'],
extends: [jestPlugin.configs['flat/recommended']],
rules: {
'@typescript-eslint/no-floating-promises': 'off',
},
languageOptions: {
globals: {
...globals.node,
},
},
},
{
// ignore unused vars if they are prefixed with _
Expand Down
7 changes: 7 additions & 0 deletions lint-staged.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const config = {
// eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
'*': (stagedFiles) => `eslint ${stagedFiles.join(' ')}`,
'*.ts': 'npm run build',
};

export default config;
Loading
Loading