Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
root = true

[*]
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
end_of_line = lf
Comment thread
RickWinter marked this conversation as resolved.

[*.{js,ts}]
indent_size = 2

[*.json]
indent_size = 2

[*.{yaml,yml}]
indent_size = 2

[*.md]
indent_size = 2

[*.tsp]
indent_size = 2

[*.toml]
indent_size = 2

[*.sh]
indent_size = 2
11 changes: 11 additions & 0 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,20 @@ This document serves as an index to task-specific instructions for GitHub Copilo
- Use `pnpm format` under each subfolder of `packages` folder to format all files.

## Coding Standards

- Validate all changes are linter clean by running `pnpm eslint`.
- Make sure that cspell is installed and configured in your editor for spell checking.
- Ensure that "cspell -c ./.vscode/cspell.json ./packages" succeeds before committing changes.

## Source Generation and Testing

- Use `pnpm run tspcompile` to regenerate Rust code from TypeSpec files.
- Generated sources are located in `test/*/src/generated/` directories.
- Use `pnpm run test` to run TypeScript tests.
- Use `pnpm run test-ci` for CI-style testing with coverage and JUnit output.
- Use `pnpm run spector --serve` to run the spector server for TypeSpec testing.
- Use `cargo test` in generated Rust project directories to run Rust tests.

## Files and Directories

- Content in files must end with a newline character.
19 changes: 19 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Build artifacts
dist/
node_modules/
*.log

# Generated code
packages/typespec-rust/test/spector/*/src/generated/

# Lock files
pnpm-lock.yaml
package-lock.json
yarn.lock

# TypeSpec files (no parser available for prettier)
*.tsp

# Temporary files
*.tmp
*.temp
104 changes: 52 additions & 52 deletions .vscode/cspell.json
Original file line number Diff line number Diff line change
@@ -1,53 +1,53 @@
{
"version": "0.2",
"language": "en",
"useGitignore": true,
"ignorePaths": [
"**/test-resources.bicep",
"**/test-resources.json",
"**/test-resources-post.ps1",
"**/assets.json",
".config",
"packages/*/test/spector/**/*.rs",
"packages/*/test/sdk/**/*.rs",
"packages/*/test/spector/**/*.toml",
"packages/*/test/**/*.tsp",
"packages/*/pnpm-lock.yaml",
"**/package.json",
".devcontainer/devcontainer.json",
".devcontainer/Dockerfile",
".devcontainer/oncreate",
".github/CODEOWNERS",
".github/dependabot.yml",
".vscode/cspell.json",
".vscode/extensions.json",
".vscode/settings.json",
".vscode/tasks.json",
"NOTICE.txt",
"SUPPORT.md",
"deny.toml",
"eng/",
"**/.dict.txt",
"rust-toolchain.toml"
],
"words": [
"appconfiguration",
"clientaccessor",
"clippy",
"codegen",
"codemodel",
"entra",
"enumvalue",
"impls",
"linq",
"msrc",
"pageable",
"reqwest",
"safeint",
"serde",
"spector",
"tcgc",
"tspcompile",
"typespec",
]
}
"version": "0.2",
"language": "en",
"useGitignore": true,
"ignorePaths": [
"**/test-resources.bicep",
"**/test-resources.json",
"**/test-resources-post.ps1",
"**/assets.json",
".config",
"packages/*/test/spector/**/*.rs",
"packages/*/test/sdk/**/*.rs",
"packages/*/test/spector/**/*.toml",
"packages/*/test/**/*.tsp",
"packages/*/pnpm-lock.yaml",
"**/package.json",
".devcontainer/devcontainer.json",
".devcontainer/Dockerfile",
".devcontainer/oncreate",
".github/CODEOWNERS",
".github/dependabot.yml",
".vscode/cspell.json",
".vscode/extensions.json",
".vscode/settings.json",
".vscode/tasks.json",
"NOTICE.txt",
"SUPPORT.md",
"deny.toml",
"eng/",
"**/.dict.txt",
"rust-toolchain.toml"
],
"words": [
"appconfiguration",
"clientaccessor",
"clippy",
"codegen",
"codemodel",
"entra",
"enumvalue",
"impls",
"linq",
"msrc",
"pageable",
"reqwest",
"safeint",
"serde",
"spector",
"tcgc",
"tspcompile",
"typespec"
]
}
23 changes: 10 additions & 13 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
{
"cSpell.enabled": true,
"editor.formatOnSave": true,
"markdownlint.config": {
"MD024": false,
},
"markdownlint.ignore": [
"**/SECURITY.md",
"LICENSE"
],
"yaml.format.printWidth": 240,
"[powershell]": {
"editor.defaultFormatter": "ms-vscode.powershell",
},
"cSpell.enabled": true,
"editor.formatOnSave": true,
"markdownlint.config": {
"MD024": false
},
"markdownlint.ignore": ["**/SECURITY.md", "LICENSE"],
"yaml.format.printWidth": 240,
"[powershell]": {
"editor.defaultFormatter": "ms-vscode.powershell"
}
}
16 changes: 8 additions & 8 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@

<!-- cspell: ignore nocapture RUSTFLAGS Dwarnings -->

# Contributing Guide

This guide explains how to contribute to the TypeSpec Rust emitter project, including how to build, test, and develop the codebase.

## Prerequisites

- **Node.js** (>=20.0.0) - Required for the TypeScript emitter
- **pnpm** (10.10.0) - Package manager for Node.js dependencies
- **pnpm** (10.10.0) - Package manager for Node.js dependencies
- **Rust** (1.80+) - Required for building and testing generated Rust code
- **Git** - Version control

