Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

JavaScript/TypeScript linting: nothing covers astro.config.mjs or src/ TypeScript

オープン
#49 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
52/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
活発
技術スタック
eslint, github-actions, javascript, typescript
領域
ci-cd, tooling

調査の方向性

.mega-linter.yml と .github/workflows/mega-linter.yml を読んでから、issue にリンクされている既存の MegaLinter の実行結果を比較します。lint のアプローチと APPLY_FIXES の動作を選択して文書化し、astro.config.mjs が JS/TS の lint サマリーに表示されることを確認し、ジョブが失敗することを確認するために一時的な lint エラーを導入します。

索引モデルが issue の本文から書いたものです。

説明

infra needs-william

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 with typescript-eslint and eslint-plugin-astro. This activates JAVASCRIPT_ES and TYPESCRIPT_ES in MegaLinter automatically — no .mega-linter.yml change needed — and eslint-plugin-astro gives .astro files genuine coverage rather than the best-effort HTML treatment the config currently assumes. Most work, most value.
  • Or set JAVASCRIPT_DEFAULT_STYLE: prettier and TYPESCRIPT_DEFAULT_STYLE: prettier in .mega-linter.yml. Cheap, but it only catches formatting, not correctness. Note JSON_PRETTIER and YAML_PRETTIER are already in DISABLE_LINTERS for conflicting with the linters that own those formats, so this would want checking against stylelint/editorconfig-checker for 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.mjs is 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_FIXES settings reflect it
  • Introducing a lint error in astro.config.mjs fails the MegaLinter job
主要言語
HTML
スター
0
フォーク
0
平均マージ
9時間 52分
マージ済み PR(30日)
59

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

laywill/laywill.github.io のほかの issue

laywill/laywill.github.io の issue をすべて見る

似ている issue

DevOps の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。