Skip to content

Commit

Permalink
change eslint to point at new tests on .ts; fix minor issues; disable…
Browse files Browse the repository at this point in the history
… unused detection because ts already does it and it's buggy
  • Loading branch information
StoneCypher committed Jan 16, 2021
1 parent fa8385c commit 24a08b2
Show file tree
Hide file tree
Showing 20 changed files with 327 additions and 73 deletions.
9 changes: 1 addition & 8 deletions .eslintrc
Expand Up @@ -15,14 +15,7 @@

rules: {
"no-unused-vars": 0,
"@typescript-eslint/no-unused-vars": [
1, {
argsIgnorePattern : "^_",
varsIgnorePattern : "^_",
caughtErrors : "all",
caughtErrorsIgnorePattern : "^_"
}
]
"@typescript-eslint/no-unused-vars": 0
}

}
4 changes: 2 additions & 2 deletions dist/es6/jssm.d.ts
Expand Up @@ -2,11 +2,11 @@ declare type StateType = string;
import { JssmGenericState, JssmGenericConfig, JssmTransition, JssmTransitionList, // JssmTransitionRule,
JssmMachineInternalState, JssmParseTree, JssmStateDeclaration, JssmArrow, JssmArrowDirection, JssmArrowKind, JssmLayout, FslDirection, FslTheme } from './jssm_types';
import { seq, weighted_rand_select, weighted_sample_select, histograph, weighted_histo_key } from './jssm_util';
import { parse } from './jssm-dot';
import { version } from './version';
declare function arrow_direction(arrow: JssmArrow): JssmArrowDirection;
declare function arrow_left_kind(arrow: JssmArrow): JssmArrowKind;
declare function arrow_right_kind(arrow: JssmArrow): JssmArrowKind;
declare function wrap_parse(input: string, options?: Object): any;
declare function compile<mDT>(tree: JssmParseTree): JssmGenericConfig<mDT>;
declare function make<mDT>(plan: string): JssmGenericConfig<mDT>;
declare function transfer_state_properties(state_decl: JssmStateDeclaration): JssmStateDeclaration;
Expand Down Expand Up @@ -97,4 +97,4 @@ declare class Machine<mDT> {
sm(template_strings: TemplateStringsArray, ...remainder: any[]): Machine<mDT>;
}
declare function sm<mDT>(template_strings: TemplateStringsArray, ...remainder: any[]): Machine<mDT>;
export { version, transfer_state_properties, Machine, make, parse, compile, sm, arrow_direction, arrow_left_kind, arrow_right_kind, seq, weighted_rand_select, histograph, weighted_sample_select, weighted_histo_key };
export { version, transfer_state_properties, Machine, make, wrap_parse as parse, compile, sm, arrow_direction, arrow_left_kind, arrow_right_kind, seq, weighted_rand_select, histograph, weighted_sample_select, weighted_histo_key };
7 changes: 5 additions & 2 deletions dist/es6/jssm.js
Expand Up @@ -170,6 +170,9 @@ function makeTransition(this_se, from, to, isRight, _wasList, _wasIndex) {
}
return edge;
}
function wrap_parse(input, options) {
return parse(input, options || {});
}
function compile_rule_transition_step(acc, from, to, this_se, next_se) {
const edges = [];
const uFrom = (Array.isArray(from) ? from : [from]), uTo = (Array.isArray(to) ? to : [to]);
Expand Down Expand Up @@ -282,7 +285,7 @@ function compile(tree) {
return result_cfg;
}
function make(plan) {
return compile(parse(plan, {}));
return compile(wrap_parse(plan));
}
function transfer_state_properties(state_decl) {
state_decl.declarations.map((d) => {
Expand Down Expand Up @@ -786,6 +789,6 @@ function sm(template_strings, ...remainder /* , arguments */) {
/* eslint-enable fp/no-arguments */
)));
}
export { version, transfer_state_properties, Machine, make, parse, compile, sm, arrow_direction, arrow_left_kind, arrow_right_kind,
export { version, transfer_state_properties, Machine, make, wrap_parse as parse, compile, sm, arrow_direction, arrow_left_kind, arrow_right_kind,
// WHARGARBL TODO these should be exported to a utility library
seq, weighted_rand_select, histograph, weighted_sample_select, weighted_histo_key };
3 changes: 2 additions & 1 deletion dist/es6/jssm_util.d.ts
@@ -1,7 +1,8 @@
declare function arr_uniq_p<T>(el: T, i: number, source: T[]): boolean;
declare const array_box_if_string: (n: any) => any;
declare const weighted_rand_select: Function;
declare const seq: Function;
declare const histograph: Function;
declare const weighted_sample_select: Function;
declare const weighted_histo_key: Function;
export { seq, histograph, weighted_histo_key, weighted_rand_select, weighted_sample_select, array_box_if_string };
export { seq, arr_uniq_p, histograph, weighted_histo_key, weighted_rand_select, weighted_sample_select, array_box_if_string };
5 changes: 4 additions & 1 deletion dist/es6/jssm_util.js
@@ -1,3 +1,6 @@
function arr_uniq_p(el, i, source) {
return source.indexOf(el) === i;
}
const array_box_if_string = n => typeof n === 'string' ? [n] : n;
// this is explicitly about other peoples' data, so it has to be weakly typed
/* eslint-disable flowtype/no-weak-types */
Expand Down Expand Up @@ -28,4 +31,4 @@ const weighted_histo_key = (n, opts, prob_prop, extract) => // TODO FIXME no any
histograph(weighted_sample_select(n, opts, prob_prop)
.map((s) => s[extract] // TODO FIXME eslint-disable-line flowtype/no-weak-types
));
export { seq, histograph, weighted_histo_key, weighted_rand_select, weighted_sample_select, array_box_if_string };
export { seq, arr_uniq_p, histograph, weighted_histo_key, weighted_rand_select, weighted_sample_select, array_box_if_string };
2 changes: 1 addition & 1 deletion dist/jssm.es5.cjs.js

Large diffs are not rendered by default.

7 changes: 5 additions & 2 deletions dist/jssm.es5.cjs.nonmin.js
Expand Up @@ -15782,6 +15782,9 @@ function makeTransition(this_se, from, to, isRight, _wasList, _wasIndex) {
}
return edge;
}
function wrap_parse(input, options) {
return peg$parse(input, options || {});
}
function compile_rule_transition_step(acc, from, to, this_se, next_se) {
const edges = [];
const uFrom = (Array.isArray(from) ? from : [from]), uTo = (Array.isArray(to) ? to : [to]);
Expand Down Expand Up @@ -15894,7 +15897,7 @@ function compile(tree) {
return result_cfg;
}
function make(plan) {
return compile(peg$parse(plan, {}));
return compile(wrap_parse(plan));
}
function transfer_state_properties(state_decl) {
state_decl.declarations.map((d) => {
Expand Down Expand Up @@ -16406,7 +16409,7 @@ exports.arrow_right_kind = arrow_right_kind;
exports.compile = compile;
exports.histograph = histograph;
exports.make = make;
exports.parse = peg$parse;
exports.parse = wrap_parse;
exports.seq = seq;
exports.sm = sm;
exports.transfer_state_properties = transfer_state_properties;
Expand Down
2 changes: 1 addition & 1 deletion dist/jssm.es5.iife.js

Large diffs are not rendered by default.

7 changes: 5 additions & 2 deletions dist/jssm.es5.iife.nonmin.js
Expand Up @@ -15781,6 +15781,9 @@ var jssm = (function (exports) {
}
return edge;
}
function wrap_parse(input, options) {
return peg$parse(input, options || {});
}
function compile_rule_transition_step(acc, from, to, this_se, next_se) {
const edges = [];
const uFrom = (Array.isArray(from) ? from : [from]), uTo = (Array.isArray(to) ? to : [to]);
Expand Down Expand Up @@ -15893,7 +15896,7 @@ var jssm = (function (exports) {
return result_cfg;
}
function make(plan) {
return compile(peg$parse(plan, {}));
return compile(wrap_parse(plan));
}
function transfer_state_properties(state_decl) {
state_decl.declarations.map((d) => {
Expand Down Expand Up @@ -16405,7 +16408,7 @@ var jssm = (function (exports) {
exports.compile = compile;
exports.histograph = histograph;
exports.make = make;
exports.parse = peg$parse;
exports.parse = wrap_parse;
exports.seq = seq;
exports.sm = sm;
exports.transfer_state_properties = transfer_state_properties;
Expand Down
4 changes: 2 additions & 2 deletions jssm.d.ts
Expand Up @@ -2,11 +2,11 @@ declare type StateType = string;
import { JssmGenericState, JssmGenericConfig, JssmTransition, JssmTransitionList, // JssmTransitionRule,
JssmMachineInternalState, JssmParseTree, JssmStateDeclaration, JssmArrow, JssmArrowDirection, JssmArrowKind, JssmLayout, FslDirection, FslTheme } from './jssm_types';
import { seq, weighted_rand_select, weighted_sample_select, histograph, weighted_histo_key } from './jssm_util';
import { parse } from './jssm-dot';
import { version } from './version';
declare function arrow_direction(arrow: JssmArrow): JssmArrowDirection;
declare function arrow_left_kind(arrow: JssmArrow): JssmArrowKind;
declare function arrow_right_kind(arrow: JssmArrow): JssmArrowKind;
declare function wrap_parse(input: string, options?: Object): any;
declare function compile<mDT>(tree: JssmParseTree): JssmGenericConfig<mDT>;
declare function make<mDT>(plan: string): JssmGenericConfig<mDT>;
declare function transfer_state_properties(state_decl: JssmStateDeclaration): JssmStateDeclaration;
Expand Down Expand Up @@ -97,4 +97,4 @@ declare class Machine<mDT> {
sm(template_strings: TemplateStringsArray, ...remainder: any[]): Machine<mDT>;
}
declare function sm<mDT>(template_strings: TemplateStringsArray, ...remainder: any[]): Machine<mDT>;
export { version, transfer_state_properties, Machine, make, parse, compile, sm, arrow_direction, arrow_left_kind, arrow_right_kind, seq, weighted_rand_select, histograph, weighted_sample_select, weighted_histo_key };
export { version, transfer_state_properties, Machine, make, wrap_parse as parse, compile, sm, arrow_direction, arrow_left_kind, arrow_right_kind, seq, weighted_rand_select, histograph, weighted_sample_select, weighted_histo_key };
3 changes: 2 additions & 1 deletion jssm_util.d.ts
@@ -1,7 +1,8 @@
declare function arr_uniq_p<T>(el: T, i: number, source: T[]): boolean;
declare const array_box_if_string: (n: any) => any;
declare const weighted_rand_select: Function;
declare const seq: Function;
declare const histograph: Function;
declare const weighted_sample_select: Function;
declare const weighted_histo_key: Function;
export { seq, histograph, weighted_histo_key, weighted_rand_select, weighted_sample_select, array_box_if_string };
export { seq, arr_uniq_p, histograph, weighted_histo_key, weighted_rand_select, weighted_sample_select, array_box_if_string };

0 comments on commit 24a08b2

Please sign in to comment.