Skip to content
Merged
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
34 changes: 34 additions & 0 deletions .config/repo/oxfmtrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"$schema": "https://raw.githubusercontent.com/oxc-project/oxc/main/npm/oxfmt/configuration_schema.json",
"useTabs": false,
"tabWidth": 2,
"printWidth": 80,
"singleQuote": true,
"jsxSingleQuote": false,
"quoteProps": "as-needed",
"trailingComma": "all",
"semi": false,
"arrowParens": "avoid",
"bracketSameLine": false,
"bracketSpacing": true,
"singleAttributePerLine": false,
"jsdoc": {
"addDefaultToDescription": false,
"bracketSpacing": false,
"capitalizeDescriptions": true,
"commentLineStrategy": "multiline",
"descriptionTag": false,
"descriptionWithDot": true,
"keepUnparsableExampleIndent": false,
"lineWrappingStyle": "balance",
"preferCodeFences": false,
"separateReturnsFromParam": false,
"separateTagGroups": true
},
"ignorePatterns": [
"**/node_modules/**",
"**/fixtures/**",
"**/wasm_exec.js",
"**/bootstrap/**"
]
}
158 changes: 158 additions & 0 deletions .config/repo/oxlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
{
"$schema": "https://raw.githubusercontent.com/oxc-project/oxc/5306f24d9e82ae36ad9c3c964f33075bc589c799/npm/oxlint/configuration_schema.json",
"plugins": ["typescript", "unicorn", "import"],
"categories": {
"correctness": "error",
"suspicious": "error"
},
"rules": {
"eslint/complexity": ["error", 15],
"eslint/curly": "error",
"eslint/no-await-in-loop": "off",
"eslint/no-console": "off",
"eslint/no-control-regex": "off",
"eslint/no-empty": [
"error",
{
"allowEmptyCatch": true
}
],
"eslint/no-new": "error",
"eslint/no-proto": "error",
"eslint/no-shadow": "error",
"eslint/no-underscore-dangle": "off",
"eslint/no-unmodified-loop-condition": "off",
"eslint/no-unused-vars": [
"error",
{
"args": "all",
"argsIgnorePattern": "^_",
"varsIgnorePattern": "^$",
"caughtErrors": "all",
"caughtErrorsIgnorePattern": "^_",
"destructuredArrayIgnorePattern": "^_",
"ignoreRestSiblings": false
}
],
"eslint/no-useless-catch": "off",
"eslint/no-var": "error",
"eslint/prefer-const": "error",
"eslint/prefer-regex-literals": [
"error",
{
"disallowRedundantWrapping": true
}
],
"eslint/preserve-caught-error": "off",
"eslint/sort-imports": "off",
"import/no-cycle": "off",
"import/no-named-as-default": "off",
"import/no-named-as-default-member": "off",
"import/no-self-import": "error",
"import/no-unassigned-import": "off",
"typescript/array-type": [
"error",
{
"default": "array-simple"
}
],
"typescript/consistent-type-assertions": [
"error",
{
"assertionStyle": "as"
}
],
"typescript/consistent-type-imports": "error",
"typescript/no-duplicate-enum-values": "error",
"typescript/no-duplicate-type-constituents": [
"error",
{
"ignoreUnions": true
}
],
"typescript/no-explicit-any": "error",
"typescript/no-extra-non-null-assertion": "error",
"typescript/no-extraneous-class": "off",
"typescript/no-misused-new": "error",
"typescript/no-non-null-asserted-optional-chain": "off",
"typescript/no-redundant-type-constituents": "off",
"typescript/no-this-alias": [
"error",
{
"allowDestructuring": true
}
],
"typescript/no-unnecessary-type-assertion": "off",
"typescript/no-useless-empty-export": "error",
"typescript/no-wrapper-object-types": "error",
"typescript/prefer-as-const": "error",
"typescript/triple-slash-reference": "error",
"unicorn/consistent-function-scoping": "off",
"unicorn/no-array-for-each": "off",
"unicorn/no-array-reverse": "error",
"unicorn/no-array-sort": "error",
"unicorn/no-empty-file": "off",
"unicorn/no-null": "off",
"unicorn/no-useless-fallback-in-spread": "off",
"unicorn/numeric-separators-style": "error",
"unicorn/prefer-node-protocol": "error",
"unicorn/prefer-spread": "off",
"typescript/no-unsafe-type-assertion": "off"
},
"overrides": [
{
"files": [
"**/scripts/**",
"**/test/**",
"**/tests/**",
"**/.config/**",
"**/.git-hooks/**",
"**/.github/**",
"**/.claude/hooks/**",
"**/.claude/skills/**",
"**/.claude/workflows/**"
],
"rules": {}
},
{
"files": [
"**/template/base/universal/.claude/**",
"**/template/base/universal/.config/fleet/**",
"**/template/base/universal/.git-hooks/**",
"**/template/base/universal/scripts/fleet/**",
"**/template/base/universal/test/fleet/**"
],
"rules": {}
},
{
"files": ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.cts"],
"rules": {
"eslint/no-unused-vars": "off"
}
},
{
"files": [
"**/scripts/fleet/build-hook-bundle.mts",
"**/scripts/fleet/build-hook-snapshot.mts",
"**/scripts/fleet/build-snapshot-launcher.mts",
"**/scripts/fleet/fetch-fleet-pack.mts",
"**/scripts/fleet/gen/hook-dispatch.mts",
"**/scripts/fleet/gen/hook-validators.mts",
"**/scripts/fleet/lib/stable-alias.mts",
"**/scripts/fleet/lockstep/emit-mirror-globs.mts",
"**/scripts/fleet/sync-oxlint-rules.mts",
"**/scripts/fleet/update.mts",
"**/scripts/fleet/update/fleet-pins.mts",
"**/scripts/repo/dogfood.mts",
"**/scripts/repo/commit-cascade/fixers/mirror-mode.mts"
],
"rules": {}
}
],
"ignorePatterns": [
"**/node_modules/**",
"scripts/repo/bootstrap/**",
"**/*.d.ts",
"**/wasm_exec.js"
]
}
17 changes: 5 additions & 12 deletions .config/repo/rolldown.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import type { Plugin, RolldownOptions } from 'rolldown'

