Skip to content

Commit e99b346

Browse files
authored
update lint (#43)
Update lint rules. Ignore lint rules to build. Fix some lint rules.
1 parent e24e960 commit e99b346

24 files changed

+519
-500
lines changed

.eslintrc.js

Lines changed: 63 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,67 @@
11
module.exports = {
2-
env: {
3-
browser: true,
4-
es2021: true
2+
'env': {
3+
'browser': true,
4+
'commonjs': true,
5+
'es6': true
56
},
6-
extends: 'standard-with-typescript',
7-
overrides: [
7+
'extends': [
8+
'eslint:recommended',
9+
'plugin:@typescript-eslint/eslint-recommended'
810
],
9-
parserOptions: {
10-
ecmaVersion: 'latest',
11-
sourceType: 'module',
12-
project: ['tsconfig.json']
11+
'globals': {
12+
'Atomics': 'readonly',
13+
'SharedArrayBuffer': 'readonly'
1314
},
14-
rules: {
15-
}
16-
}
15+
'parser': '@typescript-eslint/parser',
16+
'parserOptions': {
17+
'sourceType': 'module',
18+
'ecmaVersion': 2018
19+
},
20+
'plugins': [
21+
'@typescript-eslint'
22+
],
23+
'rules': {
24+
'indent': [
25+
'error',
26+
2,
27+
{ 'SwitchCase': 1 }
28+
],
29+
'linebreak-style': [
30+
'error',
31+
'unix'
32+
],
33+
'quotes': [
34+
'error',
35+
'single',
36+
{ 'allowTemplateLiterals': true }
37+
],
38+
'semi': [
39+
'error',
40+
'never'
41+
],
42+
'no-var': ['error'],
43+
'@typescript-eslint/member-delimiter-style': [
44+
'error',
45+
{
46+
'multiline': {
47+
'delimiter': 'none',
48+
'requireLast': true
49+
},
50+
'singleline': {
51+
'delimiter': 'semi',
52+
'requireLast': false
53+
}
54+
}
55+
],
56+
'@typescript-eslint/explicit-function-return-type': 'off',
57+
'@typescript-eslint/no-unused-vars': ['warn', { 'vars': 'all', 'args': 'after-used', 'ignoreRestSiblings': false }],
58+
'no-unused-vars': 'off',
59+
'@typescript-eslint/restrict-plus-operands': 'off',
60+
//'@typescript-eslint/no-unused-vars': 'off',
61+
'@typescript-eslint/prefer-optional-chain': 'off',
62+
'@typescript-eslint/naming-convention': 'off',
63+
'@typescript-eslint/strict-boolean-expressions': 'off',
64+
'@typescript-eslint/prefer-nullish-coalescing': 'off',
65+
'no-prototype-builtins': 'off'
66+
},
67+
}

dist/astrochart.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/project/src/animation/animator.d.ts

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
import { AstroData } from '../radix';
2-
import { Settings } from '../settings';
3-
import Transit from '../transit';
1+
import { type AstroData } from '../radix';
2+
import { type Settings } from '../settings';
3+
import type Transit from '../transit';
44
import Timer from './timer';
55
/**
6-
* Transit chart animator
7-
*
8-
* Animates the object on a circle.
9-
*
10-
* @class
11-
* @public
12-
* @constructor
13-
* @param {Object} from, {"Sun":[12], "Moon":[60]}
14-
* @param {Object} to, {"Sun":[30], "Moon":[180]}
15-
* @param {Object} settings, {cx:100, cy:100, radius:200, prefix:"astro-chart-"}
16-
*/
6+
* Transit chart animator
7+
*
8+
* Animates the object on a circle.
9+
*
10+
* @class
11+
* @public
12+
* @constructor
13+
* @param {Object} from, {"Sun":[12], "Moon":[60]}
14+
* @param {Object} to, {"Sun":[30], "Moon":[180]}
15+
* @param {Object} settings, {cx:100, cy:100, radius:200, prefix:"astro-chart-"}
16+
*/
1717
declare class Animator {
1818
transit: Transit;
1919
isReverse: boolean;
@@ -25,17 +25,19 @@ declare class Animator {
2525
context: this;
2626
cuspsElement: any;
2727
data: AstroData;
28+
duration: number;
29+
callback: () => void;
2830
constructor(transit: Transit, settings: Settings);
2931
/**
30-
* Animate objects
31-
32-
* @param {Object} data, targetPositions
33-
* @param {Integer} duration - seconds
34-
* @param {boolean} isReverse
35-
* @param {Function} callbck - start et the end of animation
36-
*/
37-
animate: (data: any, duration: number, isReverse: boolean, callback: () => void) => void;
38-
update: (deltaTime: number) => void;
32+
* Animate objects
33+
34+
* @param {Object} data, targetPositions
35+
* @param {Integer} duration - seconds
36+
* @param {boolean} isReverse
37+
* @param {Function} callbck - start et the end of animation
38+
*/
39+
animate(data: any, duration: number, isReverse: boolean, callback: () => void): void;
40+
update(deltaTime?: number): void;
3941
updateCusps(expectedNumberOfLoops: number): void;
4042
updatePlanets(expectedNumberOfLoops: number): void;
4143
}

dist/project/src/animation/timer.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ declare class Timer {
33
callback: (delta: number) => void;
44
boundTick_: FrameRequestCallback;
55
lastGameLoopFrame: number;
6-
requestID_: number;
6+
requestID_: number | undefined;
77
constructor(callback: (delta: number) => void, debug: boolean);
88
start(): void;
99
stop(): void;

dist/project/src/aspect.d.ts

Lines changed: 11 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { Points } from './radix';
2-
import { AspectData, Settings } from './settings';
1+
import { type Points } from './radix';
2+
import { type AspectData, type Settings } from './settings';
33
export interface FormedAspect {
44
point: {
55
name: string;
@@ -18,14 +18,14 @@ export interface FormedAspect {
1818
precision: string;
1919
}
2020
/**
21-
* Aspects calculator
22-
*
23-
* @class
24-
* @public
25-
* @constructor
26-
* @param {AspectPoints} points; {"Sun":[0], "Moon":[90], "Neptune":[120], "As":[30]}
27-
* @param {Object | null } settings
28-
*/
21+
* Aspects calculator
22+
*
23+
* @class
24+
* @public
25+
* @constructor
26+
* @param {AspectPoints} points; {"Sun":[0], "Moon":[90], "Neptune":[120], "As":[30]}
27+
* @param {Object | null } settings
28+
*/
2929
declare class AspectCalculator {
3030
settings: Partial<Settings>;
3131
toPoints: Points;
@@ -55,23 +55,7 @@ declare class AspectCalculator {
5555
* @param {Object} points - transiting points; {"Sun":[0, 1], "Uranus":[90, -1], "NAME":[ANGLE, SPEED]};
5656
* @return {Array<Object>} [{"aspect":{"name":"conjunction", "degree":120}"", "point":{"name":"Sun", "position":123}, "toPoint":{"name":"Moon", "position":345}, "precision":0.5}]]
5757
*/
58-
transit(points: Points): {
59-
aspect: {
60-
name: string;
61-
degree: number;
62-
orbit: number;
63-
color: string;
64-
};
65-
point: {
66-
name: string;
67-
position: number;
68-
};
69-
toPoint: {
70-
name: string;
71-
position: number;
72-
};
73-
precision: string;
74-
}[];
58+
transit(points: Points): FormedAspect[];
7559
hasAspect(point: number, toPoint: number, aspect: AspectData): boolean;
7660
calcPrecision(point: number, toPoint: number, aspect: number): number;
7761
isTransitPointApproachingToAspect(aspect: number, toPoint: number, point: number): boolean;

dist/project/src/chart.d.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { Settings } from './settings';
2-
import Radix, { AstroData } from './radix';
1+
import { type Settings } from './settings';
2+
import Radix, { type AstroData } from './radix';
33
import SVG from './svg';
44
/**
55
* Displays astrology charts.
@@ -20,17 +20,17 @@ declare class Chart {
2020
settings: Settings;
2121
constructor(elementId: string, width: number, height: number, settings?: Partial<Settings>);
2222
/**
23-
* Display radix horoscope
24-
*
25-
* @param {Object} data
26-
* @example
27-
* {
28-
* "points":{"Moon":[0], "Sun":[30], ... },
29-
* "cusps":[300, 340, 30, 60, 75, 90, 116, 172, 210, 236, 250, 274]
30-
* }
31-
*
32-
* @return {astrology.Radix} radix
33-
*/
23+
* Display radix horoscope
24+
*
25+
* @param {Object} data
26+
* @example
27+
* {
28+
* "points":{"Moon":[0], "Sun":[30], ... },
29+
* "cusps":[300, 340, 30, 60, 75, 90, 116, 172, 210, 236, 250, 274]
30+
* }
31+
*
32+
* @return {Radix} radix
33+
*/
3434
radix(data: AstroData): Radix;
3535
/**
3636
* Scale chart
@@ -43,6 +43,6 @@ declare class Chart {
4343
* For debug only.
4444
*
4545
*/
46-
calibrate(): this;
46+
calibrate(): Chart;
4747
}
4848
export default Chart;

dist/project/src/radix.d.ts

Lines changed: 29 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,33 @@
1-
import { FormedAspect } from './aspect';
1+
import { type FormedAspect } from './aspect';
22
import Transit from './transit';
3-
import SVG from './svg';
4-
import { Settings } from './settings';
5-
export declare type Points = {
6-
[key: string]: number[];
7-
};
8-
export declare type LocatedPoint = {
9-
name?: string;
3+
import type SVG from './svg';
4+
import { type Settings } from './settings';
5+
export type Points = Record<string, number[]>;
6+
export interface LocatedPoint {
7+
name: string;
108
x: number;
119
y: number;
1210
r: number;
1311
angle: number;
1412
pointer?: number;
1513
index?: number;
16-
};
17-
export declare type AstroData = {
14+
}
15+
export interface AstroData {
1816
planets: Points;
1917
cusps: number[];
20-
};
18+
}
2119
/**
22-
* Radix charts.
23-
*
24-
* @class
25-
* @public
26-
* @constructor
27-
* @param {this.settings.SVG} paper
28-
* @param {int} cx
29-
* @param {int} cy
30-
* @param {int} radius
31-
* @param {Object} data
32-
*/
20+
* Radix charts.
21+
*
22+
* @class
23+
* @public
24+
* @constructor
25+
* @param {this.settings.SVG} paper
26+
* @param {int} cx
27+
* @param {int} cy
28+
* @param {int} radius
29+
* @param {Object} data
30+
*/
3331
declare class Radix {
3432
settings: Settings;
3533
data: AstroData;
@@ -46,8 +44,8 @@ declare class Radix {
4644
context: this;
4745
constructor(paper: SVG, cx: number, cy: number, radius: number, data: AstroData, settings: Settings);
4846
/**
49-
* Draw background
50-
*/
47+
* Draw background
48+
*/
5149
drawBg(): void;
5250
/**
5351
* Draw universe.
@@ -66,13 +64,13 @@ declare class Radix {
6664
* Draw aspects
6765
* @param{Array<Object> | null} customAspects - posible custom aspects to draw;
6866
*/
69-
aspects(customAspects?: FormedAspect[] | null): this;
67+
aspects(customAspects?: FormedAspect[] | null): Radix;
7068
/**
7169
* Add points of interest for aspects calculation
7270
* @param {Obect} points, {"As":[0],"Ic":[90],"Ds":[180],"Mc":[270]}
7371
* @see (this.settings.AspectCalculator( toPoints) )
7472
*/
75-
addPointsOfInterest(points: Points): this;
73+
addPointsOfInterest(points: Points): Radix;
7674
drawRuler(): void;
7775
/**
7876
* Draw circles
@@ -83,12 +81,12 @@ declare class Radix {
8381
*
8482
* @param {Object} data
8583
* @example
86-
* {
87-
* "planets":{"Moon":[0], "Sun":[30], ... },
88-
* "cusps":[300, 340, 30, 60, 75, 90, 116, 172, 210, 236, 250, 274], *
89-
* }
84+
* {
85+
* "planets":{"Moon":[0], "Sun":[30], ... },
86+
* "cusps":[300, 340, 30, 60, 75, 90, 116, 172, 210, 236, 250, 274], *
87+
* }
9088
*
91-
* @return {this.settings.Transit} transit
89+
* @return {Transit} transit
9290
*/
9391
transit(data: AstroData): Transit;
9492
}

dist/project/src/settings.d.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
1-
import SVG from "./svg";
1+
import type SVG from './svg';
22
export interface AspectData {
33
degree: number;
44
orbit: number;
55
color: string;
66
}
7-
export interface Aspect {
8-
[key: string]: AspectData;
9-
}
7+
export type Aspect = Record<string, AspectData>;
108
export interface Dignity {
119
name: string;
1210
position: number;
1311
orbit: number;
1412
}
15-
export declare type Settings = {
13+
export interface Settings {
1614
SYMBOL_SCALE: number;
1715
COLOR_BACKGROUND: string;
1816
POINTS_COLOR: string;
@@ -98,7 +96,7 @@ export declare type Settings = {
9896
COLOR_AQUARIUS: string;
9997
COLOR_PISCES: string;
10098
COLORS_SIGNS: string[];
101-
CUSTOM_SYMBOL_FN: (name: string, x: number, y: number, context: SVG) => Element | null;
99+
CUSTOM_SYMBOL_FN: null | ((name: string, x: number, y: number, context: SVG) => Element);
102100
SHIFT_IN_DEGREES: number;
103101
STROKE_ONLY: boolean;
104102
ADD_CLICK_AREA: boolean;
@@ -112,6 +110,6 @@ export declare type Settings = {
112110
DIGNITIES_EXACT_EXALTATION_DEFAULT: Dignity[];
113111
ANIMATION_CUSPS_ROTATION_SPEED: number;
114112
DEBUG: boolean;
115-
};
113+
}
116114
declare const default_settings: Settings;
117115
export default default_settings;

0 commit comments

Comments
 (0)