Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wip: podspec2 #31

Draft
wants to merge 20 commits into
base: main
Choose a base branch
from
Draft
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
3 changes: 3 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"recommendations": ["biomejs.biome", "dbaeumer.vscode-eslint"]
}
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,6 @@
"javascript.preferences.quoteStyle": "double",
"typescript.format.semicolons": "insert",
"typescript.preferences.quoteStyle": "double",
"typescript.enablePromptUseWorkspaceTsdk": true
"typescript.enablePromptUseWorkspaceTsdk": true,
"typescript.tsdk": "node_modules/typescript/lib"
}
2 changes: 1 addition & 1 deletion biome.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
},
"javascript": {
"formatter": {
"trailingCommas": "none"
"trailingCommas": "es5"
}
},
"json": {
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
"husky": "^9.1.6",
"knip": "^5.29.2",
"turbo": "^2.2.1",
"typescript": "^5.4.5",
"vitest": "^2.0.5"
"typescript": "^5.7",
"vitest": "^3.0.0"
},
"packageManager": "[email protected]",
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion packages/app-connector/src/connection_state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export type ClientConnectionInfo = {
};

export enum ClientConnectionErrorType {
PERMISSION_DENIED = "PERMISSION_DENIED"
PERMISSION_DENIED = "PERMISSION_DENIED",
}

export type ClientConnectionError = {
Expand Down
55 changes: 40 additions & 15 deletions packages/eslint-config/eslint.base.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,41 +12,44 @@ export default tseslint.config(

{
ignores: [
"**/src/generated/**",
"**/node_modules/*",
"**/dist/",
"**/vitest.config.ts",
"**/vite.config.ts",
"**/tailwind.config.ts"
] // global ignore with single ignore key
"**/vitest.workspace.ts",
"**/tailwind.config.ts",
"**/tsup.config.ts",
], // global ignore with single ignore key
},
{
languageOptions: {
parserOptions: {
projectService: true
}
}
projectService: true,
},
},
},
{
files: ["**/*.js", "**/*.mjs"],
extends: [tseslint.configs.disableTypeChecked]
extends: [tseslint.configs.disableTypeChecked],
},
{
plugins: {
"chai-friendly": pluginChaiFriendly,
"react-hooks": hooksPlugin,
turbo: eslintPluginTurbo,
import: eslintPluginImport
import: eslintPluginImport,
},
rules: {
...hooksPlugin.configs.recommended.rules,
"turbo/no-undeclared-env-vars": "error"
}
"turbo/no-undeclared-env-vars": "error",
},
},
{
rules: {
"import/extensions": ["error", "always"]
"import/extensions": ["error", "always"],
},
files: ["./packages/**"]
files: ["./packages/**"],
},
{
rules: {
Expand All @@ -60,8 +63,8 @@ export default tseslint.config(
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
destructuredArrayIgnorePattern: "^_",
caughtErrorsIgnorePattern: "^_"
}
caughtErrorsIgnorePattern: "^_",
},
],
"no-case-declarations": "off",
"react-hooks/rules-of-hooks": "error",
Expand All @@ -72,7 +75,29 @@ export default tseslint.config(
"@typescript-eslint/consistent-type-imports": "error",
"@typescript-eslint/no-import-type-side-effects": "error",
"no-unexpected-multiline": "off",
"no-restricted-globals": ["error", "origin"]
}
"no-restricted-globals": ["error", "origin"],
"no-restricted-syntax": [
"error",
{
selector: "BinaryExpression[operator='in']",
message:
"Don't use in operator. Use Object.prototype.hasOwnProperty.call instead.",
},
{
selector:
'Property:matches([kind = "get"], [kind = "set"]), MethodDefinition:matches([kind = "get"], [kind = "set"])',
message: "Don't use get and set accessors.",
},
{
selector: "ForInStatement",
message: "Don't use for-in loop.",
},
// Ban static `this`:
{
selector: "MethodDefinition[static = true] ThisExpression",
message: "Prefer using the class's name directly.",
},
],
},
}
);
14 changes: 9 additions & 5 deletions packages/podspec/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@parcnet-js/podspec",
"version": "1.2.0",
"version": "2.0.0-alpha.1",
"license": "GPL-3.0-or-later",
"main": "dist/index.cjs",
"module": "dist/index.js",
Expand Down Expand Up @@ -30,16 +30,20 @@
},
"scripts": {
"lint": "eslint . --max-warnings 0",
"build": "tsup 'src/**/*@(ts|tsx)' --format cjs,esm --clean --sourcemap --no-splitting",
"prepublish": "tsup 'src/**/*@(ts|tsx)' --format cjs,esm --clean --sourcemap --dts --no-splitting",
"build": "tsup",
"prepublish": "tsup --dts",
"test": "vitest run --typecheck"
},
"files": ["dist", "./README.md", "./LICENSE"],
"dependencies": {
"@pcd/gpc": "^0.4.0",
"@pcd/pod": "^0.5.0"
"@pcd/pod": "^0.5.0",
"base64-js": "^1.5.1",
"canonicalize": "^2.0.0",
"typia": "^7.6.0"
},
"devDependencies": {
"@fast-check/vitest": "^0.1.5",
"@parcnet-js/eslint-config": "workspace:*",
"@parcnet-js/typescript-config": "workspace:*",
"@pcd/proto-pod-gpc-artifacts": "^0.11.0",
Expand All @@ -49,7 +53,7 @@
"tsup": "^8.2.4",
"typescript": "^5.5",
"uuid": "^9.0.0",
"vitest": "^2.1.1"
"vitest": "^3.0.5"
},
"publishConfig": {
"access": "public",
Expand Down
24 changes: 24 additions & 0 deletions packages/podspec/src/audit/podSpec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import type { PODSpec } from "../builders/pod.js";
import type { EntryTypes } from "../builders/types/entries.js";
import type { StatementMap } from "../builders/types/statements.js";
import { assertPODSpec } from "../generated/podspec.js";

export function auditPODSpec<E extends EntryTypes, S extends StatementMap>(
spec: PODSpec<E, S>
): void {
assertPODSpec(spec);

for (const [key, statement] of Object.entries(spec.statements)) {
switch (statement.type) {
case "isMemberOf":
// TODO: check that statements are valid
break;
case "isNotMemberOf":
// TODO: check that statements are valid
break;
default:
// prettier-ignore
statement.type satisfies never;
}
}
}
Loading
Loading