import { getEnvValue } from '@socketsecurity/lib-stable/env/rewire'

import { defineGuardedPlugin } from '../fleet/rolldown/define-guarded.mts'

const rootPath = path.resolve(import.meta.dirname, '../..')
const require = createRequire(import.meta.url)

Expand Down Expand Up @@ -83,17 +81,12 @@ const config: RolldownOptions = {
sourcemap: !minify,
},
platform: 'node',
plugins: [
// `defineGuarded` keys are dotted member chains. Source may spell the
// access with a dot or with quoted brackets — TypeScript forces
// `process.env['X']` on index-signature types — and both normalize to this
// same key. The `INLINED_*` name follows the fleet convention (see
// socket-cli) for build-inlined values.
defineGuardedPlugin({
transform: {
define: {
'process.env.INLINED_EXTENSION_VERSION': JSON.stringify(extensionVersion),
}),
stageParserWasmPlugin(),
],
},
},
plugins: [stageParserWasmPlugin()],
// The sources are `.mts` (the fleet's sources-are-mts rule) and import each
// other extensionlessly, which rolldown's default extension list does not
// cover — without `.mts` here every relative import fails to resolve.
Expand Down
37 changes: 35 additions & 2 deletions .config/repo/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,38 @@
{
"extends": ["../fleet/tsconfig.base.json", "./tsconfig.check.json"],
"compilerOptions": {
Comment thread
jdalton marked this conversation as resolved.
Resolved
"allowJs": false,
"composite": false,
"declarationMap": false,
"esModuleInterop": true,
"exactOptionalPropertyTypes": true,
"forceConsistentCasingInFileNames": true,
"incremental": false,
"isolatedModules": true,
"lib": ["DOM", "ES2024"],
"noEmitOnError": true,
"noFallthroughCasesInSwitch": true,
"noImplicitOverride": true,
"noPropertyAccessFromIndexSignature": true,
"noUncheckedIndexedAccess": true,
"noUncheckedSideEffectImports": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"sourceMap": false,
"strict": true,
"strictNullChecks": true,
"target": "ES2024",
"useUnknownInCatchVariables": true,
"verbatimModuleSyntax": true,
"allowImportingTsExtensions": true,
"allowSyntheticDefaultImports": true,
"module": "ESNext",
"moduleResolution": "bundler",
"noEmit": true,
"types": ["node", "vscode"]
},
"include": ["../../src/**/*.mts", "../../src/**/*.d.ts"],
"exclude": ["../../node_modules"]
"exclude": ["../../node_modules", "../../out"],
"extends": "./tsconfig.check.json"
}
26 changes: 26 additions & 0 deletions .config/repo/vitest.local.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import path from 'node:path'
import { defineConfig } from 'vitest/config'

