Skip to content

Commit 3389e06

Browse files
authored
Turn off functional/immutable-data linter (#2472)
## Summary: The linter turned out to be more annoying than valuable. See discussion: https://khanacademy.slack.com/archives/C01AZ9H8TTQ/p1746635108611679 Issue: none ## Test plan: `pnpm lint` Author: benchristel Reviewers: handeyeco, ivyolamit, mark-fitzgerald, SonicScrewdriver, anakaren-rojas Required Reviewers: Approved By: handeyeco Checks: ✅ 8 checks were successful Pull Request URL: #2472
1 parent 6eb6e5f commit 3389e06

File tree

200 files changed

+24
-1360
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

200 files changed

+24
-1360
lines changed

.changeset/ninety-elephants-sit.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
"@khanacademy/perseus-dev-ui": patch
3+
"@khanacademy/kas": patch
4+
"@khanacademy/kmath": patch
5+
"@khanacademy/math-input": patch
6+
"@khanacademy/perseus": patch
7+
"@khanacademy/perseus-core": patch
8+
"@khanacademy/perseus-editor": patch
9+
"@khanacademy/perseus-linter": patch
10+
"@khanacademy/perseus-score": patch
11+
"@khanacademy/perseus-utils": patch
12+
---
13+
14+
Internal: Remove eslint-plugin-functional linter

.eslintrc.js

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ module.exports = {
6262
"cypress",
6363
"disable",
6464
"import",
65-
"functional",
6665
"jest",
6766
"jsdoc",
6867
"monorepo",
@@ -196,29 +195,7 @@ module.exports = {
196195
allowNullableNumber: true,
197196
},
198197
],
199-
"functional/immutable-data": [
200-
"error",
201-
{
202-
ignoreClasses: true,
203-
ignoreImmediateMutation: true,
204-
},
205-
],
206198
},
207-
overrides: [
208-
{
209-
files: [
210-
"*.cypress.tsx",
211-
"*.cypress.ts",
212-
"*.test.ts",
213-
"*.test.tsx",
214-
"*.stories.ts",
215-
"*.stories.tsx",
216-
],
217-
rules: {
218-
"functional/immutable-data": "off",
219-
},
220-
},
221-
],
222199
excludedFiles: ["*.d.ts", "*.config.ts", "**/*.cypress.ts"],
223200
},
224201
],

