ci: fix eslint parser devDeps, typed linting config, prettier formatting

- Add @typescript-eslint/parser and @typescript-eslint/eslint-plugin as
  direct devDependencies (were only transitive, not linked in node_modules)
- Add files pattern and parserOptions.project to eslint.config.mjs so
  ESLint finds and type-checks src/**/*.ts files correctly
- Run prettier --write to fix formatting across all src files
This commit is contained in:
Aric Camarata 2026-05-31 08:47:17 -04:00
parent 429c176a5e
commit 6f165b79ad
13 changed files with 102 additions and 90 deletions

View file

@ -5,10 +5,14 @@ import { typescript } from '@acamarata/eslint-config';
export default [
{
files: ['src/**/*.ts'],
plugins: { '@typescript-eslint': tsPlugin },
languageOptions: { parser: tsParser },
languageOptions: {
parser: tsParser,
parserOptions: { project: true, tsconfigRootDir: import.meta.dirname },
},
},
...typescript,
...typescript.map((cfg) => ({ ...cfg, files: ['src/**/*.ts'] })),
eslintConfigPrettier,
{
ignores: ['dist/', 'node_modules/', 'test.mjs', 'test-cjs.cjs'],

View file

@ -74,11 +74,13 @@
},
"devDependencies": {
"@acamarata/eslint-config": "^0.1.0",
"c8": "^10.1.3",
"@acamarata/prettier-config": "^0.1.0",
"@acamarata/tsconfig": "^0.1.0",
"@eslint/js": "^10.0.1",
"@types/node": "^25.3.0",
"@typescript-eslint/eslint-plugin": "^8.56.1",
"@typescript-eslint/parser": "^8.56.1",
"c8": "^10.1.3",
"eslint": "^10.0.3",
"eslint-config-prettier": "^10.1.8",
"prettier": "^3.8.1",

View file

@ -27,6 +27,12 @@ importers:
'@types/node':
specifier: ^25.3.0
version: 25.3.0
'@typescript-eslint/eslint-plugin':
specifier: ^8.56.1
version: 8.56.1(@typescript-eslint/parser@8.56.1(eslint@10.0.3)(typescript@5.9.3))(eslint@10.0.3)(typescript@5.9.3)
'@typescript-eslint/parser':
specifier: ^8.56.1
version: 8.56.1(eslint@10.0.3)(typescript@5.9.3)
c8:
specifier: ^10.1.3
version: 10.1.3

View file

@ -2,9 +2,9 @@
* Formatted prayer times using the PrayCalc Dynamic Method.
*/
import { formatTime } from 'nrel-spa';
import { getTimes } from './getTimes.js';
import type { FormattedPrayerTimes } from './types.js';
import { formatTime } from "nrel-spa";
import { getTimes } from "./getTimes.js";
import type { FormattedPrayerTimes } from "./types.js";
/**
* Compute prayer times formatted as HH:MM:SS strings.

View file

@ -2,9 +2,9 @@
* Formatted prayer times dynamic method plus all traditional method comparisons.
*/
import { formatTime } from 'nrel-spa';
import { getTimesAll } from './getTimesAll.js';
import type { FormattedPrayerTimesAll } from './types.js';
import { formatTime } from "nrel-spa";
import { getTimesAll } from "./getTimesAll.js";
import type { FormattedPrayerTimesAll } from "./types.js";
/**
* Compute prayer times formatted as HH:MM:SS strings, plus comparison times

View file

@ -50,10 +50,10 @@
* - Jean Meeus, Astronomical Algorithms (2nd ed., 1998)
*/
import { toJulianDate, solarEphemeris, atmosphericRefraction } from './getSolarEphemeris.js';
import { getMscFajr, getMscIsha, minutesToDepression } from './getMSC.js';
import { DEG, ANGLE_MIN, ANGLE_MAX } from './constants.js';
import type { TwilightAngles } from './types.js';
import { toJulianDate, solarEphemeris, atmosphericRefraction } from "./getSolarEphemeris.js";
import { getMscFajr, getMscIsha, minutesToDepression } from "./getMSC.js";
import { DEG, ANGLE_MIN, ANGLE_MAX } from "./constants.js";
import type { TwilightAngles } from "./types.js";
/** Internal result type including ephemeris data for caller reuse. */
export interface AnglesWithEphemeris extends TwilightAngles {

View file

@ -7,7 +7,7 @@
* and solar noon are known.
*/
import { DEG } from './constants.js';
import { DEG } from "./constants.js";
/**
* Compute Asr time as fractional hours.

View file

@ -22,7 +22,7 @@
* High-latitude handling (|lat| > 55°): falls back to 1/7-night rule.
*/
export type ShafaqMode = 'general' | 'ahmer' | 'abyad';
export type ShafaqMode = "general" | "ahmer" | "abyad";
/**
* Normalisation latitude (degrees) used as the divisor in MCW latitude
@ -130,21 +130,21 @@ export function getMscFajr(date: Date, latitude: number): number {
* const offset = getMscIsha(new Date('2024-06-21'), 40.7128, 'general');
* // offset ≈ 84
*/
export function getMscIsha(date: Date, latitude: number, shafaq: ShafaqMode = 'general'): number {
export function getMscIsha(date: Date, latitude: number, shafaq: ShafaqMode = "general"): number {
const latAbs = Math.abs(latitude);
const { dyy, daysInYear } = computeDyy(date, latitude);
let a: number, b: number, c: number, d: number;
switch (shafaq) {
case 'ahmer':
case "ahmer":
// Shafaq ahmer (red glow): BASE = 62 min (shorter twilight)
a = 62 + (17.4 / LAT_SCALE) * latAbs;
b = 62 - (7.16 / LAT_SCALE) * latAbs;
c = 62 + (5.12 / LAT_SCALE) * latAbs;
d = 62 + (19.44 / LAT_SCALE) * latAbs;
break;
case 'abyad':
case "abyad":
// Shafaq abyad (white glow): BASE = 75 min (longer twilight)
a = 75 + (25.6 / LAT_SCALE) * latAbs;
b = 75 + (7.16 / LAT_SCALE) * latAbs;

View file

@ -8,7 +8,7 @@
* prayer time solving still uses the full SPA via nrel-spa.
*/
import { DEG } from './constants.js';
import { DEG } from "./constants.js";
/**
* Convert a JavaScript Date to a Julian Date number.

View file

@ -6,14 +6,14 @@
* offset (tz parameter).
*/
import { getSpa } from 'nrel-spa';
import { computeAngles } from './getAngles.js';
import { getAsr } from './getAsr.js';
import { getQiyam } from './getQiyam.js';
import { getMidnight } from './getMidnight.js';
import { validateInputs } from './validate.js';
import { DHUHR_OFFSET_MINUTES } from './constants.js';
import type { PrayerTimes } from './types.js';
import { getSpa } from "nrel-spa";
import { computeAngles } from "./getAngles.js";
import { getAsr } from "./getAsr.js";
import { getQiyam } from "./getQiyam.js";
import { getMidnight } from "./getMidnight.js";
import { validateInputs } from "./validate.js";
import { DHUHR_OFFSET_MINUTES } from "./constants.js";
import type { PrayerTimes } from "./types.js";
/**
* Compute prayer times for a given date and location.

View file

@ -24,109 +24,109 @@
* | MSC | Moonsighting Committee Worldwide (seasonal) | | | Global |
*/
import { getSpa } from 'nrel-spa';
import { computeAngles } from './getAngles.js';
import { getAsr } from './getAsr.js';
import { getQiyam } from './getQiyam.js';
import { getMidnight } from './getMidnight.js';
import { getMscFajr, getMscIsha } from './getMSC.js';
import { validateInputs } from './validate.js';
import { DHUHR_OFFSET_MINUTES } from './constants.js';
import type { MethodDefinition, PrayerTimesAll } from './types.js';
import { getSpa } from "nrel-spa";
import { computeAngles } from "./getAngles.js";
import { getAsr } from "./getAsr.js";
import { getQiyam } from "./getQiyam.js";
import { getMidnight } from "./getMidnight.js";
import { getMscFajr, getMscIsha } from "./getMSC.js";
import { validateInputs } from "./validate.js";
import { DHUHR_OFFSET_MINUTES } from "./constants.js";
import type { MethodDefinition, PrayerTimesAll } from "./types.js";
/** All supported traditional methods. */
const METHODS: MethodDefinition[] = [
{
id: 'UOIF',
name: 'Union des Organisations Islamiques de France',
region: 'France',
id: "UOIF",
name: "Union des Organisations Islamiques de France",
region: "France",
fajrAngle: 12,
ishaAngle: 12,
},
{
id: 'ISNACA',
name: 'IQNA / Islamic Council of North America',
region: 'Canada',
id: "ISNACA",
name: "IQNA / Islamic Council of North America",
region: "Canada",
fajrAngle: 13,
ishaAngle: 13,
},
{
id: 'ISNA',
name: 'FCNA / Islamic Society of North America',
region: 'US, UK, AU, NZ',
id: "ISNA",
name: "FCNA / Islamic Society of North America",
region: "US, UK, AU, NZ",
fajrAngle: 15,
ishaAngle: 15,
},
{
id: 'SAMR',
name: 'Spiritual Administration of Muslims of Russia',
region: 'Russia',
id: "SAMR",
name: "Spiritual Administration of Muslims of Russia",
region: "Russia",
fajrAngle: 16,
ishaAngle: 15,
},
{
id: 'IGUT',
name: 'Institute of Geophysics, University of Tehran',
region: 'Iran',
id: "IGUT",
name: "Institute of Geophysics, University of Tehran",
region: "Iran",
fajrAngle: 17.7,
ishaAngle: 14,
},
{ id: 'MWL', name: 'Muslim World League', region: 'Global', fajrAngle: 18, ishaAngle: 17 },
{ id: "MWL", name: "Muslim World League", region: "Global", fajrAngle: 18, ishaAngle: 17 },
{
id: 'DIBT',
name: 'Diyanet İşleri Başkanlığı, Turkey',
region: 'Turkey',
id: "DIBT",
name: "Diyanet İşleri Başkanlığı, Turkey",
region: "Turkey",
fajrAngle: 18,
ishaAngle: 17,
},
{
id: 'Karachi',
name: 'University of Islamic Sciences, Karachi',
region: 'PK, BD, IN, AF',
id: "Karachi",
name: "University of Islamic Sciences, Karachi",
region: "PK, BD, IN, AF",
fajrAngle: 18,
ishaAngle: 18,
},
{
id: 'Kuwait',
name: 'Kuwait Ministry of Islamic Affairs',
region: 'Kuwait',
id: "Kuwait",
name: "Kuwait Ministry of Islamic Affairs",
region: "Kuwait",
fajrAngle: 18,
ishaAngle: 17.5,
},
{
id: 'UAQ',
name: 'Umm Al-Qura University, Makkah',
region: 'Saudi Arabia',
id: "UAQ",
name: "Umm Al-Qura University, Makkah",
region: "Saudi Arabia",
fajrAngle: 18.5,
ishaAngle: null,
ishaMinutes: 90,
},
{
id: 'Qatar',
name: 'Qatar / Gulf Standard',
region: 'Qatar, Gulf',
id: "Qatar",
name: "Qatar / Gulf Standard",
region: "Qatar, Gulf",
fajrAngle: 18,
ishaAngle: null,
ishaMinutes: 90,
},
{
id: 'Egypt',
name: 'Egyptian General Authority of Survey',
region: 'EG, SY, IQ, LB',
id: "Egypt",
name: "Egyptian General Authority of Survey",
region: "EG, SY, IQ, LB",
fajrAngle: 19.5,
ishaAngle: 17.5,
},
{
id: 'MUIS',
name: 'Majlis Ugama Islam Singapura',
region: 'Singapore',
id: "MUIS",
name: "Majlis Ugama Islam Singapura",
region: "Singapore",
fajrAngle: 20,
ishaAngle: 18,
},
{
id: 'MSC',
name: 'Moonsighting Committee Worldwide',
region: 'Global',
id: "MSC",
name: "Moonsighting Committee Worldwide",
region: "Global",
fajrAngle: null,
ishaAngle: null,
useMSC: true,

View file

@ -16,17 +16,17 @@
* METHODS - Array of all supported traditional method definitions
*/
export { getTimes } from './getTimes.js';
export { calcTimes } from './calcTimes.js';
export { getTimesAll, METHODS } from './getTimesAll.js';
export { calcTimesAll } from './calcTimesAll.js';
export { getAngles } from './getAngles.js';
export { getAsr } from './getAsr.js';
export { getQiyam } from './getQiyam.js';
export { getMidnight } from './getMidnight.js';
export { getMscFajr, getMscIsha } from './getMSC.js';
export { solarEphemeris, toJulianDate } from './getSolarEphemeris.js';
export { DHUHR_OFFSET_MINUTES, ANGLE_MIN, ANGLE_MAX } from './constants.js';
export { getTimes } from "./getTimes.js";
export { calcTimes } from "./calcTimes.js";
export { getTimesAll, METHODS } from "./getTimesAll.js";
export { calcTimesAll } from "./calcTimesAll.js";
export { getAngles } from "./getAngles.js";
export { getAsr } from "./getAsr.js";
export { getQiyam } from "./getQiyam.js";
export { getMidnight } from "./getMidnight.js";
export { getMscFajr, getMscIsha } from "./getMSC.js";
export { solarEphemeris, toJulianDate } from "./getSolarEphemeris.js";
export { DHUHR_OFFSET_MINUTES, ANGLE_MIN, ANGLE_MAX } from "./constants.js";
export type {
FractionalHours,
@ -41,4 +41,4 @@ export type {
FormattedPrayerTimesAll,
AtmosphericParams,
MethodDefinition,
} from './types.js';
} from "./types.js";

View file

@ -9,10 +9,10 @@ export type FractionalHours = number;
export type TimeString = string;
/** Asr shadow convention: Shafi'i (shadow = 1x object length) or Hanafi (2x). */
export type AsrConvention = 'shafii' | 'hanafi';
export type AsrConvention = "shafii" | "hanafi";
/** Shafaq (twilight glow) variant for the MSC Isha model. */
export type ShafaqMode = 'general' | 'ahmer' | 'abyad';
export type ShafaqMode = "general" | "ahmer" | "abyad";
/** Computed twilight depression angles for Fajr and Isha. */
export interface TwilightAngles {