Skip to content

Commit

Permalink
Merge branch 'main' into feat/vitest-no-alias-methods
Browse files Browse the repository at this point in the history
  • Loading branch information
eryue0220 authored Jul 17, 2024
2 parents 030c1b5 + 697c0ef commit e953c3c
Show file tree
Hide file tree
Showing 639 changed files with 17,293 additions and 1,028 deletions.
10 changes: 0 additions & 10 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,16 +119,6 @@ jobs:
build-linter:
name: Build Linter Benchmark
runs-on: ubuntu-latest
env:
# https://github.com/mozilla/sccache/blob/main/docs/S3.md
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
SCCACHE_BUCKET: ${{ secrets.SCCACHE_BUCKET }}
SCCACHE_ENDPOINT: ${{ secrets.SCCACHE_ENDPOINT }}
SCCACHE_REGION: auto
RUSTC_WRAPPER: ${{ vars.USE_SCCACHE == 'true' && 'sccache' || '' }}
CARGO_INCREMENTAL: 0
SCCACHE_LOCAL_RW_MODE:
steps:
- name: Checkout Branch
uses: taiki-e/checkout-action@v1
Expand Down
57 changes: 0 additions & 57 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,7 @@ env:
RUSTFLAGS: "-D warnings"

jobs:
optimize_ci:
name: Graphite Optimize CI
runs-on: ubuntu-latest
outputs:
skip: ${{ steps.check_skip.outputs.skip }}
steps:
- uses: withgraphite/graphite-ci-action@main
id: check_skip
with:
graphite_token: ${{ secrets.GRAPHITE_TOKEN }}
github_token: ${{ secrets.GITHUB_TOKEN }}

test:
needs: optimize_ci
if: needs.optimize_ci.outputs.skip == 'false'
name: Test
strategy:
fail-fast: false
Expand All @@ -52,16 +38,6 @@ jobs:
- os: ubuntu-latest
- os: macos-14
runs-on: ${{ matrix.os }}
env:
# https://github.com/mozilla/sccache/blob/main/docs/S3.md
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
SCCACHE_BUCKET: ${{ secrets.SCCACHE_BUCKET }}
SCCACHE_ENDPOINT: ${{ secrets.SCCACHE_ENDPOINT }}
SCCACHE_REGION: auto
RUSTC_WRAPPER: ${{ vars.USE_SCCACHE == 'true' && 'sccache' || '' }}
CARGO_INCREMENTAL: 0
SCCACHE_LOCAL_RW_MODE:
steps:
- uses: taiki-e/checkout-action@v1
- uses: Boshen/setup-rust@main
Expand All @@ -70,17 +46,12 @@ jobs:
# cache `target` directory to avoid download crates
save-cache: ${{ github.ref_name == 'main' }}
cache-key: warm
# cache build outputs to speed up compilation
- uses: mozilla-actions/sccache-action@v0.0.5
if: ${{ vars.USE_SCCACHE == 'true' }}
- run: cargo ck
- run: cargo test --no-run
- run: cargo test
- run: git diff --exit-code # Must commit everything

test-windows:
needs: optimize_ci
if: needs.optimize_ci.outputs.skip == 'false'
name: Test (windows-latest)
runs-on: windows-latest
steps:
Expand Down Expand Up @@ -126,8 +97,6 @@ jobs:
cargo ck
wasm:
needs: optimize_ci
if: needs.optimize_ci.outputs.skip == 'false'
name: Check Wasm
runs-on: ubuntu-latest
steps:
Expand All @@ -152,8 +121,6 @@ jobs:
run: npx -y -p typescript tsc --lib es2020,dom crates/oxc_wasm/pkg/oxc_wasm.d.ts

typos:
needs: optimize_ci
if: needs.optimize_ci.outputs.skip == 'false'
name: Spell Check
runs-on: ubuntu-latest
steps:
Expand All @@ -163,8 +130,6 @@ jobs:
files: .

deny:
needs: optimize_ci
if: needs.optimize_ci.outputs.skip == 'false'
name: Cargo Deny
runs-on: ubuntu-latest
steps:
Expand All @@ -187,8 +152,6 @@ jobs:
run: cargo deny check

unused-deps:
needs: optimize_ci
if: needs.optimize_ci.outputs.skip == 'false'
name: Check Unused Dependencies
runs-on: ubuntu-latest
steps:
Expand All @@ -213,8 +176,6 @@ jobs:
if: steps.filter.outputs.src == 'true'

format:
needs: optimize_ci
if: needs.optimize_ci.outputs.skip == 'false'
name: Format
runs-on: ubuntu-latest
steps:
Expand All @@ -226,8 +187,6 @@ jobs:
- run: cargo fmt --all -- --check

