Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[2/n] no-context lint: migrate some crates #5640

Merged
merged 10 commits into from
Aug 3, 2023

Commits on Jul 28, 2023

  1. Add project-specific lints with ast-grep

    ast-grep[0] is a tool that uses tree-sitter[1] and a pattern language to match against code using its ast. It implements code transformation, querying, and linting.
    
    Since clippy isn't extensible for project-specific lints, this adds a first ast-grep lint disallowing `context` as a variable name. Currently it's set to warning as usage is addressed.
    
    To run, install ast-grep, then run `ast-grep scan`. Example output:
    
    ```
    warning[no-context]: Don't name variables `context`.
        ┌─ ./crates/turbopack-ecmascript-hmr-protocol/src/lib.rs:132:9
        │
    132 │     pub context: &'a str,
        │     ----^^^^^^^---------
        │
        = Use a more specific name, such as chunking_context, asset_context, etc.
    ```
    
    [0] https://ast-grep.github.io
    [1] https://tree-sitter.github.io/tree-sitter/
    wbinnssmith committed Jul 28, 2023
    Configuration menu
    Copy the full SHA
    dd35e08 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    daa61bb View commit details
    Browse the repository at this point in the history

Commits on Jul 29, 2023

  1. [2/n] no-context lint: migrate some crates

    This migrates some crates away from using `context`, specifically:
    
    - `node-file-trace`
    - `turbo-tasks-build`
    - `turbo-tasks-fetch`
    - `turbo-tasks`
    - `turbopack-build`
    - `turbopack-cli-utils`
    - `turbopack-cli`
    - `turbopack-core`
    - `turbopack-ecmascript`
    
    This also moves the lint to `error` and ignores other failing crates.
    wbinnssmith committed Jul 29, 2023
    Configuration menu
    Copy the full SHA
    a2269d0 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    52a0281 View commit details
    Browse the repository at this point in the history

Commits on Aug 1, 2023

  1. Configuration menu
    Copy the full SHA
    e8bb13c View commit details
    Browse the repository at this point in the history

Commits on Aug 2, 2023

  1. Configuration menu
    Copy the full SHA
    9b158e6 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    b36f2b5 View commit details
    Browse the repository at this point in the history

Commits on Aug 3, 2023

  1. Configuration menu
    Copy the full SHA
    fe74ebd View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    8ffc943 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    17b9c0a View commit details
    Browse the repository at this point in the history