Skip to content

Commit

Permalink
[Linter] Remove Math Font Size rule from editor linter (#2240)
Browse files Browse the repository at this point in the history
## Summary:
A content editing lint rule exists that prevents the changing of the font size of math content. There is no historical or documented reason for having this rule, so it is being removed to give content creators more flexibility in how they configure content.

Issue: LEMS-2843

## Test plan:
1. Open an exercise in the editor ([ZND for testing](https://www.khanacademy.org/internal-courses/test-everything/test-everything-2-without-mastery/te-numeric-input/e/numeric-input-exercise-examples))
2. Add some math text with font size indicated
   * i.e. `$\large{123}$`
3. Notice that no linting error appears on the right side of the preview

## Affected behavior
### Before:
![Lint Message - Before](https://github.com/user-attachments/assets/c459377c-9987-4328-a9b5-df43cda0a5df)

### After:
![Lint Message - After](https://github.com/user-attachments/assets/df634360-024e-41e1-8cd8-0b8e1e6173b9)

Author: mark-fitzgerald

Reviewers: nishasy, #perseus

Required Reviewers:

Approved By: nishasy

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

Pull Request URL: #2240
  • Loading branch information
mark-fitzgerald authored Feb 14, 2025
1 parent a2aedec commit bae77a6
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 30 deletions.
5 changes: 5 additions & 0 deletions .changeset/gorgeous-dragons-collect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@khanacademy/perseus-linter": patch
---

[Linter] Remove Math Font Size rule from editor linter
17 changes: 0 additions & 17 deletions packages/perseus-linter/src/__tests__/rules.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import mathAdjacentRule from "../rules/math-adjacent";
import mathAlignExtraBreakRule from "../rules/math-align-extra-break";
import mathAlignLinebreaksRule from "../rules/math-align-linebreaks";
import mathEmptyRule from "../rules/math-empty";
import mathFontSizeRule from "../rules/math-font-size";
import mathFracRule from "../rules/math-frac";
import mathNestedRule from "../rules/math-nested";
import mathStartsWithSpaceRule from "../rules/math-starts-with-space";
Expand Down Expand Up @@ -375,22 +374,6 @@ describe("Individual lint rules tests", () => {
// @ts-expect-error - TS2554 - Expected 3 arguments, but got 2.
expectPass(mathNestedRule, ["$\\text{4}x$", "inline $\\text{4}x$ math"]);

// @ts-expect-error - TS2554 - Expected 3 arguments, but got 2.
expectWarning(mathFontSizeRule, [
"$\\tiny{x}$",
"inline $\\Tiny{x}$ math",
"$a \\small{x} b$",
"$\\large{ xyz }$",
"$ \\Large { x } $",
"$\\LARGE{x}$",
"$\\huge{x}$",
"$\\Huge{x}$",
"$\\normalsize{x}$",
"$\\scriptsize{x}$",
]);
// @ts-expect-error - TS2554 - Expected 3 arguments, but got 2.
expectPass(mathFontSizeRule, ["$\\sqrt{x}$", "inline $\\sqrt{x}$ math"]);

// @ts-expect-error - TS2554 - Expected 3 arguments, but got 2.
expectWarning(mathWithoutDollarsRule, [
"One half: \\frac{1}{2}!",
Expand Down
2 changes: 0 additions & 2 deletions packages/perseus-linter/src/rules/all-rules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import MathAdjacent from "./math-adjacent";
import MathAlignExtraBreak from "./math-align-extra-break";
import MathAlignLinebreaks from "./math-align-linebreaks";
import MathEmpty from "./math-empty";
import MathFontSize from "./math-font-size";
import MathFrac from "./math-frac";
import MathNested from "./math-nested";
import MathStartsWithSpace from "./math-starts-with-space";
Expand Down Expand Up @@ -56,7 +55,6 @@ export default [
MathAlignExtraBreak,
MathAlignLinebreaks,
MathEmpty,
MathFontSize,
MathFrac,
MathNested,
MathStartsWithSpace,
Expand Down
11 changes: 0 additions & 11 deletions packages/perseus-linter/src/rules/math-font-size.ts

This file was deleted.

0 comments on commit bae77a6

Please sign in to comment.