Skip to content

Phase 6: tooling (lint, format, build, CI)#9

Merged
froggychips merged 1 commit into
mainfrom
review/phase-6-tooling
May 19, 2026
Merged

Phase 6: tooling (lint, format, build, CI)#9
froggychips merged 1 commit into
mainfrom
review/phase-6-tooling

Conversation

@froggychips

Copy link
Copy Markdown
Owner

Summary

Расширение собиралось руками — README показывал длинную zip-команду с exclusions, ни линта ни prettier. Минимальный node-based tooling без bundler. Vanilla content scripts остаются как есть; bundler (esbuild) подтянется в PR-4 (options split) когда понадобится.

Что добавлено

  • package.jsonscripts: lint, format, package, check. Две devDeps: eslint и prettier.
  • eslint.config.js (flat config, ESLint 9) — WebExtensions + browser globals, мягкие правила (no-undef, no-unused-vars warn). Игнорируются tweai-mcp-server/, docs/, _locales/.
  • .prettierrc.json + .prettierignore — 100col, single quotes, trailing commas all, LF.
  • tools/build.mjs — копирует runtime-файлы в dist/ (без mcp-server, docs), собирает tweai-v<version>.zip через системный zip.
  • .github/workflows/checks.yml — на PR/main: lint + format + build, заливает zip как artifact (14 дней).
  • .github/workflows/release.yml — на push тега v*: build → gh release create с auto-generated notes + zip.
  • .gitignoredist/, *.zip, .eslintcache.

Smoke

Локально проверено: node tools/build.mjs собирает 14-файловый dist/ + 77.9 KB zip. node --check зелёный на всех конфигах.

Что НЕ в этом PR

  • Bundler (esbuild) — оставлен на PR-4 (options split на ESM-модули).
  • Vitest / тесты — оставлены на следующую итерацию (план PR-6 называл vitest, но без bundler и без модулей юнит-тестить selectors.js/providers тяжело — пойдёт после PR-4).
  • ESLint мягкий специально: после merge запустится первый раз в CI, ожидаемо будут warnings. Fix-up — отдельным PR при необходимости.

Test plan

  • Локально: npm install && npm run lint — отрабатывает (предупреждения OK)
  • npm run package создаёт tweai-v1.8.1.zip который грузится в Chrome unpacked без warnings
  • CI на этом PR: checks.yml зелёный (или показывает первые findings которые можно либо пофиксить либо relax-нуть)
  • Тест release: после мерджа push tag v1.9.0 → workflow создаёт release с zip-артефактом
  • GitHub Actions billing разблокирован для froggychips — без этого все workflows skip-нутся

🤖 Generated with Claude Code

Расширение собиралось рукой: README показывал zip-команду с
exclusions, lint/format не было. Добавлен минимальный node-based
tooling без bundler (vanilla content scripts остаются как есть).

- package.json: scripts lint, format, package, check. Только две
  devDependencies — eslint и prettier. Без bundler в этом PR; будущий
  PR-4 (options split) подключит esbuild сюда же.
- eslint.config.js (flat config, ESLint 9): WebExtensions + browser
  globals; правила мягкие — no-undef, no-unused-vars (warn), без style
  rules (это prettier). Игнорируются tweai-mcp-server, docs, _locales.
- .prettierrc.json + .prettierignore: 100col, single quotes, trailing
  commas all, LF endings.
- tools/build.mjs: копирует runtime-файлы в dist/ исключая
  tweai-mcp-server, docs, dev-инфраструктуру; собирает
  tweai-v<version>.zip системным zip'ом (есть на macOS/Linux/CI без
  лишних JS-deps).
- .github/workflows/checks.yml: на PR/main гонит lint + format + build,
  заливает zip как artifact на 14 дней.
- .github/workflows/release.yml: на push тега v* собирает zip, создаёт
  GitHub release с auto-generated notes и прикладывает артефакт.
- .gitignore: добавлены dist/, *.zip, .eslintcache.

Smoke: `node tools/build.mjs` собирает 14-файловый dist/ + 77.9 KB zip
(без mcp-server и docs). `node --check` зелёный на конфигах.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@froggychips froggychips merged commit f91cabe into main May 19, 2026
0 of 3 checks passed
@froggychips froggychips deleted the review/phase-6-tooling branch May 19, 2026 08:21

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 52eace3036

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread eslint.config.js
Comment on lines +17 to +20
files: ['**/*.js', '**/*.mjs'],
languageOptions: {
ecmaVersion: 2022,
sourceType: 'script',

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Exclude ESLint config from script-mode linting

When npm run lint runs eslint ., this glob also matches eslint.config.js, but the matched config forces every .js file to be parsed as sourceType: 'script'. Because this file itself contains export default, the lint job fails immediately with Parsing error: 'import' and 'export' may appear only with 'sourceType: module'; exclude eslint.config.js or add a module override for it.

Useful? React with 👍 / 👎.

Comment on lines +17 to +19
- run: npm ci || npm install
- run: npm run lint
- run: npm run format

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Format files before enforcing Prettier

I checked the new workflow by running prettier --check ., and the current tree reports 15 unformatted files including .github/dependabot.yml, .github/workflows/codeql.yml, background.js, content_script.js, and options.js. Since this PR gates every PR/main push on npm run format, the Checks workflow is red until those existing files are formatted or deliberately ignored.

Useful? React with 👍 / 👎.

Comment thread eslint.config.js
Comment on lines +58 to +60
Event: 'readonly',
CustomEvent: 'readonly',
HTMLElement: 'readonly',

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Add the browser globals used by current scripts

After the config-file parsing issue is fixed, this browser globals list still makes no-undef fail on existing runtime code: options.js uses alert and profile-scraper.js uses HTMLImageElement, but neither global is declared while no-undef is an error. Add the missing globals, or import the standard browser globals set, so the newly required lint job can pass for the current extension code.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant