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
32 changes: 32 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Format

on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:

permissions:
contents: read

jobs:
prettier:
name: Prettier
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

- name: Setup Node.js
uses: ./.github/actions/setup-node-cached
with:
node-version: '24'

- name: Install dependencies
run: npm install

# No paths filter: most of what drifted out of style lives at the
# repo root, which the js-ci and php-ci filters never match.
- name: Check formatting
run: npx prettier --check . --ignore-path .gitignore --ignore-path .prettierignore
13 changes: 13 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Generated by release-please — reformatting them only creates churn, since
# the next release rewrites them in its own style.
CHANGELOG.md
packages/*/CHANGELOG.md
.release-please-manifest.json

# Test fixtures are inputs, not source. Their exact bytes are what is under
# test — indentation included.
packages/php/tests/Fixtures/

# Infection reads json5; Prettier rewrites the quoting style, which would
# fork this file away from its twin in safeaccess-identum.
packages/php/infection.json5
2 changes: 1 addition & 1 deletion codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ flags:
carryforward: false

comment:
layout: "condensed_header, flags, tree"
layout: 'condensed_header, flags, tree'
behavior: default
require_changes: false
14 changes: 5 additions & 9 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
export default {
extends: ['@commitlint/config-conventional'],
rules: {
'scope-enum': [
2,
'always',
['js', 'php', 'docs', 'ci', 'deps'],
],
'scope-empty': [1, 'never'],
},
extends: ['@commitlint/config-conventional'],
rules: {
'scope-enum': [2, 'always', ['js', 'php', 'docs', 'ci', 'deps']],
'scope-empty': [1, 'never'],
},
};
13 changes: 5 additions & 8 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import eslint from "@eslint/js";
import tseslint from "typescript-eslint";
import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';

/**
* Shared ESLint configuration for all TypeScript packages in the monorepo.
Expand All @@ -10,14 +10,11 @@ export default tseslint.config(
...tseslint.configs.recommended,
{
rules: {
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-unused-vars": [
"error",
{ argsIgnorePattern: "^_" },
],
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
},
},
{
ignores: ["dist/", "node_modules/"],
ignores: ['dist/', 'node_modules/'],
},
);
80 changes: 45 additions & 35 deletions packages/js/src/core/inline-builder-accessor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,15 @@ export class InlineBuilderAccessor {
* @returns New builder instance with the integration configured.
*/
withParserIntegration(integration: ParseIntegrationInterface): this {
return new (this.constructor as new (
guard: SecurityGuardInterface,
secParser: SecurityParserInterface,
pathCache: PathCacheInterface | null,
integration: ParseIntegrationInterface | null,
strictMode: boolean | null,
) => this)(this._guard, this._secParser, this._pathCache, integration, this._strictMode);
return new (
this.constructor as new (
guard: SecurityGuardInterface,
secParser: SecurityParserInterface,
pathCache: PathCacheInterface | null,
integration: ParseIntegrationInterface | null,
strictMode: boolean | null,
) => this
)(this._guard, this._secParser, this._pathCache, integration, this._strictMode);
}

/**
Expand All @@ -100,13 +102,15 @@ export class InlineBuilderAccessor {
* @returns New builder instance with the guard configured.
*/
withSecurityGuard(guard: SecurityGuardInterface): this {
return new (this.constructor as new (
guard: SecurityGuardInterface,
secParser: SecurityParserInterface,
pathCache: PathCacheInterface | null,
integration: ParseIntegrationInterface | null,
strictMode: boolean | null,
) => this)(guard, this._secParser, this._pathCache, this._integration, this._strictMode);
return new (
this.constructor as new (
guard: SecurityGuardInterface,
secParser: SecurityParserInterface,
pathCache: PathCacheInterface | null,
integration: ParseIntegrationInterface | null,
strictMode: boolean | null,
) => this
)(guard, this._secParser, this._pathCache, this._integration, this._strictMode);
}

/**
Expand All @@ -116,13 +120,15 @@ export class InlineBuilderAccessor {
* @returns New builder instance with the parser configured.
*/
withSecurityParser(parser: SecurityParserInterface): this {
return new (this.constructor as new (
guard: SecurityGuardInterface,
secParser: SecurityParserInterface,
pathCache: PathCacheInterface | null,
integration: ParseIntegrationInterface | null,
strictMode: boolean | null,
) => this)(this._guard, parser, this._pathCache, this._integration, this._strictMode);
return new (
this.constructor as new (
guard: SecurityGuardInterface,
secParser: SecurityParserInterface,
pathCache: PathCacheInterface | null,
integration: ParseIntegrationInterface | null,
strictMode: boolean | null,
) => this
)(this._guard, parser, this._pathCache, this._integration, this._strictMode);
}

/**
Expand All @@ -132,13 +138,15 @@ export class InlineBuilderAccessor {
* @returns New builder instance with the cache configured.
*/
withPathCache(cache: PathCacheInterface): this {
return new (this.constructor as new (
guard: SecurityGuardInterface,
secParser: SecurityParserInterface,
pathCache: PathCacheInterface | null,
integration: ParseIntegrationInterface | null,
strictMode: boolean | null,
) => this)(this._guard, this._secParser, cache, this._integration, this._strictMode);
return new (
this.constructor as new (
guard: SecurityGuardInterface,
secParser: SecurityParserInterface,
pathCache: PathCacheInterface | null,
integration: ParseIntegrationInterface | null,
strictMode: boolean | null,
) => this
)(this._guard, this._secParser, cache, this._integration, this._strictMode);
}

/**
Expand All @@ -152,12 +160,14 @@ export class InlineBuilderAccessor {
* Only use with fully trusted, application-controlled input.
*/
withStrictMode(strict: boolean): this {
return new (this.constructor as new (
guard: SecurityGuardInterface,
secParser: SecurityParserInterface,
pathCache: PathCacheInterface | null,
integration: ParseIntegrationInterface | null,
strictMode: boolean | null,
) => this)(this._guard, this._secParser, this._pathCache, this._integration, strict);
return new (
this.constructor as new (
guard: SecurityGuardInterface,
secParser: SecurityParserInterface,
pathCache: PathCacheInterface | null,
integration: ParseIntegrationInterface | null,
strictMode: boolean | null,
) => this
)(this._guard, this._secParser, this._pathCache, this._integration, strict);
}
}
28 changes: 14 additions & 14 deletions packages/js/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
"compilerOptions": {
"target": "ES2022",
"module": "ESNext",
"moduleResolution": "bundler",
"strict": true,
"declaration": true,
"outDir": "./dist",
"rootDir": "./src",
"noImplicitAny": true,
"noImplicitReturns": true,
"exactOptionalPropertyTypes": true
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist", "tests", "vitest.config.ts"]
"compilerOptions": {
"target": "ES2022",
"module": "ESNext",
"moduleResolution": "bundler",
"strict": true,
"declaration": true,
"outDir": "./dist",
"rootDir": "./src",
"noImplicitAny": true,
"noImplicitReturns": true,
"exactOptionalPropertyTypes": true
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist", "tests", "vitest.config.ts"]
}