Skip to content

Conversation

@j178
Copy link
Owner

@j178 j178 commented Oct 25, 2025

For #619

Not finished yet. Currently below example works:

.pre-commit-config.yaml:

repos:
  - repo: local
    hooks:
      - id: eslint
        language: deno
        types: [file]
        entry: 'deno run -A npm:eslint --fix --config eslint.config.js'
        files: \.(js|ts|svelte)$
        additional_dependencies:
          - npm:[email protected]
          - npm:eslint-plugin-svelte
          - npm:svelte
          - npm:typescript
          - npm:typescript-eslint
          - 'npm:@stylistic/eslint-plugin'

eslint.config.js:

import stylistic from 'npm:@stylistic/eslint-plugin'
import svelte from 'npm:eslint-plugin-svelte'
import tslint from 'npm:typescript-eslint'

/** @type { import("eslint").Linter.Config[] } */
export default [
  ...tslint.configs.recommended,
  ...svelte.configs[`flat/recommended`],
  { plugins: { '@stylistic': stylistic } },
  {
    rules: {
      '@typescript-eslint/no-unused-vars': [
        `error`,
        { argsIgnorePattern: `^_`, varsIgnorePattern: `^_` },
      ],
      '@stylistic/quotes': [`error`, `backtick`, { avoidEscape: true }],
      'svelte/no-at-html-tags': `off`,
      'svelte/no-navigation-without-resolve': `off`,
    },
  },
  {
    languageOptions: { ecmaVersion: 2020 },
  },
  {
    files: [`**/*.svelte*`],
    languageOptions: {
      parserOptions: {
        parser: tslint.parser,
      },
    },
  },
  {
    ignores: [`build/`],
  },
]

@codecov
Copy link

codecov bot commented Oct 25, 2025

Codecov Report

❌ Patch coverage is 6.95652% with 107 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.58%. Comparing base (c2f0468) to head (987923c).
⚠️ Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
src/languages/deno/deno.rs 0.00% 102 Missing ⚠️
src/languages/mod.rs 0.00% 3 Missing ⚠️
src/config.rs 0.00% 1 Missing ⚠️
src/store.rs 0.00% 1 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (c2f0468) and HEAD (987923c). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (c2f0468) HEAD (987923c)
3 2
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #965      +/-   ##
==========================================
- Coverage   90.15%   83.58%   -6.57%     
==========================================
  Files          66       67       +1     
  Lines       12244    12352     +108     
==========================================
- Hits        11039    10325     -714     
- Misses       1205     2027     +822     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions
Copy link

📦 Cargo Bloat Comparison

Binary size change: +0.00% (16.1 MiB → 16.1 MiB)

Expand for cargo-bloat output

PR Branch Results

 File  .text     Size          Crate Name
 0.6%   1.3% 101.1KiB          prek? <prek::cli::Command as clap_builder::derive::Subcommand>::augment_subcommands
 0.6%   1.3%  96.2KiB           prek prek::languages::<impl prek::config::Language>::run::{{closure}}
 0.5%   1.1%  85.8KiB           prek prek::builtin::pre_commit_hooks::Implemented::run::{{closure}}
 0.4%   0.9%  70.0KiB           prek prek::run::{{closure}}
 0.4%   0.9%  63.8KiB           prek prek::archive::unpack::{{closure}}
 0.3%   0.6%  45.5KiB           prek prek::languages::<impl prek::config::Language>::install::{{closure}}
 0.2%   0.5%  40.9KiB regex_automata regex_automata::meta::strategy::new
 0.2%   0.5%  40.1KiB          prek? <prek::cli::RunArgs as clap_builder::derive::Args>::augment_args
 0.2%   0.5%  38.5KiB           prek prek::identify::by_extension::{{closure}}
 0.2%   0.4%  32.9KiB           prek prek::workspace::Workspace::discover
 0.2%   0.4%  32.8KiB           prek prek::cli::run::run::run::{{closure}}
 0.2%   0.4%  32.7KiB           prek prek::languages::node::installer::NodeInstaller::install::{{closure}}
 0.2%   0.4%  31.8KiB             h2 h2::proto::connection::DynConnection<B>::recv_frame
 0.2%   0.4%  31.7KiB             h2 h2::proto::connection::Connection<T,P,B>::poll
 0.2%   0.3%  26.2KiB     hyper_util hyper_util::client::legacy::client::Client<C,B>::send_request::{{closure}}
 0.2%   0.3%  25.8KiB     hyper_util hyper_util::client::legacy::client::Client<C,B>::connect_to::{{closure}}::{{closure}}::{{closure}}
 0.2%   0.3%  25.0KiB        globset globset::GlobSetBuilder::build
 0.2%   0.3%  25.0KiB           prek prek::main
 0.1%   0.3%  24.6KiB           prek prek::languages::golang::installer::GoInstaller::install::{{closure}}
 0.1%   0.3%  23.7KiB          hyper hyper::proto::h1::dispatch::Dispatcher<D,Bs,I,T>::poll_loop
39.6%  87.1%   6.4MiB                And 10145 smaller methods. Use -n N to show more.
45.4% 100.0%   7.3MiB                .text section size, the file size is 16.1MiB

