Skip to content

Commit

Permalink
Knip 6: remove needless exports (#1776)
Browse files Browse the repository at this point in the history
## Summary:
Knip found a bunch of exports for things that didn't need to be exported.

Author: handeyeco

Reviewers: benchristel

Required Reviewers:

Approved By: benchristel

Checks: ✅ Publish npm snapshot (ubuntu-latest, 20.x), ✅ Check builds for changes in size (ubuntu-latest, 20.x), ✅ Check for .changeset entries for all changed files (ubuntu-latest, 20.x), ✅ Lint, Typecheck, Format, and Test (ubuntu-latest, 20.x), ✅ Cypress (ubuntu-latest, 20.x), ✅ Publish Storybook to Chromatic (ubuntu-latest, 20.x), ✅ gerald

Pull Request URL: #1776
  • Loading branch information
handeyeco authored Oct 22, 2024
1 parent c91cba9 commit d05a4a2
Show file tree
Hide file tree
Showing 12 changed files with 24 additions and 16 deletions.
8 changes: 8 additions & 0 deletions .changeset/real-insects-film.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@khanacademy/perseus-dev-ui": patch
"@khanacademy/math-input": patch
"@khanacademy/perseus": patch
"@khanacademy/perseus-editor": patch
---

Don't export things that aren't used externally
2 changes: 1 addition & 1 deletion dev/flipbook-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ function clampIndex(index: number, array: unknown[]): number {
// Selectors
// ---------------------------------------------------------------------------

export const selectQuestionsAsJSON = cache((state: FlipbookModel): string[] => {
const selectQuestionsAsJSON = cache((state: FlipbookModel): string[] => {
return state.questions
.split("\n")
.map((s) => s.trim())
Expand Down
10 changes: 5 additions & 5 deletions packages/math-input/src/components/input/mathquill-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@ export function isFraction(node): boolean {
return mqNodeHasClass(node, "mq-fraction");
}

export function isNumerator(node): boolean {
function isNumerator(node): boolean {
return mqNodeHasClass(node, "mq-numerator");
}

export function isDenominator(node): boolean {
function isDenominator(node): boolean {
return mqNodeHasClass(node, "mq-denominator");
}

export function isSubScript(node): boolean {
function isSubScript(node): boolean {
// NOTE(charlie): MyScript has a structure whereby its superscripts seem
// to be represented as a parent node with 'mq-sup-only' containing a
// single child with 'mq-sup'.
Expand All @@ -69,7 +69,7 @@ export function isSubScript(node): boolean {
);
}

export function isSuperScript(node): boolean {
function isSuperScript(node): boolean {
// NOTE(charlie): MyScript has a structure whereby its superscripts seem
// to be represented as a parent node with 'mq-sup-only' containing a
// single child with 'mq-sup'.
Expand All @@ -82,7 +82,7 @@ export function isParens(node): boolean {
return node && node.ctrlSeq === "\\left(";
}

export function isLeaf(node): boolean {
function isLeaf(node): boolean {
return node && node.ctrlSeq && ValidLeaves.includes(node.ctrlSeq.trim());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// HACK(charlie): This should be injected by webapp somehow.
// TODO(charlie): Add a link to the webapp location as soon as the footer
// has settled down.
export const toolbarHeightPx = 60;
const toolbarHeightPx = 60;

export const scrollIntoView = (containerNode, keypadNode) => {
// TODO(charlie): There's no need for us to be reading the keypad bounds
Expand Down
2 changes: 1 addition & 1 deletion packages/math-input/src/enums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export enum KeypadType {
EXPRESSION = "EXPRESSION",
}

export const KeyTypes = [
const KeyTypes = [
"EMPTY",
// For numerals, variables, and any other characters that themselves
// compose 'values'.
Expand Down
2 changes: 1 addition & 1 deletion packages/perseus-editor/src/components/dropdown-option.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const check = `M10,3.8C10,4,9.9,4.2,9.8,4.3L5.1,8.9L4.3,9.8C4.2,9.9,4,10,3.8,10
-0.1,0.3-0.2,0.4-0.2c0.2,0,0.3,0.1,0.4,0.2l0.9,0.9C9.9,3.5,10,3.7,
10,3.8z`;

export const optionHeight = 30;
const optionHeight = 30;

class Option extends React.Component<Props> {
// @ts-expect-error - TS2564 - Property 'node' has no initializer and is not definitely assigned in the constructor.
Expand Down
2 changes: 1 addition & 1 deletion packages/perseus/src/util/math.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ export function sum(array: number[]): number {
return array.reduce(add, 0);
}

export function add(a: number, b: number): number {
function add(a: number, b: number): number {
return a + b;
}

Expand Down
2 changes: 1 addition & 1 deletion packages/perseus/src/widgets/expression/expression.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ const styles = StyleSheet.create({
* to be included as keys on the keypad. These are scraped from the answer
* forms.
*/
export const keypadConfigurationForProps = (
const keypadConfigurationForProps = (
widgetOptions: PerseusExpressionWidgetOptions,
): KeypadConfiguration => {
// Always use the Expression keypad, regardless of the button sets that have
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ type LineProps = {
};
};

export const Line = (props: LineProps) => {
const Line = (props: LineProps) => {
const {start, end, onMove, extend, stroke = defaultStroke} = props;

const [startPtPx, endPtPx] = useTransformVectorsToPixels(start, end);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import type {PointGraphState, MafsGraphProps} from "../types";

type PointGraphProps = MafsGraphProps<PointGraphState>;

export function LimitedPointGraph(props: PointGraphProps) {
function LimitedPointGraph(props: PointGraphProps) {
const {dispatch} = props;

return (
Expand All @@ -33,7 +33,7 @@ export function LimitedPointGraph(props: PointGraphProps) {
);
}

export function UnlimitedPointGraph(props: PointGraphProps) {
function UnlimitedPointGraph(props: PointGraphProps) {
const {dispatch} = props;
const graphState = useGraphConfig();
const {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const centerToTopLeft: vec.Vector2 = [-180, -170];

// The vector from the center of the protractor to the center of the rotation
// handle.
export const centerToRotationHandle: vec.Vector2 = [-176, -15];
const centerToRotationHandle: vec.Vector2 = [-176, -15];

export function Protractor() {
const {range, snapStep} = useGraphConfig();
Expand Down
2 changes: 1 addition & 1 deletion packages/perseus/src/widgets/molecule/molecule.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ type Props = {
rotationAngle: PerseusMoleculeRendererWidgetOptions["rotationAngle"];
};

export class Molecule extends React.Component<Props, MoleculeState> {
class Molecule extends React.Component<Props, MoleculeState> {
static contextType = PerseusI18nContext;
declare context: React.ContextType<typeof PerseusI18nContext>;

Expand Down

0 comments on commit d05a4a2

Please sign in to comment.