Skip to content

Commit fa4bcdd

Browse files
authored
Migrate JS lint and format tooling to Oxlint and Oxfmt (#1249)
This PR migrates the token-2022 JS client from ESLint and Prettier to Oxlint and Oxfmt via the shared @solana-config/oxc package, to align with the other repos in the solana-program org. It adds oxlint.config.ts and oxfmt.config.ts, updates the lint and format scripts and dependencies, drops the now-unused ESLint and Prettier configuration, and pins a Node 24 floor (which the Oxc TypeScript configs require). Codama's JS renderer is given explicit prettier options so that regeneration still produces a zero diff. The remaining source changes are a one-time reformat applying the shared Oxfmt style.
1 parent 62b8e05 commit fa4bcdd

91 files changed

Lines changed: 836 additions & 1540 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.

clients/js/.eslintrc.cjs

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

clients/js/.prettierignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

clients/js/oxfmt.config.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
const oxfmt = require('oxfmt');
2+
const solanaFmt = require('@solana-config/oxc/oxfmt');
3+
4+
module.exports = oxfmt.defineConfig({
5+
...solanaFmt,
6+
ignorePatterns: ['**/dist/**', 'src/generated/**', 'test-ledger/**'],
7+
});

clients/js/oxlint.config.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
const oxlint = require('oxlint');
2+
const solanaConfig = require('@solana-config/oxc/oxlint');
3+
4+
module.exports = oxlint.defineConfig({
5+
extends: [solanaConfig],
6+
ignorePatterns: ['**/dist/**', 'src/generated/**', 'test-ledger/**'],
7+
options: { typeAware: true },
8+
rules: { 'sort-keys': 'off' },
9+
});

clients/js/package.json

Lines changed: 41 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,25 @@
22
"name": "@solana-program/token-2022",
33
"version": "0.11.0",
44
"description": "JavaScript client for the Token 2022 program",
5+
"homepage": "https://github.com/solana-program/token-2022#readme",
6+
"bugs": {
7+
"url": "https://github.com/solana-program/token-2022/issues"
8+
},
9+
"license": "Apache-2.0",
10+
"repository": {
11+
"type": "git",
12+
"url": "git+https://github.com/solana-program/token-2022.git"
13+
},
14+
"files": [
15+
"./dist/src",
16+
"./dist/types",
17+
"./src/"
18+
],
19+
"type": "commonjs",
520
"sideEffects": false,
6-
"module": "./dist/src/index.mjs",
721
"main": "./dist/src/index.js",
22+
"module": "./dist/src/index.mjs",
823
"types": "./dist/types/index.d.ts",
9-
"type": "commonjs",
1024
"exports": {
1125
".": {
1226
"types": "./dist/types/index.d.ts",
@@ -19,67 +33,55 @@
1933
"require": "./dist/src/confidential.js"
2034
}
2135
},
22-
"files": [
23-
"./dist/src",
24-
"./dist/types",
25-
"./src/"
26-
],
36+
"publishConfig": {
37+
"access": "public",
38+
"registry": "https://registry.npmjs.org"
39+
},
2740
"scripts": {
2841
"build": "rimraf dist && tsup && tsc -p ./tsconfig.declarations.json",
2942
"build:docs": "typedoc",
3043
"dev": "vitest",
3144
"test": "tsc --noEmit && vitest run",
32-
"lint": "eslint --ext js,ts,tsx src",
33-
"lint:fix": "eslint --fix --ext js,ts,tsx src",
34-
"format": "prettier --check src test",
35-
"format:fix": "prettier --write src test",
45+
"lint": "oxlint",
46+
"lint:fix": "oxlint --fix",
47+
"format": "oxfmt --check",
48+
"format:fix": "oxfmt",
3649
"prepublishOnly": "pnpm build"
3750
},
38-
"publishConfig": {
39-
"access": "public",
40-
"registry": "https://registry.npmjs.org"
41-
},
42-
"license": "Apache-2.0",
43-
"repository": {
44-
"type": "git",
45-
"url": "git+https://github.com/solana-program/token-2022.git"
46-
},
47-
"bugs": {
48-
"url": "https://github.com/solana-program/token-2022/issues"
49-
},
50-
"homepage": "https://github.com/solana-program/token-2022#readme",
51-
"peerDependencies": {
52-
"@solana/kit": "^6.4.0",
53-
"@solana/sysvars": "^5.0",
54-
"@solana/zk-sdk": "^0.4.2"
55-
},
56-
"peerDependenciesMeta": {
57-
"@solana/zk-sdk": {
58-
"optional": true
59-
}
60-
},
6151
"dependencies": {
6252
"@noble/curves": "^1.9.7",
6353
"@solana-program/zk-elgamal-proof": "^0.1.0"
6454
},
6555
"devDependencies": {
56+
"@solana-config/oxc": "^0.1.1",
6657
"@solana-program/system": "^0.12.0",
67-
"@solana/eslint-config-solana": "^3.0.3",
6858
"@solana/kit": "^6.4.0",
6959
"@solana/kit-plugin-instruction-plan": "^0.10.0",
7060
"@solana/kit-plugin-litesvm": "^0.10.0",
7161
"@solana/kit-plugin-rpc": "^0.11.1",
7262
"@solana/kit-plugin-signer": "^0.10.0",
7363
"@solana/zk-sdk": "^0.4.2",
7464
"@types/node": "^25",
75-
"@typescript-eslint/eslint-plugin": "^7.16.1",
76-
"@typescript-eslint/parser": "^7.16.1",
77-
"eslint": "^8.57.0",
78-
"prettier": "^3.8.1",
65+
"oxfmt": "^0.55.0",
66+
"oxlint": "^1.70.0",
67+
"oxlint-tsgolint": "^0.23.0",
7968
"rimraf": "^6.0.1",
8069
"tsup": "^8.1.2",
8170
"typedoc": "^0.28.0",
8271
"typescript": "^5.9.3",
8372
"vitest": "^4.1.8"
73+
},
74+
"peerDependencies": {
75+
"@solana/kit": "^6.4.0",
76+
"@solana/sysvars": "^5.0",
77+
"@solana/zk-sdk": "^0.4.2"
78+
},
79+
"peerDependenciesMeta": {
80+
"@solana/zk-sdk": {
81+
"optional": true
82+
}
83+
},
84+
"engines": {
85+
"node": ">=24.0.0"
8486
}
8587
}

0 commit comments

Comments
 (0)