Base Branch Results

 File  .text     Size          Crate Name
 0.6%   1.4% 101.1KiB          prek? <prek::cli::Command as clap_builder::derive::Subcommand>::augment_subcommands
 0.5%   1.2%  88.0KiB           prek prek::languages::<impl prek::config::Language>::run::{{closure}}
 0.5%   1.1%  85.8KiB           prek prek::builtin::pre_commit_hooks::Implemented::run::{{closure}}
 0.4%   0.9%  70.0KiB           prek prek::run::{{closure}}
 0.4%   0.9%  63.8KiB           prek prek::archive::unpack::{{closure}}
 0.3%   0.6%  42.0KiB           prek prek::languages::<impl prek::config::Language>::install::{{closure}}
 0.2%   0.5%  40.9KiB regex_automata regex_automata::meta::strategy::new
 0.2%   0.5%  40.1KiB          prek? <prek::cli::RunArgs as clap_builder::derive::Args>::augment_args
 0.2%   0.5%  38.5KiB           prek prek::identify::by_extension::{{closure}}
 0.2%   0.4%  32.9KiB           prek prek::workspace::Workspace::discover
 0.2%   0.4%  32.8KiB           prek prek::cli::run::run::run::{{closure}}
 0.2%   0.4%  32.7KiB           prek prek::languages::node::installer::NodeInstaller::install::{{closure}}
 0.2%   0.4%  31.8KiB             h2 h2::proto::connection::DynConnection<B>::recv_frame
 0.2%   0.4%  31.7KiB             h2 h2::proto::connection::Connection<T,P,B>::poll
 0.2%   0.4%  26.2KiB     hyper_util hyper_util::client::legacy::client::Client<C,B>::send_request::{{closure}}
 0.2%   0.3%  25.8KiB     hyper_util hyper_util::client::legacy::client::Client<C,B>::connect_to::{{closure}}::{{closure}}::{{closure}}
 0.2%   0.3%  25.0KiB        globset globset::GlobSetBuilder::build
 0.2%   0.3%  25.0KiB           prek prek::main
 0.1%   0.3%  24.6KiB           prek prek::languages::golang::installer::GoInstaller::install::{{closure}}
 0.1%   0.3%  23.7KiB          hyper hyper::proto::h1::dispatch::Dispatcher<D,Bs,I,T>::poll_loop
39.6%  87.2%   6.4MiB                And 10127 smaller methods. Use -n N to show more.
45.4% 100.0%   7.3MiB                .text section size, the file size is 16.1MiB

* Do not check for `script` subprocess status (#964)

* Update README

* Allow using system trusted store by `PREK_NATIVE_TLS` (#959)

* Fix compatibility with older luarocks (#967)

* support isolated hook environments for `language: deno`

- Implement Deno language handler with dependency isolation
- Support npm packages via `additional_dependencies`
- Add 8 tests covering basic usage, dependencies, and error cases
- example config showing deno fmt, lint, and npm eslint hook usage

* support Deno auto installation

Implement full-fledged Deno language support with automatic version management,
mirroring the installation patterns used for Node.js and Go.

- **installer.rs**: New DenoInstaller that downloads and installs Deno versions
  - Downloads from GitHub releases (https://github.com/denoland/deno/releases)
  - Searches installed versions in $PREK_HOME/tools/deno
  - Falls back to system Deno if version matches
  - Supports all platforms: Linux, macOS, Windows (x86_64, aarch64)
  - Uses file locking to prevent concurrent installations
  - Implements proper binary extraction and permission setup

- **version.rs**: New DenoVersion and DenoRequest types
  - Supports version specifications: exact (1.40.0), major (1), major.minor (1.40)
  - Supports semver ranges: ">= 1.40, < 1.50"
  - Handles "deno", "deno@version", "latest", "system" formats
  - Supports local path specifications
  - Comprehensive unit tests for version parsing

- **deno.rs**: Updated to use DenoInstaller
  - Removed manual system-only detection
  - Integrated with DenoInstaller for automatic downloads
  - Simplified installation flow
  - Proper health checks with version validation

* Update language support status (#970)

* Update language support status

* Tweak

* Fix DenoRequest parsing

* Generate cli reference

* Fail windows CI when an error occured (#971)

* Fail windows CI when an error occured

* Fix tests

* Use global client

* delete outdated test, deno auto-installs after 2nd commit

addresses #968 (comment)

* refactor(deno): symlink deno executable into hook bin dir and use PATH resolution

- Create bin/ directory in hook environment with symlinked deno executable
- Prepend bin/ to PATH during install and run, matching Node implementation
- Use entry.resolve() to find commands in PATH instead of manual replacement
- Enables shell scripts to call `deno` directly with correct isolated version
- add test verifying deno is available in PATH for shell scripts

addresses #968 (comment)

* refactor(deno): simplify install logic and add dependency caching

- Simplify find_script_to_cache() using functional approach
- Fix is_cacheable_script() to only match JS/TS files (prevents caching shell scripts)
- Add support for .mjs, .tsx, .jsx extensions
- Extract deno_bin variable to reduce duplication
- Consolidate PATH setup to single location
- Simplify deno.json creation logic
- Add deno cache call during install for offline hook execution

---------

Co-authored-by: Jo <[email protected]>
Co-authored-by: Steven Taylor <[email protected]>
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.

3 participants