config/test/test-setup.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable functional/immutable-data */
21
/**
32
* This file is loaded after the jest test framework has be initialized
43
* but before any tests have run.

data/find-questions.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,6 @@ function findJsonFiles(dir, accumulator: string[] = []) {
5959
if (fs.statSync(absolutePath).isDirectory()) {
6060
return findJsonFiles(absolutePath, accumulator);
6161
} else if (absolutePath.endsWith(".json")) {
62-
// TODO(LEMS-3083): Remove eslint suppression
63-
// eslint-disable-next-line functional/immutable-data
6462
return accumulator.push(absolutePath);
6563
}
6664
});
@@ -75,8 +73,6 @@ function checkFiles(jsonFiles) {
7573
const data = fs.readFileSync(fileName, "utf8");
7674
const json = JSON.parse(data);
7775
if (predicateCallback(json)) {
78-
// TODO(LEMS-3083): Remove eslint suppression
79-
// eslint-disable-next-line functional/immutable-data
8076
output.push(data);
8177
}
8278
}

dev/gallery.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,6 @@ export function Gallery() {
125125
const insertShowTooltips = ([question, i]): [PerseusRenderer, number] => {
126126
Object.keys(question.widgets).forEach((widgetName) => {
127127
if (question.widgets[widgetName].type === "interactive-graph") {
128-
// TODO(LEMS-3083): Remove eslint suppression
129-
// eslint-disable-next-line functional/immutable-data
130128
question.widgets[widgetName].options.showTooltips =
131129
showTooltips;
132130
}

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@
7171
"eslint-plugin-cypress": "^2.15.1",
7272
"eslint-plugin-disable": "^2.0.3",
7373
"eslint-plugin-eslint-comments": "^3.2.0",
74-
"eslint-plugin-functional": "^6.6.3",
7574
"eslint-plugin-import": "^2.29.1",
7675
"eslint-plugin-jest": "28.9.0",
7776
"eslint-plugin-jsdoc": "^48.2.1",

packages/kas/src/__tests__/rendering.test.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ expect.extend({
3030
times: false,
3131
} as const;
3232
_.each(optlist, function (opt) {
33-
// TODO(LEMS-3083): Remove eslint suppression
34-
// eslint-disable-next-line functional/immutable-data
3533
options[opt] = true;
3634
});
3735

packages/kas/src/nodes.ts

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,8 @@ function partition<T, V extends _.Collection<T>>(
6666
const b: _.TypeOfCollection<V>[] = [];
6767
_.forEach(list, (elem, key, ctx) => {
6868
if (iteratee(elem, key, ctx)) {
69-
// TODO(LEMS-3083): Remove eslint suppression
70-
// eslint-disable-next-line functional/immutable-data
7169
a.push(elem);
7270
} else {
73-
// TODO(LEMS-3083): Remove eslint suppression
74-
// eslint-disable-next-line functional/immutable-data
7571
b.push(elem);
7672
}
7773
});
@@ -3599,8 +3595,6 @@ var parseError = function (str: string, hash) {
35993595

36003596
// expose concrete nodes to parser scope
36013597
// see http://zaach.github.io/jison/docs/#sharing-scope
3602-
// TODO(LEMS-3083): Remove eslint suppression
3603-
// eslint-disable-next-line functional/immutable-data
36043598
parser.yy = {
36053599
Add: Add,
36063600
Mul: Mul,
@@ -3637,12 +3631,8 @@ export const parse = function (input: string, options?: ParseOptions) {
36373631
try {
36383632
if (options && options.functions) {
36393633
// reserve the symbol "i" for complex numbers
3640-
// TODO(LEMS-3083): Remove eslint suppression
3641-
// eslint-disable-next-line functional/immutable-data
36423634
parser.yy.functions = _.without(options.functions, "i");
36433635
} else {
3644-
// TODO(LEMS-3083): Remove eslint suppression
3645-
// eslint-disable-next-line functional/immutable-data
36463636
parser.yy.functions = [];
36473637
}
36483638

@@ -3777,16 +3767,12 @@ export const unitParse = function (input: string) {
37773767
const unitArray: Pow[] = [];
37783768

37793769
_(parseResult.unit.num).each((unitSpec) => {
3780-
// TODO(LEMS-3083): Remove eslint suppression
3781-
// eslint-disable-next-line functional/immutable-data
37823770
unitArray.push(
37833771
new Pow(unprefixify(unitSpec.name), new Int(unitSpec.pow)),
37843772
);
37853773
});
37863774

37873775
_(parseResult.unit.denom).each((unitSpec) => {
3788-
// TODO(LEMS-3083): Remove eslint suppression
3789-
// eslint-disable-next-line functional/immutable-data
37903776
unitArray.push(
37913777
new Pow(unprefixify(unitSpec.name), new Int(-1 * unitSpec.pow)),
37923778
);
@@ -3877,17 +3863,13 @@ const makeAlias = function (str: string, prefixes: Prefixes) {
38773863
numdenomStr[0]
38783864
.split(" ")
38793865
.filter((x) => x !== "")
3880-
// TODO(LEMS-3083): Remove eslint suppression
3881-
// eslint-disable-next-line functional/immutable-data
38823866
.forEach((x) => numdenom.push(new Unit(x)));
38833867
}
38843868

38853869
if (numdenomStr[1]) {
38863870
numdenomStr[1]
38873871
.split(" ")
38883872
.filter((x) => x !== "")
3889-
// TODO(LEMS-3083): Remove eslint suppression
3890-
// eslint-disable-next-line functional/immutable-data
38913873
.forEach((x) => numdenom.push(new Pow(new Unit(x), NumDiv)));
38923874
}
38933875

packages/kmath/src/angles.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,7 @@ export const getClockwiseAngle = (
6262

6363
// Reverse the coordinates accordingly to ensure the angle is calculated correctly
6464
const clockwiseCoords = shouldReverseCoords
65-
? // TODO(LEMS-3083): Remove eslint suppression
66-
// eslint-disable-next-line functional/immutable-data
67-
coordsCopy.reverse()
65+
? coordsCopy.reverse()
6866
: coordsCopy;
6967

7068
// Calculate the angles between the two points and get the difference

packages/kmath/src/geometry.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -217,11 +217,7 @@ export function similar(
217217

218218
// Reverse angles and sides to allow matching reflected polygons
219219
if (i >= n) {
220-
// TODO(LEMS-3083): Remove eslint suppression
221-
// eslint-disable-next-line functional/immutable-data
222220
angles.reverse();
223-
// TODO(LEMS-3083): Remove eslint suppression
224-
// eslint-disable-next-line functional/immutable-data
225221
sides.reverse();
226222
// Since sides are calculated from two coordinates,
227223
// simply reversing results in an off by one error

0 commit comments

Comments
 (0)