`openedx lint` does not lint `.jsx` files
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 62/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- javascript, react, typescript
- 领域
- tooling
调研方向
修复应放在 tools/eslint/base.eslint.config.js 的 file patterns 中,或放在 createLintConfig 里,并与 typescript-eslint 配置一起声明 **/*.jsx。阅读 tools/cli/openedx.ts,了解旧的 --ext 处理方式是如何被移除的。验证方法是:在 fixture 或模板应用下的 .jsx 文件中加入一个探针,例如未使用的变量,然后运行 npm run lint,此时应能报告该问题。当该探针被报告,且面向使用方应用的 lint:fix 说明已包含在本次变更中时,即为完成。
由索引模型根据 Issue 内容生成。
描述
What: openedx lint does not lint .jsx files. In an app built on createLintConfig, a .jsx file with any error passes npm run lint; the same error in a .js, .ts or .tsx file fails.
Reproduced on 2026-10-26 in fresh clones of every converted app that has .jsx files, by appending const unusedProbe = 1; to one .jsx and one .js file under src/ and running npm run lint (clean baseline before, files restored after):
| app | .jsx files |
.jsx probe |
.js probe |
|---|---|---|---|
| frontend-app-profile | 44 | not reported (src/profile/UserCertificateSummary.jsx) |
@typescript-eslint/no-unused-vars (src/utils.js) |
| frontend-app-account | 89 | not reported (src/account-settings/SwitchContent.jsx) |
reported (src/utils.js) |
| frontend-app-gradebook | 86 | not reported (src/utils/hoc.jsx) |
reported (src/utils/keyStore.js) |
| frontend-app-learner-dashboard | 130 | not reported (src/setupTest.jsx) |
reported (src/testUtils.js) |
| frontend-app-catalog | 4 | not reported (src/widgets/CatalogHeader/ProgramsLinkMenuItem.jsx) |
reported (src/setupTest.js) |
frontend-template-application and frontend-app-instructor-dashboard have no .jsx files, which is why nothing has tripped. frontend-base itself has ten (runtime/react/*.jsx) under the same base config.
Why: ESLint 9 lints .js, .cjs and .mjs by default and other extensions only when a files pattern names them. From the configuration files docs: "To lint files with extensions other than the default .js, .cjs and .mjs, include them in files with a pattern in the format of "**/*.extension". Any pattern will work except if it is * or if it ends with /* or /**." tools/eslint/base.eslint.config.js extends typescript-eslint's configs, which name **/*.ts and **/*.tsx, so TypeScript files are linted; nothing names **/*.jsx. The files: ['src/**/*', 'site.config.*'] block the template and the apps carry ends in /* and adds no extension.
It is a regression of the ESLint 9 upgrade, not a decision. Before f0c0d0db (feat: Upgrade to ESLint 9, 2025-04-23, via #39), tools/cli/openedx.ts added the extensions itself:
// If extensions haven't been specified, add them. Otherwise we don't get jsx/tsx files.
if (process.argv.indexOf('--ext') === -1) {
process.argv.push('--ext');
process.argv.push('.js,.jsx,.ts,.tsx');
}
ESLint 9 dropped --ext, the upgrade deleted the block, and the files patterns that replaced it recovered .tsx through typescript-eslint and not .jsx. No ADR, issue or PR records dropping .jsx; the upgrade's commit message only notes that "the repository wasn't linting very consistently before this".
Fix: name **/*.jsx in the base config's file patterns (or in createLintConfig), so every consumer gets it without touching its own eslint.config.js.
What the fix surfaces in the converted apps, measured the same day with a files: ['src/**/*.jsx'] block added to each app's eslint.config.js:
| app | problems | files | fixable with --fix |
left after --fix |
|---|---|---|---|---|
| profile | 77 (75 errors, 2 warnings) | 12 | 70 | 3 formatjs/enforce-description, 1 @stylistic/indent-binary-ops, 2 unused directives |
| account | 203 (192 errors, 11 warnings) | 26 | 181 | 5 no-import-assign, 2 @typescript-eslint/prefer-for-of, 11 unused directives, a few others |
| gradebook | 70 (66 errors, 4 warnings) | 17 | 27 | 28 react/display-name, 11 react/prop-types, 4 unused directives |
| learner-dashboard | 133 (128 errors, 5 warnings) | 20 | 126 | 4 react/prop-types, 5 unused directives, 2 others |
| catalog | 4 | 4 | 0 | 4 react/prop-types |
The bulk is @stylistic/indent, brace-style and semi that npm run lint:fix clears; the rest is a handful of react/prop-types and react/display-name findings per app and eslint-disable directives for rules the base config does not enable (airbnb-era react/forbid-prop-types and the like). Each app's lint goes red the day the fix ships, so the release note should say so and point at lint:fix.
[!NOTE]
This issue body was drafted by Claude (Claude Code) and reviewed before posting.
- 主要语言
- TypeScript
- 星标
- 4
- 派生
- 13
- 平均合并
- 3 天 5 小时
- 30 天内合并 PR
- 4
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
openedx/frontend-base 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 68/100
openedx/frontend-base#330 ·
-
难度 2/5 1-3 小时 新手友好度 72/100
openedx/frontend-base#210 ·
-
难度 4/5 3-5 天 新手友好度 48/100
openedx/frontend-base#350 ·
-
External routes ignore params可能已有人在做 @arbrandes 今天认领。 未关闭
难度 4/5 3-5 天 新手友好度 45/100
openedx/frontend-base#349 · 已指派 1 人 ·
-
A site cannot override an installed app's route for a role with an external route可能已有人在做 @arbrandes 今天认领。 未关闭
难度 4/5 3-5 天 新手友好度 45/100
openedx/frontend-base#348 · 已指派 1 人 ·
查看 openedx/frontend-base 的全部 Issue
相似的 Issue
-
bug P3
难度 1/5 1 小时以内 新手友好度 87/100
维护者通常 1 天内回复
-
feat(ai): add markdown checklist export and copy-to-clipboard button to ActionItemSynthesizer drawer未关闭ai enhancement feature feature-request good-issue L1 level 1 needs-review wocs
难度 2/5 1-3 小时 新手友好度 78/100
SatyamPandey-07/WorkSphere#8149 · 1 条评论 ·
维护者通常 1 天内回复
-
enhancement follow-up
难度 2/5 1-3 小时 新手友好度 67/100
维护者通常 1 天内回复
-
Client execution contract accepts a grant the code never takes可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭area: client enhancement priority: medium
难度 2/5 1-3 小时 新手友好度 78/100
opensro-dev/opensro#3808 ·
维护者通常 1 天内回复
-
bug ux
难度 2/5 1-3 小时 新手友好度 70/100
mithilp/keybuddies#66 ·