Skip to content

Commit

Permalink
style: ➖ remove prettier and enforce stricter jsdocs
Browse files Browse the repository at this point in the history
  • Loading branch information
thkruz committed Jan 15, 2024
1 parent eec1281 commit 647eff3
Show file tree
Hide file tree
Showing 34 changed files with 1,336 additions and 878 deletions.
8 changes: 4 additions & 4 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
"node": true,
"jest": true
},
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended", "plugin:jsdoc/recommended-typescript-error"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 12,
"sourceType": "module"
},
"plugins": ["@typescript-eslint"],
"rules": {
"plugins": ["@typescript-eslint", "jsdoc"],
"rules": {
"accessor-pairs": "error",
"array-bracket-newline": "error",
"array-bracket-spacing": "error",
Expand Down Expand Up @@ -163,7 +163,7 @@
"no-template-curly-in-string": "error",
"no-ternary": "off",
"no-throw-literal": "error",
"no-trailing-spaces": "error",
"no-trailing-spaces": ["error", { "ignoreComments": true }],
"no-undef-init": "error",
"no-undefined": "error",
"no-underscore-dangle": "off",
Expand Down
17 changes: 0 additions & 17 deletions .prettierrc

This file was deleted.

157 changes: 141 additions & 16 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@
"babel-eslint": "^10.1.0",
"babel-loader": "^9.1.3",
"eslint": "^8.56.0",
"eslint-plugin-jsdoc": "^48.0.2",
"jest": "^28.1.3",
"prettier": "^3.2.1",
"tsx": "^4.7.0",
"typescript": "^4.9.5"
},
"homepage": "https://github.com/thkruz/ootk-core"
}
}
59 changes: 41 additions & 18 deletions src/body/Celestial.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,31 @@
/**
* @author Theodore Kruczek.
* @license MIT
* @copyright (c) 2022-2024 Theodore Kruczek Permission is
* hereby granted, free of charge, to any person obtaining a copy of this
* software and associated documentation files (the "Software"), to deal in the
* Software without restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

import { AzEl, Degrees, Kilometers, RAD2DEG, RaDec, Radians, Sun } from '../main';

/**
* Celestial is a static class that provides methods for calculating the position of celestial objects such
* as the Sun, Moon, and planets in the sky.
* Celestial is a static class that provides methods for calculating the position of celestial objects such as the Sun,
* Moon, and planets in the sky.
*/
export class Celestial {
private constructor() {
Expand Down Expand Up @@ -48,8 +71,8 @@ export class Celestial {
* A familiar example of atmospheric refraction is observed during sunrise and sunset. The Sun appears to
* be above the horizon when it is actually just below it. This is because the light from the Sun is bent
* upwards as it passes through the atmosphere.
* @param {Radians} h - elevation
* @returns {number} refraction
* @param h - elevation
* @returns refraction
*/
static atmosphericRefraction(h: Radians): Radians {
if (h < 0) {
Expand All @@ -62,9 +85,9 @@ export class Celestial {
/**
* Calculate the declination. Similar to latitude on Earth, declination is another celestial coordinate.
* It measures how far north or south an object is from the celestial equator
* @param {number} l - ecliptic longitude
* @param {number} b - ecliptic latitude
* @returns {number} declination
* @param l - ecliptic longitude
* @param b - ecliptic latitude
* @returns declination
*/
static declination(l: number, b: number): Radians {
return <Radians>Math.asin(Math.sin(b) * Math.cos(Sun.e) + Math.cos(b) * Math.sin(Sun.e) * Math.sin(l));
Expand All @@ -74,9 +97,9 @@ export class Celestial {
* Calculate the right ascension. This is a celestial coordinate used to determine the position of objects
* in the sky. It's analogous to longitude on Earth. Right Ascension indicates how far east an object is
* from the vernal equinox along the celestial equator.
* @param {number} l - ecliptic longitude
* @param {number} b - ecliptic latitude
* @returns {number} right ascension
* @param l - ecliptic longitude
* @param b - ecliptic latitude
* @returns right ascension
*/
static rightAscension(l: number, b: number): Radians {
return <Radians>Math.atan2(Math.sin(l) * Math.cos(Sun.e) - Math.tan(b) * Math.sin(Sun.e), Math.cos(l));
Expand All @@ -87,10 +110,10 @@ export class Celestial {
* observer's local horizon. It's commonly expressed in degrees, where 0 degrees is right at the horizon
* and 90 degrees is directly overhead (the zenith), but we are using radians to support trigonometric
* functions like Math.sin() and Math.cos().
* @param {number} H - siderealTime
* @param {Radians} phi - latitude
* @param {Radians} dec - The declination of the sun
* @returns {Radians} elevation
* @param H - siderealTime
* @param phi - latitude
* @param dec - The declination of the sun
* @returns elevation
*/
static elevation(H: number, phi: Radians, dec: Radians): Radians {
return <Radians>Math.asin(Math.sin(phi) * Math.sin(dec) + Math.cos(phi) * Math.cos(dec) * Math.cos(H));
Expand All @@ -100,10 +123,10 @@ export class Celestial {
* Calculate the azimuth. This is a compass direction measurement. Azimuth measures the angle along
* the horizon from a specific reference direction (usually true north) to the point where a vertical
* line from the object intersects the horizon.
* @param {number} H - siderealTime
* @param {Radians} phi - latitude
* @param {Radians} dec - The declination of the sun
* @returns {Radians} azimuth in rad
* @param H - siderealTime
* @param phi - latitude
* @param dec - The declination of the sun
* @returns azimuth in rad
*/
static azimuth(H: number, phi: Radians, dec: Radians): Radians {
return <Radians>(Math.PI + Math.atan2(Math.sin(H), Math.cos(H) * Math.sin(phi) - Math.tan(dec) * Math.cos(phi)));
Expand Down
Loading

0 comments on commit 647eff3

Please sign in to comment.