Repository navigation
v2.0.0
Мажорная версия: сменился линтер по умолчанию. chef lint теперь проверяет код через oxlint и не читает eslint.config.*, поэтому результаты могут отличаться от прежних, в том числе в CI. Чтобы остаться на ESLint, запускайте chef lint --linter eslint или задайте CHEF_LINTER=eslint.
chef берёт конфиг oxlint из проекта (oxlint.config.ts или .oxlintrc.json), а если его нет — пресеты Bitrix24 @bitrix24/oxlint-config-bitrix24 и @bitrix24/oxlint-config-bitrix24-mobile. Файлы из ignorePatterns конфига проекта не проверяются. Flow oxlint не читает, поэтому chef проверяет Flow-файлы через копию, в которой сохранены все позиции оригинала: у maybe-типов убирается ?, и файл читается как TypeScript, а если TypeScript его не разбирает, типы заменяются пробелами. Находки, вызванные самим преобразованием, не выводятся, а исправления --fix переносятся в оригинал. Файл, который не удалось разобрать, выводится с ошибкой разбора, а не пропускается молча. Расширения передаются в oxlint группами по мере того, как находятся, так что один процесс oxlint проверяет сотни файлов.
Для редакторов появился языковой сервер: chef lint --lsp или бинарник chef-oxlint --lsp. Flow-файлы он понимает так же, как chef lint, каждое расширение открывает как отдельную рабочую область, а путь к конфигу, заданный в редакторе, важнее пресетов. Как подключить его в PhpStorm, описано в документации.
Исправлены крайние случаи banner. Текст с незакрытым /* больше не закомментирует бандл, одиночный \r и разделители строк U+2028/U+2029 считаются переводами строк, в минифицированном бандле баннер ставится в самое начало, а плагины из plugins видят бандл уже с баннером. С --reporter json результат больше не обрезается на 64 КиБ при выводе в пайп (например, в jq) на macOS. Обновлён source-map-js с исправлением уязвимости.
Major version: the default linter has changed. chef lint now lints with oxlint and does not read eslint.config.*, so results may differ from before, including in CI. To keep ESLint, run chef lint --linter eslint or set CHEF_LINTER=eslint.
chef uses the project's oxlint config (oxlint.config.ts or .oxlintrc.json) and falls back to the Bitrix24 presets @bitrix24/oxlint-config-bitrix24 and @bitrix24/oxlint-config-bitrix24-mobile. Files matched by ignorePatterns in the project config are skipped. oxlint cannot read Flow, so chef lints Flow files through a copy that keeps every position of the original: the ? of maybe types is removed and the file is read as TypeScript, and if TypeScript cannot parse it, the types are replaced with spaces. Findings caused by the transformation are not reported, and --fix edits are applied to the original. A file that cannot be parsed is reported with its parse error instead of being skipped silently. Extensions are passed to oxlint in batches as they are found, so a single oxlint process lints hundreds of files.
There is now a language server for editors: chef lint --lsp or the chef-oxlint --lsp binary. It handles Flow files the same way chef lint does, opens each extension as a separate workspace, and a config path set in the editor takes precedence over the presets. The docs explain how to set it up in PhpStorm.
Fixed banner edge cases. Text with an unclosed /* no longer comments out the bundle, a lone \r and the U+2028/U+2029 separators count as line breaks, the banner goes to the very top of a minified bundle, and plugins from plugins see the bundle with the banner already added. With --reporter json, the result is no longer cut off at 64 KiB when piped (e.g. to jq) on macOS. Updated source-map-js to fix a vulnerability.