Skip to content
Open
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
18 changes: 0 additions & 18 deletions .eslintrc.json

This file was deleted.

7 changes: 0 additions & 7 deletions .github/ISSUE_TEMPLATE/bug_report copy.md

This file was deleted.

23 changes: 23 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
name: Feature request
about: Suggest an idea for this project
title: ""
labels: enhancement
assignees: ""
---

## Problem description

A clear and concise description of the problem or limitation you are facing.

## Proposed solution

A clear and concise description of what you would like to happen.

## Alternatives considered

A description of any alternative solutions or features you have considered.

## Additional context

Add any other context, screenshots, or examples about the feature request here.
23 changes: 23 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
version: 2
updates:
- package-ecosystem: npm
directory: /
schedule:
interval: monthly
cooldown:
default-days: 3
groups:
typescript-eslint:
patterns:
- "@typescript-eslint/*"
vscode:
patterns:
- "@vscode/*"
- "@types/vscode"

- package-ecosystem: github-actions
directory: /
schedule:
interval: monthly
cooldown:
default-days: 3
21 changes: 8 additions & 13 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,29 +25,24 @@ jobs:
- target: win32-arm64
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v6

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22

- name: Setup VSCE
run: sudo yarn global add vsce@latest
- name: Setup Node.js and tools
uses: jdx/mise-action@v4

- name: Install dependencies
run: yarn install
run: npm ci

- name: Build platform-specific VSIX
env:
GGSHIELD_TARGET: ${{ matrix.target }}
run: |
vsce package --target ${{ matrix.target }} \
npx vsce package --target ${{ matrix.target }} \
--baseContentUrl https://github.com/GitGuardian/gitguardian-vscode/ \
--allow-missing-repository
env:
GGSHIELD_TARGET: ${{ matrix.target }}

- name: Upload extension package
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: gitguardian-${{ matrix.target }}.vsix
path: gitguardian-*.vsix
33 changes: 13 additions & 20 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v6

- name: ⚙️ Install dependencies
run: npm ci

- name: Run pre-commit
run: pipx run pre-commit run --all-files --show-diff-on-failure
env:
# SKIP ggshield check: it's done by the "scanning" job
SKIP: ggshield
SKIP: ggshield # covered by the scanning job

build-and-test:
runs-on: ${{ matrix.os }}
Expand All @@ -38,36 +40,27 @@ jobs:

steps:
- name: 👩‍💻 Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v6

- name: ⚙️ Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "18"
- name: ⚙️ Set up Node.js and tools
uses: jdx/mise-action@v4

- name: ⚙️ Install dependencies
run: yarn install
run: npm ci

- name: Download ggshield binary
shell: bash
run: scripts/download-ggshield.sh --target ${{ matrix.vscode_target }}

# We use xvfb-run on Linux to run tests because we need a display.
# xvfb-run is not available on macOS, so we use XQuartz instead.
# The default GitHub Actions runner for Windows (windows-latest) has a GUI session
- name: ⚙️ Install XQuartz on macOS
if: runner.os == 'macOS'
run: brew install xquartz xorg-server

- name: 🧪 Run tests
shell: bash # Ensure bash is used for Linux/macOS
run: |
if [ "$RUNNER_OS" = "Linux" ]; then
xvfb-run --auto-servernum yarn test
xvfb-run --auto-servernum npm test
elif [ "$RUNNER_OS" = "macOS" ]; then
bash ./scripts/xvfb-run-macos.sh yarn test
npm test
else
bash -c "yarn test"
bash -c "npm test"
fi

scanning:
Expand All @@ -79,7 +72,7 @@ jobs:
github.event.pull_request.head.repo.full_name == github.repository)
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
fetch-depth: 0 # fetch all history so multiple commits can be scanned
- name: GitGuardian scan
Expand Down
8 changes: 4 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ yarn-error.log*
!.vscode/*.code-snippets

# TypeScript cache
tsconfig.base.tsbuildinfo%
*.tsbuildinfo

# ouput dir
out/
# output dir
dist/

# build files
**/*.vsix

