Skip to content

Commit a5782ac

Browse files
chore: sync from internal
1 parent 56a222b commit a5782ac

100 files changed

Lines changed: 1072 additions & 1192 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.eslintignore

Lines changed: 0 additions & 16 deletions
This file was deleted.

.eslintrc.js

Lines changed: 0 additions & 97 deletions
This file was deleted.

.gitattributes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
/.yarn/** linguist-vendored
22
/.yarn/releases/* binary
33
/.yarn/plugins/**/* binary
4-
/.pnp.* binary linguist-generated
4+
/.pnp.* binary linguist-generated

.github/workflows/release.yml

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,46 @@
1+
# owner: wp
2+
# slack: #wallet-platform
3+
14
name: Release
25

36
on:
47
push:
58
branches:
69
- main
710

8-
permissions:
9-
contents: write
10-
pull-requests: write
11-
# OIDC for npm provenance
12-
id-token: write
11+
permissions: {}
1312

1413
concurrency: ${{ github.workflow }}-${{ github.ref }}
1514

1615
jobs:
1716
release:
1817
name: Publish to npm
19-
runs-on: ubuntu-latest
18+
runs-on: 2cpu-amd64-tooling
2019
# Only run on the public mirror — never on the internal repo
2120
if: github.repository == 'phantom/phantom-connect-sdk'
21+
environment: ci
22+
permissions:
23+
contents: write
24+
pull-requests: write
25+
# OIDC for npm provenance
26+
id-token: write
27+
actions: write
2228
env:
2329
NPM_CONFIG_PROVENANCE: true
2430
steps:
2531
- name: Checkout Repo
2632
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
27-
33+
with:
34+
# changesets publish uses commitMode: git-cli; credentials must persist for push (zizmor artipacked: explicit opt-in).
35+
persist-credentials: true
36+
37+
# Self-hosted / locked-down images may not allow symlinks under /usr/bin (default corepack enable).
2838
- name: Enable Corepack
29-
run: corepack enable
39+
run: |
40+
COREPACK_BIN="${RUNNER_TEMP}/corepack-bin"
41+
mkdir -p "${COREPACK_BIN}"
42+
corepack enable yarn --install-directory "${COREPACK_BIN}"
43+
echo "${COREPACK_BIN}" >> "${GITHUB_PATH}"
3044
3145
- name: Setup Node.js 20.x
3246
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4

.prettierignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,6 @@ node_modules/
77

88
# Builds
99
**/.next/
10-
**/build/
10+
**/build/
11+
12+
examples/with-nextjs/tsconfig.json

eslint.config.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import config from "./eslint.shared.mjs";
2+
3+
export default config;

