JavaScript/TypeScript linting: nothing covers astro.config.mjs or src/ TypeScript
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 52/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- eslint, github-actions, javascript, typescript
调研方向
首先阅读 .mega-linter.yml 和 .github/workflows/mega-linter.yml,然后比较 issue 中链接的现有 MegaLinter 运行结果。选择并记录 linting 方案和 APPLY_FIXES 行为,确认 astro.config.mjs 出现在 JS/TS lint 摘要中,并引入一个临时 lint 错误以确认 job 失败。
由索引模型根据 Issue 内容生成。
描述
Found while reviewing #47 (Astro scaffold). That PR adds astro.config.mjs at the repo root and nothing in CI lints or type-checks it. The same hole will apply to src/** TypeScript as soon as there is any.
JAVASCRIPT and TYPESCRIPT are both listed in ENABLE: in .mega-linter.yml, but three activation rules combine so that no JS/TS linter actually runs.
1. JAVASCRIPT_ES / TYPESCRIPT_ES are inactive — there is no ESLint config. From the MegaLinter run on #47 (33994992304):
[Activation] JAVASCRIPT_ES has been set inactive, as none of these files has been found:
['eslint.config.js', 'eslint.config.mjs', 'eslint.config.cjs', 'eslint.config.ts',
'eslint.config.mts', 'eslint.config.cts', '.eslintrc.json', '.eslintrc.yml',
'.eslintrc.yaml', '.eslintrc.js', '.eslintrc.cjs', 'package.json:eslintConfig']
An identical line follows for TYPESCRIPT_ES. Confirmed against the tree: no eslint.config.*, no .eslintrc.* and no eslintConfig key in package.json, on either main or the PR branch.
2. JAVASCRIPT_PRETTIER / TYPESCRIPT_PRETTIER are skipped by the default style setting.
Some linters were skipped due to activation rules:
- JAVASCRIPT_PRETTIER: JAVASCRIPT_DEFAULT_STYLE=standard (set JAVASCRIPT_DEFAULT_STYLE=prettier to activate)
- TYPESCRIPT_PRETTIER: TYPESCRIPT_DEFAULT_STYLE=standard (set TYPESCRIPT_DEFAULT_STYLE=prettier to activate)
3. standard never runs either. Neither the MATCHING LINTERS table nor the run summary contains a JAVASCRIPT or TYPESCRIPT row at all. The summary descriptors on that green run are CSS, EDITORCONFIG, JSON, MARKDOWN, REPOSITORY, SPELL and YAML — and nothing else.
Net effect: the only tools that see astro.config.mjs are editorconfig-checker (whitespace, indentation, trailing newline) and cspell (spelling). Nothing parses it as JavaScript.
Options
- Add an ESLint flat config (
eslint.config.mjs), probably withtypescript-eslintandeslint-plugin-astro. This activatesJAVASCRIPT_ESandTYPESCRIPT_ESin MegaLinter automatically — no.mega-linter.ymlchange needed — andeslint-plugin-astrogives.astrofiles genuine coverage rather than the best-effort HTML treatment the config currently assumes. Most work, most value. - Or set
JAVASCRIPT_DEFAULT_STYLE: prettierandTYPESCRIPT_DEFAULT_STYLE: prettierin.mega-linter.yml. Cheap, but it only catches formatting, not correctness. NoteJSON_PRETTIERandYAML_PRETTIERare already inDISABLE_LINTERSfor conflicting with the linters that own those formats, so this would want checking againststylelint/editorconfig-checkerfor the same class of disagreement. - Or accept the gap deliberately and record why. Not recommended once
src/**has TypeScript in it.
Behavioural change worth being deliberate about
.mega-linter.yml sets APPLY_FIXES: yes and .github/workflows/mega-linter.yml sets APPLY_FIXES_MODE: commit with APPLY_FIXES_EVENT: pull_request. Whichever formatter is turned on will start auto-committing formatting changes onto PR branches via git-auto-commit-action. That is a real change in how the repo behaves on every PR, not just a new check, so it should be a conscious choice rather than a side effect of enabling a linter.
Related, but a separate fix
astro check (wired as npm run check in package.json) is not run by any workflow either. docs/overhaul/architecture.md already lists "Astro build (astro check + astro build)" as a pipeline job, and .mega-linter.yml carries a NOTE that no MegaLinter linter understands Astro component syntax natively — so astro check is the only thing that will ever type-check .astro frontmatter, whatever we decide above. #47 flags wiring npm run build / npm run check into CI as a follow-up. That belongs with #25 (tag-gated release pipeline), whose lint + SAST + build + link check job set is where those steps land; this issue is scoped to the linter configuration only.
Also worth knowing while sizing the ESLint option: FILTER_REGEX_EXCLUDE in .mega-linter.yml ends in \.astro, and being unanchored it matches every *.astro file, not just the .astro/ build cache directory. So src/**/*.astro is currently excluded from MegaLinter entirely and the "best-effort HTML coverage" the config's NOTE assumes is not happening. That is the same unanchored-regex bug as the \.git / .github/ one tracked in #48 and should be fixed there rather than here, but it changes what eslint-plugin-astro would buy us.
Acceptance criteria
- A decision is recorded (ESLint, Prettier-only, or deliberate no-op) with its rationale
-
astro.config.mjsis analysed by a JS/TS linter on PRs, evidenced by a JAVASCRIPT or TYPESCRIPT row in the MegaLinter summary table - A deliberate call is made on whether the enabled formatter may auto-commit to PR branches, and
APPLY_FIXESsettings reflect it - Introducing a lint error in
astro.config.mjsfails the MegaLinter job
- 主要语言
- HTML
- 星标
- 0
- 派生
- 0
- 平均合并
- 9 小时 52 分钟
- 30 天内合并 PR
- 59
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
laywill/laywill.github.io 的其他 Issue
-
design
难度 2/5 1-3 小时 新手友好度 75/100
laywill/laywill.github.io#186 ·
维护者通常 1 天内回复
-
design
难度 2/5 1-3 小时 新手友好度 68/100
laywill/laywill.github.io#183 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 半天 新手友好度 74/100
laywill/laywill.github.io#135 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
laywill/laywill.github.io#106 ·
维护者通常 1 天内回复
-
infra needs-william
难度 2/5 1-3 小时 新手友好度 82/100
laywill/laywill.github.io#35 · 1 条评论 ·
维护者通常 1 天内回复
查看 laywill/laywill.github.io 的全部 Issue
相似的 Issue
-
[BUG] Container scenario crashes without expected_recovery_time, kube DNS example uses retry_wait未关闭needs-triage
难度 2/5 1-3 小时 新手友好度 77/100
krkn-chaos/krkn#1627 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
int128/typescript-action#1575 ·
维护者通常 1 天内回复
-
agent/sec-check hive/hosted-available-lke648397-260827-5n31 security
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 70/100
femiwiki/docker-mediawiki#1497 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
EPFL-ENAC/co2-calculator#3055 ·
维护者通常 1 天内回复