lint:
needs: optimize_ci
if: needs.optimize_ci.outputs.skip == 'false'
name: Clippy
runs-on: ubuntu-latest
steps:
Expand All @@ -239,8 +198,6 @@ jobs:
- run: cargo lint -- -D warnings

doc:
needs: optimize_ci
if: needs.optimize_ci.outputs.skip == 'false'
name: Doc
runs-on: ubuntu-latest
steps:
Expand All @@ -252,19 +209,8 @@ jobs:
- run: RUSTDOCFLAGS='-D warnings' cargo doc --no-deps --document-private-items

conformance:
needs: optimize_ci
if: needs.optimize_ci.outputs.skip == 'false'
name: Conformance
runs-on: ubuntu-latest
env:
# https://github.com/mozilla/sccache/blob/main/docs/S3.md
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
SCCACHE_BUCKET: ${{ secrets.SCCACHE_BUCKET }}
SCCACHE_ENDPOINT: ${{ secrets.SCCACHE_ENDPOINT }}
SCCACHE_REGION: auto
RUSTC_WRAPPER: ${{ vars.USE_SCCACHE == 'true' && 'sccache' || '' }}
CARGO_INCREMENTAL: 0
steps:
- uses: taiki-e/checkout-action@v1

Expand All @@ -282,8 +228,6 @@ jobs:
save-cache: ${{ github.ref_name == 'main' }}
tools: just

- uses: mozilla-actions/sccache-action@v0.0.5

- name: Clone submodules
if: steps.filter.outputs.src == 'true'
uses: ./.github/actions/clone-submodules
Expand All @@ -305,7 +249,6 @@ jobs:
just coverage
git diff --exit-code
# NOTE: not putting this behind `optimize_ci` is intentional.
ast_changes:
name: AST Changes
runs-on: ubuntu-latest
Expand Down
9 changes: 7 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions apps/oxlint/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ All notable changes to this package will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project does not adhere to [Semantic Versioning](https://semver.org/spec/v2.0.0.html) until v1.0.0.

## [0.6.1] - 2024-07-17

### Features

- 1f8968a linter: Add eslint-plugin-promise rules: avoid-new, no-new-statics, params-names (#4293) (Jelle van der Waa)

## [0.5.1] - 2024-06-29

### Bug Fixes
Expand Down
2 changes: 1 addition & 1 deletion apps/oxlint/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "oxlint"
version = "0.6.0"
version = "0.6.1"
publish = false
authors.workspace = true
description.workspace = true
Expand Down
4 changes: 4 additions & 0 deletions apps/oxlint/src/command/lint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,10 @@ pub struct EnablePlugins {
/// Enable the React performance plugin and detect rendering performance problems
#[bpaf(switch, hide_usage)]
pub react_perf_plugin: bool,

/// Enable the promise plugin and detect promise usage problems
#[bpaf(switch, hide_usage)]
pub promise_plugin: bool,
}

#[cfg(test)]
Expand Down
3 changes: 2 additions & 1 deletion apps/oxlint/src/lint/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ impl Runner for LintRunner {
.with_vitest_plugin(enable_plugins.vitest_plugin)
.with_jsx_a11y_plugin(enable_plugins.jsx_a11y_plugin)
.with_nextjs_plugin(enable_plugins.nextjs_plugin)
.with_react_perf_plugin(enable_plugins.react_perf_plugin);
.with_react_perf_plugin(enable_plugins.react_perf_plugin)
.with_promise_plugin(enable_plugins.promise_plugin);

let linter = match Linter::from_options(lint_options) {
Ok(lint_service) => lint_service,
Expand Down
30 changes: 21 additions & 9 deletions crates/oxc_ast/src/ast/ts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,8 @@ pub use match_ts_type;
///
/// <https://www.typescriptlang.org/docs/handbook/2/conditional-types.html#handbook-content>
#[visited_node]
#[derive(Debug, Hash)]
#[scope]
#[derive(Debug)]
#[cfg_attr(feature = "serialize", derive(Serialize, Tsify))]
#[cfg_attr(feature = "serialize", serde(tag = "type", rename_all = "camelCase"))]
pub struct TSConditionalType<'a> {
Expand All @@ -240,6 +241,7 @@ pub struct TSConditionalType<'a> {
pub extends_type: TSType<'a>,
pub true_type: TSType<'a>,
pub false_type: TSType<'a>,
pub scope_id: Cell<Option<ScopeId>>,
}

/// string | string[] | (() => string) | { s: string }
Expand Down Expand Up @@ -579,8 +581,7 @@ pub struct TSTypeParameterInstantiation<'a> {
}

#[visited_node]
#[scope]
#[derive(Debug)]
#[derive(Debug, Hash)]
#[cfg_attr(feature = "serialize", derive(Serialize, Tsify))]
#[cfg_attr(feature = "serialize", serde(tag = "type", rename_all = "camelCase"))]
pub struct TSTypeParameter<'a> {
Expand All @@ -592,7 +593,6 @@ pub struct TSTypeParameter<'a> {
pub r#in: bool,
pub out: bool,
pub r#const: bool,
pub scope_id: Cell<Option<ScopeId>>,
}

#[visited_node]
Expand All @@ -606,16 +606,19 @@ pub struct TSTypeParameterDeclaration<'a> {
}