eslint.shared.mjs

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
import tsPlugin from "@typescript-eslint/eslint-plugin";
2+
import tsParser from "@typescript-eslint/parser";
3+
import securityPlugin from "eslint-plugin-security";
4+
import importPlugin from "eslint-plugin-import";
5+
import reactHooksPlugin from "eslint-plugin-react-hooks";
6+
import checkFilePlugin from "eslint-plugin-check-file";
7+
import prettierConfig from "eslint-config-prettier";
8+
9+
// Collect all rules from the flat/recommended array (avoids the global-parser-setup entry)
10+
const tsRecommendedRules = tsPlugin.configs["flat/recommended"].reduce(
11+
(acc, config) => ({ ...acc, ...(config.rules ?? {}) }),
12+
{},
13+
);
14+
15+
/** @type {import("eslint").Linter.Config[]} */
16+
const config = [
17+
{
18+
ignores: [
19+
"**/node_modules/**",
20+
"**/dist/**",
21+
"**/build/**",
22+
"**/jest.config.js",
23+
"sharedJestConfig.js",
24+
"**/__fixtures__/**",
25+
"**/*.spec.ts",
26+
"**/*.spec.tsx",
27+
"**/*.test.ts",
28+
"**/*.test.tsx",
29+
"**/vite.config.ts",
30+
"**/vite-env.d.ts",
31+
"**/tsup.config.ts",
32+
"**/tsup.config.mts",
33+
],
34+
},
35+
{
36+
files: ["**/*.ts", "**/*.tsx"],
37+
plugins: {
38+
"@typescript-eslint": tsPlugin,
39+
"check-file": checkFilePlugin,
40+
import: importPlugin,
41+
"react-hooks": reactHooksPlugin,
42+
security: securityPlugin,
43+
},
44+
languageOptions: {
45+
parser: tsParser,
46+
parserOptions: {
47+
project: true,
48+
tsconfigRootDir: import.meta.dirname,
49+
},
50+
},
51+
settings: {
52+
"import/resolver": { typescript: true },
53+
"import/parsers": {
54+
"@typescript-eslint/parser": [".ts", ".tsx", ".mts", ".cts"],
55+
},
56+
},
57+
rules: {
58+
...tsRecommendedRules,
59+
...securityPlugin.configs.recommended.rules,
60+
"no-console": ["error", { allow: ["error"] }],
61+
"@typescript-eslint/explicit-module-boundary-types": "off",
62+
"@typescript-eslint/no-explicit-any": "off",
63+
"@typescript-eslint/no-unused-vars": ["error", { varsIgnorePattern: "^_", argsIgnorePattern: "^_" }],
64+
"@typescript-eslint/no-empty-interface": "off",
65+
"@typescript-eslint/ban-ts-comment": "off",
66+
"@typescript-eslint/no-shadow": "off",
67+
"@typescript-eslint/consistent-type-exports": "error",
68+
"react-hooks/rules-of-hooks": "error",
69+
"react-hooks/exhaustive-deps": "error",
70+
"import/no-duplicates": "error",
71+
"@typescript-eslint/no-inferrable-types": "off",
72+
"prefer-const": ["error", { destructuring: "all" }],
73+
"import/no-extraneous-dependencies": [
74+
"error",
75+
{
76+
devDependencies: [
77+
"**/*.test.*",
78+
"**/__test__/**",
79+
"**/__tests__/**",
80+
"**/testUtils.*",
81+
"**/e2e/**",
82+
"**/__mocks__/**",
83+
"**/vite.config.mts",
84+
"**/jestSetup.ts",
85+
"**/tsup.config.ts",
86+
],
87+
includeTypes: false,
88+
},
89+
],
90+
"check-file/folder-naming-convention": ["error", { "src/**/!(__tests__|__fixtures__|__mocks__)": "KEBAB_CASE" }],
91+
"security/detect-unsafe-regex": "off",
92+
"security/detect-non-literal-regexp": "off",
93+
"security/detect-object-injection": "off",
94+
"@typescript-eslint/consistent-type-imports": "error",
95+
"no-return-await": "off",
96+
"@typescript-eslint/return-await": "off",
97+
"@typescript-eslint/no-for-in-array": "error",
98+
"require-await": "off",
99+
"@typescript-eslint/require-await": "error",
100+
"import/no-cycle": ["error", { maxDepth: 50 }],
101+
},
102+
},
103+
prettierConfig,
104+
{
105+
files: ["packages/parsers/**/*.ts", "packages/constants/**/*.ts"],
106+
rules: {
107+
"@typescript-eslint/consistent-type-exports": "off",
108+
"@typescript-eslint/consistent-type-imports": "off",
109+
},
110+
},
111+
{
112+
files: ["packages/ui/**/*.native.ts", "packages/ui/**/*.native.tsx"],
113+
rules: {
114+
"import/no-extraneous-dependencies": [
115+
"error",
116+
{ devDependencies: true, optionalDependencies: false, peerDependencies: true },
117+
],
118+
},
119+
},
120+
];
121+
122+
export default config;

examples/react-native-sdk-demo-app/.eslintrc.js

Lines changed: 0 additions & 18 deletions
This file was deleted.

examples/react-sdk-demo-app/.eslintignore

Lines changed: 0 additions & 6 deletions
This file was deleted.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import baseConfig from "../../eslint.shared.mjs";
2+
import tsParser from "@typescript-eslint/parser";
3+
import { fileURLToPath } from "url";
4+
import { dirname } from "path";
5+
6+
const __dirname = dirname(fileURLToPath(import.meta.url));
7+
8+
export default [
9+
...baseConfig,
10+
{
11+
files: ["**/*.ts", "**/*.tsx"],
12+
languageOptions: {
13+
parser: tsParser,
14+
parserOptions: {
15+
project: ["./tsconfig.app.json"],
16+
tsconfigRootDir: __dirname,
17+
},
18+
},
19+
},
20+
];

0 commit comments

Comments
 (0)