Expand Down Expand Up @@ -154,7 +154,7 @@ cargo test --no-fail-fast
Stop the spector server when done:

```bash
cd packages/typespec-rust
cd packages/typespec-rust
pnpm spector --stop
```

Expand Down Expand Up @@ -198,7 +198,7 @@ cd packages/typespec-rust
pnpm eslint
```

#### Linting Rust Code
#### Linting Rust Code

```bash
cd packages/typespec-rust/test
Expand Down Expand Up @@ -254,8 +254,8 @@ cargo fmt --all
# TypeScript tests
cd packages/typespec-rust
pnpm test
# Rust integration tests

# Rust integration tests
pnpm spector --start
cd test/spector
cargo test
Expand All @@ -269,7 +269,7 @@ cargo fmt --all
# TypeScript linting
cd packages/typespec-rust
pnpm eslint

# Rust linting
cd test
cargo clippy --workspace --all-features --all-targets
Expand Down Expand Up @@ -315,7 +315,7 @@ Update the version in `packages/typespec-rust/package.json` and document changes
The CI pipeline runs the following checks on every pull request:

1. **Build** - Compiles TypeScript emitter
2. **Lint** - Runs ESLint on TypeScript code
2. **Lint** - Runs ESLint on TypeScript code
3. **Test** - Runs TypeScript unit tests with coverage
4. **Regenerate** - Regenerates all test crates and verifies no changes
5. **Compile** - Builds all generated Rust crates
Expand Down
62 changes: 61 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,68 @@
# TypeSpec Rust Emitter

## Development

### Prerequisites

- Node.js 20 or later
- pnpm 10.x
- Rust toolchain (managed via `rust-toolchain.toml`)

### Setup

```bash
cd packages/typespec-rust
pnpm install
```

### Code Formatting

This project enforces code formatting for all source files. The CI pipeline will check that all code follows the defined formatting rules.

#### Supported File Types

- **TypeScript/JavaScript**: Formatted using ESLint with automatic fixes
- **Markdown/JSON**: Formatted using Prettier
- **Rust**: Formatted using rustfmt
- **TypeSpec**: Currently validated for syntax (formatting tools not yet available)

#### Local Development Scripts

From the repository root:

```bash
# Check formatting for all file types
./scripts/check-all-formats.sh

# Format all files automatically
./scripts/format-all.sh

# Check individual file types
./scripts/check-rust-format.sh
./scripts/check-typespec-format.sh
```

From the `packages/typespec-rust` directory:

```bash
# Format TypeScript and run ESLint
pnpm run format

# Check formatting without making changes
pnpm run format:check

# Format specific file types
pnpm run format:prettier # Markdown, JSON, TypeScript
pnpm run format:eslint # TypeScript/JavaScript with ESLint
```

#### CI Pipeline

The GitHub Actions workflow automatically checks formatting on all pull requests and pushes to main/master branches. All checks must pass before code can be merged.

## Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a
This project welcomes contributions and suggestions. Most contributions require you to agree to a
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
the rights to use your contribution. For details, visit <https://cla.opensource.microsoft.com>.

Expand Down
18 changes: 9 additions & 9 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@ If you believe you have found a security vulnerability in any Microsoft-owned re

Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://aka.ms/security.md/msrc/create-report).

If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://aka.ms/security.md/msrc/pgp).
If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://aka.ms/security.md/msrc/pgp).

You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://www.microsoft.com/msrc).
You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://www.microsoft.com/msrc).

Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue:

* Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.)
* Full paths of source file(s) related to the manifestation of the issue
* The location of the affected source code (tag/branch/commit or direct URL)
* Any special configuration required to reproduce the issue
* Step-by-step instructions to reproduce the issue
* Proof-of-concept or exploit code (if possible)
* Impact of the issue, including how an attacker might exploit the issue
- Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.)
- Full paths of source file(s) related to the manifestation of the issue
- The location of the affected source code (tag/branch/commit or direct URL)
- Any special configuration required to reproduce the issue
- Step-by-step instructions to reproduce the issue
- Proof-of-concept or exploit code (if possible)
- Impact of the issue, including how an attacker might exploit the issue

This information will help us triage your report more quickly.

Expand Down
12 changes: 6 additions & 6 deletions SUPPORT.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@
- **Yes CSS support:** Fill out an intake form at [aka.ms/onboardsupport](https://aka.ms/onboardsupport). CSS will work with/help you to determine next steps.
- **Not sure?** Fill out an intake as though the answer were "Yes". CSS will help you decide.

*Then remove this first heading from this SUPPORT.MD file before publishing your repo.*
_Then remove this first heading from this SUPPORT.MD file before publishing your repo._

# Support

## How to file issues and get help
## How to file issues and get help

This project uses GitHub Issues to track bugs and feature requests. Please search the existing
issues before filing new issues to avoid duplicates. For new issues, file your bug or
This project uses GitHub Issues to track bugs and feature requests. Please search the existing
issues before filing new issues to avoid duplicates. For new issues, file your bug or
feature request as a new Issue.

For help and questions about using this project, please **REPO MAINTAINER: INSERT INSTRUCTIONS HERE
For help and questions about using this project, please **REPO MAINTAINER: INSERT INSTRUCTIONS HERE
FOR HOW TO ENGAGE REPO OWNERS OR COMMUNITY FOR HELP. COULD BE A STACK OVERFLOW TAG OR OTHER
CHANNEL. WHERE WILL YOU HELP PEOPLE?**.

## Microsoft Support Policy
## Microsoft Support Policy

Support for this **PROJECT or PRODUCT** is limited to the resources listed above.
Loading