Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
21 changes: 1 addition & 20 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
name: Build & Test
name: Build

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
build:
Expand All @@ -19,21 +17,4 @@ jobs:
node-version: '22'
cache: 'npm'
- run: npm install

- name: Check Prettier formatting
run: npx prettier --check src/
# Let fail for now
continue-on-error: true

- name: Run ESLint
run: npx eslint src/
# Let fail for now
continue-on-error: true

- run: npm run test-coverage
- run: npm run build

- name: Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
33 changes: 33 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Test & Lint

on:
pull_request:
branches: ['main']

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5

- name: Setup Node
uses: actions/setup-node@v6
with:
node-version: '22'
cache: 'npm'

- run: npm install

- name: Check Prettier formatting
run: npx prettier --check vite.config.ts src/

- name: Run ESLint
run: npx eslint vite.config.ts src/

- run: npm run test-coverage
- run: npm run build
- name: Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
8 changes: 4 additions & 4 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ export default defineConfig([
'react/jsx-uses-react': 'off',
'react/react-in-jsx-scope': 'off',
'react/no-unknown-property': ['error', { ignore: ['css'] }],
'no-unused-vars': [
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_',
argsIgnorePattern: '^_|^e$',
varsIgnorePattern: '^_|^e$',
caughtErrorsIgnorePattern: '^_|^e$',
},
],
// Turning these off for now to clean up warnings
Expand Down
6 changes: 2 additions & 4 deletions src/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,16 @@ export let routes: RouteObject[] = [];
export let router: ReturnType<typeof createBrowserRouter>;

if (element) {
const routes = [
routes = [
{
path: '/*',
element: (
<TsmlUI
google={element.getAttribute('data-google') || undefined}
// eslint-disable-next-line no-undef
settings={
typeof tsml_react_config === 'undefined'
? undefined
: // eslint-disable-next-line no-undef
tsml_react_config
: tsml_react_config
}
src={element.getAttribute('data-src') || undefined}
timezone={element.getAttribute('data-timezone') || undefined}
Expand Down
4 changes: 2 additions & 2 deletions src/components/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ export default function Button({
type === 'in-person'
? buttonDirectionsCss
: type === 'online'
? buttonJoinCss
: buttonCss
? buttonJoinCss
: buttonCss
}
href={href}
onClick={onClick}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Controls.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export default function Controls() {
distance:
mode === 'search'
? undefined
: input.distance ?? settings.distance_default,
: (input.distance ?? settings.distance_default),
mode,
region: mode === 'search' ? input.region : [],
search,
Expand Down
8 changes: 7 additions & 1 deletion src/components/Dropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,13 @@ import {

import { useNavigate } from 'react-router-dom';
import { formatUrl, getIndexByKey, formatString as i18n } from '../helpers';
import { type Data, useData, useInput, useLocation, useSettings } from '../hooks';
import {
type Data,
useData,
useInput,
useLocation,
useSettings,
} from '../hooks';
import { dropdownButtonCss, dropdownCss } from '../styles';
import type { Index } from '../types';

Expand Down
9 changes: 8 additions & 1 deletion src/components/Map.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,14 @@ import 'leaflet/dist/leaflet.css';
import { MapContainer, Marker, Popup, TileLayer, useMap } from 'react-leaflet';

import { formatDirectionsUrl } from '../helpers';
import { useData, useError, useFilter, useInput, useLocation, useSettings } from '../hooks';
import {
useData,
useError,
useFilter,
useInput,
useLocation,
useSettings,
} from '../hooks';
import { mapCss, mapPopupMeetingsCss } from '../styles';
import type { MapLocation } from '../types';
import Button from './Button';
Expand Down
14 changes: 7 additions & 7 deletions src/components/Meeting.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,13 @@ export default function Meeting() {
const feedback_url = meeting.feedback_url
? meeting.feedback_url
: feedback_emails.length
? formatFeedbackEmail({
feedback_emails,
meeting,
settings,
strings,
})
: undefined;
? formatFeedbackEmail({
feedback_emails,
meeting,
settings,
strings,
})
: undefined;

// format time string (duration? or appointment?)
const formatTime = (start?: DateTime, end?: DateTime) => {
Expand Down
9 changes: 8 additions & 1 deletion src/components/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,14 @@ import InfiniteScroll from 'react-infinite-scroller';
import { useNavigate } from 'react-router-dom';

import { formatUrl, formatString as i18n } from '../helpers';
import { useData, useError, useFilter, useInput, useLocation, useSettings } from '../hooks';
import {
useData,
useError,
useFilter,
useInput,
useLocation,
useSettings,
} from '../hooks';
import {
tableChicletCss,
tableChicletsCss,
Expand Down
2 changes: 0 additions & 2 deletions src/helpers/analytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,13 @@ export function analyticsEvent({
}) {
if (typeof gtag === 'function') {
//https://developers.google.com/analytics/devguides/collection/gtagjs/events
// eslint-disable-next-line no-undef
gtag('event', action, {
event_category: category,
event_label: label,
});
//console.log(`TSML UI recorded gtag event for "${label}"`);
} else if (typeof ga === 'function') {
//https://developers.google.com/analytics/devguides/collection/analyticsjs/events
// eslint-disable-next-line no-undef
ga('send', {
hitType: 'event',
eventCategory: category,
Expand Down
1 change: 1 addition & 0 deletions src/helpers/load-meeting-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ export function loadMeetingData(
conference_phone,
conference_phone_notes,
conference_url_notes,
// eslint-disable-next-line prefer-const
feedback_url,
formatted_address,
regions,
Expand Down
1 change: 1 addition & 0 deletions src/helpers/translate-google-sheet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export type GoogleSheetData = {
values: string[][];
};

// eslint-disable-next-line @typescript-eslint/no-explicit-any
export const isGoogleSheetData = (data: any): data is GoogleSheetData => {
return data && Array.isArray(data.values);
};
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/validate-input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const validateInput = (

if (weekday.includes('today')) {
const today = settings.weekdays[new Date().getDay()];
weekday = weekday.map(day => day === 'today' ? today : day);
weekday = weekday.map(day => (day === 'today' ? today : day));
}

const type = params.has('type')
Expand Down
11 changes: 3 additions & 8 deletions src/hooks/filter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,8 @@ export const FilterProvider = ({ children }: PropsWithChildren) => {
} else {
// get the union of other filters (Monday OR Tuesday)
matchGroups.push(
[].concat.apply(
[],
// @ts-expect-error TODO
input[filter].map(
key => getIndexByKey(indexes[filter], key)?.slugs ?? []
)
input[filter].flatMap(
key => getIndexByKey(indexes[filter], key)?.slugs ?? []
)
);
}
Expand Down Expand Up @@ -110,8 +106,7 @@ export const FilterProvider = ({ children }: PropsWithChildren) => {
andTerm.every(term => meetings[slug].search?.search(term) !== -1)
)
);
// @ts-expect-error TODO
matchGroups.push([].concat.apply([], matches));
matchGroups.push(matches);
Copy link
Contributor

Choose a reason for hiding this comment

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

nice

}
} else if (['me', 'location'].includes(input.mode)) {
// only show meetings with physical locations
Expand Down
Loading