const root = path.resolve(import.meta.dirname, '../..')

export default defineConfig({
resolve: {
alias: {
vscode: path.join(root, 'test/stubs/vscode.mts'),
},
},
test: {
setupFiles: [path.join(root, 'test/repo/vitest.setup.mts')],
include: ['test/repo/unit/**/*.test.mts'],
exclude: [
'test/**/*.fuzz.mts',
'test/repo/unit/test-extension.test.mts',
'test/repo/unit/test-extension-auth.test.mts',
'test/repo/unit/scripts/install-claude-plugins.test.mts',
],
testTimeout: 15_000,
hookTimeout: 15_000,
pool: 'forks',
maxWorkers: 4,
},
})
15 changes: 10 additions & 5 deletions .git-hooks/_shared/push/repo-gates.mts
Original file line number Diff line number Diff line change
Expand Up @@ -180,12 +180,17 @@ export const scanFastChecks = (ranges: readonly string[] = []): number => {
if (!lintScript) {
return 0
}
// Extract the local node-script path from a `node <path> [args]` lint script
// (the fleet shape is `node scripts/fleet/lint.mts`). A non-node lint script
// can't be run directly here — skip rather than risk a pnpm reinstall.
const m = /^node\s+(\S+\.[cm]?[jt]s)\b/.exec(lintScript.trim())
if (!m || !existsSync(m[1]!)) {
return 0
if (!m) {
const result = spawnSync('pnpm', ['run', 'lint'], {
env: { ...process.env, CI: 'true' },
stdioString: true,
})
showCheckResult(result)
return result.status ?? 1
}
if (!existsSync(m[1]!)) {
return 1
}
const scopeArgs =
ranges.length > 0 ? ranges.map(range => `--range=${range}`) : ['--all']
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/ci-gates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ jobs:
- name: Check repository
uses: ./.github/actions/fleet/run-script
with:
main-script: pnpm run check --all
main-script: node scripts/fleet/check.mts --all
- name: Check standalone commands
run: pnpm run check
Comment thread
jdalton marked this conversation as resolved.
Resolved

test:
name: Test (${{ matrix.os }})
Expand Down Expand Up @@ -112,7 +114,7 @@ jobs:
uses: ./.github/actions/fleet/run-script
with:
setup-script: pnpm run build
main-script: pnpm test --ci
main-script: pnpm test

full-test:
name: Full test (${{ matrix.os }})
Expand Down Expand Up @@ -156,4 +158,4 @@ jobs:
uses: ./.github/actions/fleet/run-script
with:
setup-script: pnpm run build
main-script: pnpm test --all
main-script: pnpm run test:full
2 changes: 1 addition & 1 deletion .github/workflows/cron-weekly-fuzz.yml

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

3 changes: 3 additions & 0 deletions .toolingignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
scripts/repo/bootstrap/
test/repo/fixtures/
.config/repo/socket-wheelhouse-schema.json
2 changes: 1 addition & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"label": "Socket: test",
"type": "process",
"command": "pnpm",
"args": ["test", "--all"],
"args": ["test"],
"options": { "cwd": "${workspaceFolder}" },
"problemMatcher": [],
"group": { "kind": "test", "isDefault": true }
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Press `F5` in VS Code to build the extension and launch an Extension Development

Run the `Socket: watch` task or `pnpm run watch` to rebuild on edits. Reload the Extension Development Host to load each rebuild.

Run the `Socket: test` task or `pnpm test --all` for the full test suite. Use `pnpm test test/repo/unit/auth.test.mts` to run one test file.
Run the `Socket: test` task or `pnpm test` for the standalone unit suite. Run `pnpm run sync-fleet` before using the Fleet-backed coverage, fuzz, extension-host, or release commands. Use `pnpm run test:full` for the hydrated suite. Use `pnpm test test/repo/unit/auth.test.mts` to run one test file.

Run `pnpm run package-for-vscode` to build and package the production `.vsix`.

Expand Down
Loading
Loading