Skip to content

Commit

Permalink
no-unused-vars
Browse files Browse the repository at this point in the history
  • Loading branch information
handeyeco committed Nov 26, 2024
1 parent 8381ad9 commit 7ba21eb
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 41 deletions.
3 changes: 1 addition & 2 deletions packages/kas/src/nodes.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable prettier/prettier */
/* eslint-disable import/order */
/* TODO(charlie): fix these lint errors (http://eslint.org/docs/rules): */
/* eslint-disable indent, no-undef, no-var, no-dupe-keys, no-new-func, no-redeclare, @typescript-eslint/no-unused-vars, comma-dangle, max-len, prefer-spread, space-infix-ops, space-unary-ops */
/* eslint-disable indent, no-undef, no-var, no-dupe-keys, no-new-func, no-redeclare, comma-dangle, max-len, prefer-spread, space-infix-ops, space-unary-ops */
import _ from "underscore";

import {unitParser} from "./__genfiles__/unitparser";
Expand Down Expand Up @@ -1414,7 +1414,6 @@ export class Mul extends Seq {
rational = rational.addHint("fraction");
}

var result;
if (num.n < 0 && right.n < 0) {
rational.d = -rational.d;
return left.replace(num, [NumNeg, rational]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import "../styles/perseus-editor.less";
type Props = React.ComponentProps<typeof ItemExtrasEditor>;

const Wrapper = (props: Props) => {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const {onChange, ...rest} = props;
const [extras, setExtras] =
React.useState<Partial<typeof ItemExtrasEditor.defaultProps>>(rest);
Expand All @@ -19,7 +18,7 @@ const Wrapper = (props: Props) => {
<ItemExtrasEditor
{...extras}
onChange={(e) => {
props.onChange?.(e); // to register action in storybook
onChange?.(e); // to register action in storybook
setExtras((prevExtras) => ({...prevExtras, ...e}));
}}
/>
Expand Down
3 changes: 1 addition & 2 deletions packages/perseus-editor/src/multirenderer-editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ import type {

// Multi-item item types
Item,
// ItemTree is used below, the linter is confused.
ItemTree, // eslint-disable-line @typescript-eslint/no-unused-vars
ItemTree,
ItemObjectNode,
ItemArrayNode,
ContentNode,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ import * as React from "react";

import {flags} from "../../../__stories__/flags-for-api-options";

// Disabling the following linting error because the import is needed for mocking purposes.
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import examples from "./locked-function-examples";
import LockedFunctionSettings from "./locked-function-settings";
import {
getDefaultFigureForType,
Expand Down
4 changes: 2 additions & 2 deletions packages/perseus/src/perseus-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1166,9 +1166,9 @@ export type PerseusOrdererWidgetOptions = {
// Cards that are not part of the answer
otherOptions: ReadonlyArray<PerseusRenderer>;
// "normal" for text options. "auto" for image options.
height: string;
height: "normal" | "auto";
// Use the "horizontal" layout for short text and small images. The "vertical" layout is best for longer text (e.g. proofs).
layout: string;
layout: "horizontal" | "vertical";
};

export type PerseusPassageWidgetOptions = {
Expand Down
1 change: 0 additions & 1 deletion packages/perseus/src/util/graphie.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @babel/no-invalid-this */
import {
point as kpoint,
vector as kvector,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {array, constant, object, string} from "../general-purpose-parsers";
import {array, constant, enumeration, object} from "../general-purpose-parsers";

import {parsePerseusRenderer} from "./perseus-renderer";
import {parseWidget} from "./widget";
Expand All @@ -19,7 +19,7 @@ export const parseOrdererWidget: Parser<OrdererWidget> = parseWidget(
options: array(parseRenderer),
correctOptions: array(parseRenderer),
otherOptions: array(parseRenderer),
height: string,
layout: string,
height: enumeration("normal", "auto"),
layout: enumeration("horizontal", "vertical"),
}),
);
Original file line number Diff line number Diff line change
Expand Up @@ -512,8 +512,8 @@ describe("parseWidgetsMap", () => {
options: [],
correctOptions: [],
otherOptions: [],
height: "",
layout: "",
height: "normal",
layout: "horizontal",
},
},
};
Expand Down
26 changes: 6 additions & 20 deletions packages/perseus/src/widgets/orderer/orderer.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable @khanacademy/ts-no-error-suppressions */
/* eslint-disable @babel/no-invalid-this, @typescript-eslint/no-unused-vars, react/no-unsafe */
/* eslint-disable @babel/no-invalid-this, react/no-unsafe */
import {Errors} from "@khanacademy/perseus-core";
import {linterContextDefault} from "@khanacademy/perseus-linter";
import $ from "jquery";
Expand All @@ -17,12 +17,7 @@ import {getPromptJSON as _getPromptJSON} from "../../widget-ai-utils/orderer/ord
import {scoreOrderer} from "./score-orderer";

import type {PerseusOrdererWidgetOptions} from "../../perseus-types";
import type {
PerseusScore,
WidgetExports,
WidgetProps,
Widget,
} from "../../types";
import type {WidgetExports, WidgetProps, Widget} from "../../types";
import type {
PerseusOrdererRubric,
PerseusOrdererUserInput,
Expand Down Expand Up @@ -300,11 +295,6 @@ class Card extends React.Component<CardProps, CardState> {
}
}

const NORMAL = "normal";
const AUTO = "auto";
const HORIZONTAL = "horizontal";
const VERTICAL = "vertical";

type RenderProps = PerseusOrdererWidgetOptions & {
current: any;
};
Expand Down Expand Up @@ -344,8 +334,8 @@ class Orderer
current: [],
options: [],
correctOptions: [],
height: NORMAL,
layout: HORIZONTAL,
height: "normal",
layout: "horizontal",
linterContext: linterContextDefault,
};

Expand Down Expand Up @@ -521,7 +511,7 @@ class Orderer

findCorrectIndex: (arg1: any, arg2: any) => any = (draggable, list) => {
// Find the correct index for a card given the current cards.
const isHorizontal = this.props.layout === HORIZONTAL;
const isHorizontal = this.props.layout === "horizontal";
// eslint-disable-next-line react/no-string-refs
// @ts-expect-error - TS2769 - No overload matches this call.
const $dragList = $(ReactDOM.findDOMNode(this.refs.dragList));
Expand Down Expand Up @@ -585,7 +575,7 @@ class Orderer
return false;
}

const isHorizontal = this.props.layout === HORIZONTAL;
const isHorizontal = this.props.layout === "horizontal";
// @ts-expect-error - TS2769 - No overload matches this call.
const $draggable = $(ReactDOM.findDOMNode(draggable));
// eslint-disable-next-line react/no-string-refs
Expand All @@ -601,10 +591,6 @@ class Orderer
const bankHeight = $bank.outerHeight(true);
// @ts-expect-error - TS2339 - Property 'outerWidth' does not exist on type 'JQueryStatic'.
const bankWidth = $bank.outerWidth(true);
// eslint-disable-next-line react/no-string-refs
const dragList = ReactDOM.findDOMNode(this.refs.dragList);
// @ts-expect-error - TS2769 - No overload matches this call. | TS2339 - Property 'width' does not exist on type 'JQueryStatic'.
const dragListWidth = $(dragList).width();
// @ts-expect-error - TS2339 - Property 'outerWidth' does not exist on type 'JQueryStatic'.
const draggableWidth = $draggable.outerWidth(true);

Expand Down
7 changes: 3 additions & 4 deletions packages/simple-markdown/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* eslint-disable prefer-spread, no-regex-spaces, @typescript-eslint/no-unused-vars, guard-for-in, no-console, no-var */
/* eslint-disable prefer-spread, no-regex-spaces, guard-for-in, no-console, no-var */
/**
* Simple-Markdown
* ===============
Expand Down Expand Up @@ -710,7 +710,6 @@ var TABLES = (function () {
// predefine regexes so we don't have to create them inside functions
// sure, regex literals should be fast, even inside functions, but they
// aren't in all browsers.
var TABLE_BLOCK_TRIM = /\n+/g;
var TABLE_ROW_SEPARATOR_TRIM = /^ *\| *| *\| *$/g;
var TABLE_CELL_END_TRIM = / *$/;
var TABLE_RIGHT_ALIGN = /^ *-+: *$/;
Expand Down Expand Up @@ -931,7 +930,7 @@ var defaultRules: DefaultRules = {

// map output over the ast, except group any text
// nodes together into a single string output.
for (var i = 0, key = 0; i < arr.length; i++) {
for (var i = 0; i < arr.length; i++) {
var node = arr[i];
if (node.type === "text") {
node = {type: "text", content: node.content};
Expand Down Expand Up @@ -1901,7 +1900,7 @@ var markdownToHtml = function (source: string, state?: State | null): string {

// TODO: This needs definition
type Props = any;
var ReactMarkdown = function (props): React.ReactElement {
var ReactMarkdown = function (props: Props): React.ReactElement {
var divProps: Record<string, any> = {};

for (var prop in props) {
Expand Down

0 comments on commit 7ba21eb

Please sign in to comment.