#[visited_node]
#[derive(Debug, Hash)]
#[scope]
#[derive(Debug)]
#[cfg_attr(feature = "serialize", derive(Serialize, Tsify))]
#[cfg_attr(feature = "serialize", serde(tag = "type", rename_all = "camelCase"))]
pub struct TSTypeAliasDeclaration<'a> {
#[cfg_attr(feature = "serialize", serde(flatten))]
pub span: Span,
pub id: BindingIdentifier<'a>,
#[scope(enter_before)]
pub type_parameters: Option<Box<'a, TSTypeParameterDeclaration<'a>>>,
pub type_annotation: TSType<'a>,
pub declare: bool,
pub scope_id: Cell<Option<ScopeId>>,
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
Expand All @@ -642,17 +645,20 @@ pub struct TSClassImplements<'a> {
///
/// interface `BindingIdentifier` `TypeParameters_opt` `InterfaceExtendsClause_opt` `ObjectType`
#[visited_node]
#[derive(Debug, Hash)]
#[scope]
#[derive(Debug)]
#[cfg_attr(feature = "serialize", derive(Serialize, Tsify))]
#[cfg_attr(feature = "serialize", serde(tag = "type", rename_all = "camelCase"))]
pub struct TSInterfaceDeclaration<'a> {
#[cfg_attr(feature = "serialize", serde(flatten))]
pub span: Span,
pub id: BindingIdentifier<'a>,
#[scope(enter_before)]
pub extends: Option<Vec<'a, TSInterfaceHeritage<'a>>>,
pub type_parameters: Option<Box<'a, TSTypeParameterDeclaration<'a>>>,
pub body: Box<'a, TSInterfaceBody<'a>>,
pub declare: bool,
pub scope_id: Cell<Option<ScopeId>>,
}

#[visited_node]
Expand Down Expand Up @@ -726,7 +732,8 @@ pub enum TSMethodSignatureKind {
}

#[visited_node]
#[derive(Debug, Hash)]
#[scope]
#[derive(Debug)]
#[cfg_attr(feature = "serialize", derive(Serialize, Tsify))]
#[cfg_attr(feature = "serialize", serde(tag = "type", rename_all = "camelCase"))]
pub struct TSMethodSignature<'a> {
Expand All @@ -740,10 +747,12 @@ pub struct TSMethodSignature<'a> {
pub params: Box<'a, FormalParameters<'a>>,
pub return_type: Option<Box<'a, TSTypeAnnotation<'a>>>,
pub type_parameters: Option<Box<'a, TSTypeParameterDeclaration<'a>>>,
pub scope_id: Cell<Option<ScopeId>>,
}

#[visited_node]
#[derive(Debug, Hash)]
#[scope]
#[derive(Debug)]
#[cfg_attr(feature = "serialize", derive(Serialize, Tsify))]
#[cfg_attr(feature = "serialize", serde(tag = "type", rename_all = "camelCase"))]
pub struct TSConstructSignatureDeclaration<'a> {
Expand All @@ -752,6 +761,7 @@ pub struct TSConstructSignatureDeclaration<'a> {
pub params: Box<'a, FormalParameters<'a>>,
pub return_type: Option<Box<'a, TSTypeAnnotation<'a>>>,
pub type_parameters: Option<Box<'a, TSTypeParameterDeclaration<'a>>>,
pub scope_id: Cell<Option<ScopeId>>,
}

#[visited_node]
Expand Down Expand Up @@ -994,7 +1004,8 @@ pub struct TSConstructorType<'a> {
}

#[visited_node]
#[derive(Debug, Hash)]
#[scope]
#[derive(Debug)]
#[cfg_attr(feature = "serialize", derive(Serialize, Tsify))]
#[cfg_attr(feature = "serialize", serde(tag = "type", rename_all = "camelCase"))]
pub struct TSMappedType<'a> {
Expand All @@ -1005,6 +1016,7 @@ pub struct TSMappedType<'a> {
pub type_annotation: Option<TSType<'a>>,
pub optional: TSMappedTypeModifierOperator,
pub readonly: TSMappedTypeModifierOperator,
pub scope_id: Cell<Option<ScopeId>>,
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
Expand Down
Loading

0 comments on commit e953c3c

Please sign in to comment.