# cache dir
# cache
.cache_ggshield
.vscode-test/

Expand Down
2 changes: 2 additions & 0 deletions .mise.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[tools]
node = "22"
2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
engine-strict=true
min-release-age=3
18 changes: 14 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,29 @@ repos:
stages: [commit-msg]
additional_dependencies: [ggcommitizen]

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.1.0
- repo: https://github.com/rbubley/mirrors-prettier
rev: v3.8.3
hooks:
- id: prettier
exclude: \.(m?js|ts)$

- repo: local
hooks:
- id: eslint
name: eslint
verbose: false
language: node
types: [file]
entry: npm run lint

- repo: https://github.com/codespell-project/codespell
rev: v2.4.1
hooks:
- id: codespell
exclude: ^(ggshield-internal)
exclude: ^(ggshield-internal|package-lock\.json)

- repo: https://github.com/gitguardian/ggshield
rev: v1.43.0
rev: v1.49.0
hooks:
- id: ggshield
language_version: python3
Expand Down
6 changes: 6 additions & 0 deletions .vscode-test.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { defineConfig } from "@vscode/test-cli";

export default defineConfig({
files: "dist/test/**/*.test.js",
mocha: { ui: "tdd", color: true, timeout: 60000 },
});
6 changes: 1 addition & 5 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,7 @@
"name": "Extension Tests",
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/out/test/suite/index"
],
"outFiles": ["${workspaceFolder}/out/test/**/*.js"],
"testConfiguration": "${workspaceFolder}/.vscode-test.mjs",
"preLaunchTask": "${defaultBuildTask}"
}
]
Expand Down
9 changes: 4 additions & 5 deletions .vscodeignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
.vscode/**
.vscode-test/**
src/**
node_modules/
src/
dist/test/
scripts/**
.gitignore
.yarnrc
.npmrc
vsc-extension-quickstart.md
**/tsconfig.json
**/.eslintrc.json
**/*.map
**/*.ts
1 change: 0 additions & 1 deletion .yarnrc

This file was deleted.

File renamed without changes.
File renamed without changes.
22 changes: 22 additions & 0 deletions build.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { build, context } from "esbuild";

const production = process.argv.includes("--production");
const watchMode = process.argv.includes("--watch");

const options = {
entryPoints: ["src/extension.ts"],
bundle: true,
format: "cjs",
minify: production,
sourcemap: !production,
outfile: "dist/extension.js",
external: ["vscode"],
platform: "node",
};

if (watchMode) {
const ctx = await context(options);
await ctx.watch();
} else {
await build(options).catch(() => process.exit(1));
}
34 changes: 34 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { defineConfig } from "eslint/config";
import tseslint from "typescript-eslint";
import prettierPlugin from "eslint-plugin-prettier/recommended";

export default defineConfig([
{ ignores: ["out/**", "dist/**", "**/*.d.ts"] },
{
files: ["src/**/*.ts"],
extends: [...tseslint.configs.recommendedTypeChecked, prettierPlugin],
languageOptions: {
parserOptions: {
project: ["./tsconfig.src.json", "./tsconfig.test.json"],
tsconfigRootDir: import.meta.dirname,
},
},
rules: {
"@typescript-eslint/no-floating-promises": "error",
"@typescript-eslint/only-throw-error": "error",
eqeqeq: ["error", "smart"],
curly: ["error", "all"],
"@typescript-eslint/no-unused-vars": [
"error",
{ argsIgnorePattern: "^_" },
],
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/no-unsafe-call": "off",
"@typescript-eslint/no-unsafe-return": "off",
"@typescript-eslint/no-unsafe-argument": "off",
"@typescript-eslint/restrict-template-expressions": "off",
},
},
]);
Loading
Loading