@solana-config/oxc 0.0.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Solana Foundation
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,61 @@
1
+ # `@solana-config/oxc`
2
+
3
+ Shared [Oxlint](https://oxc.rs/docs/guide/usage/linter) and [Oxfmt](https://oxc.rs/docs/guide/usage/formatter) configurations for Solana projects. Matches the rules and style options from [`@solana-config/eslint`](../eslint) and [`@solana-config/prettier`](../prettier) to the Oxc-based toolchain.
4
+
5
+ Both configs ship in two formats — a CommonJS factory and a JSON file — so consumers can use either `oxlint.config.ts` / `oxfmt.config.ts` or `.oxlintrc.json` / `.oxfmtrc.json`.
6
+
7
+ ## Install
8
+
9
+ ```sh
10
+ pnpm add -D @solana-config/oxc oxlint oxlint-tsgolint oxfmt
11
+ ```
12
+
13
+ `oxlint-tsgolint` is required for type-aware linting. Drop it if you don't enable `options.typeAware`.
14
+
15
+ ## Oxlint usage
16
+
17
+ `options.typeAware` and `ignorePatterns` are root-config-only in Oxlint and cannot be inherited via `extends`. The shared config only sets `rules`, so consumers opt into type-aware linting in their own root config.
18
+
19
+ ### TypeScript config (`oxlint.config.ts`)
20
+
21
+ ```ts
22
+ import { defineConfig } from 'oxlint';
23
+
24
+ import solanaConfig from '@solana-config/oxc/oxlint';
25
+
26
+ export default defineConfig({
27
+ extends: [solanaConfig],
28
+ options: { typeAware: true },
29
+ });
30
+ ```
31
+
32
+ ### JSON config (`.oxlintrc.json`)
33
+
34
+ ```json
35
+ {
36
+ "extends": ["./node_modules/@solana-config/oxc/oxlint.json"],
37
+ "options": { "typeAware": true }
38
+ }
39
+ ```
40
+
41
+ ## Oxfmt usage
42
+
43
+ Oxfmt has no `extends` mechanism, so consumers spread this config into their own `defineConfig({...})`.
44
+
45
+ ### TypeScript config (`oxfmt.config.ts`)
46
+
47
+ ```ts
48
+ import { defineConfig } from 'oxfmt';
49
+
50
+ import solanaFmt from '@solana-config/oxc/oxfmt';
51
+
52
+ export default defineConfig({ ...solanaFmt });
53
+ ```
54
+
55
+ ### JSON config (`.oxfmtrc.json`)
56
+
57
+ Oxfmt JSON configs do not support `extends`, so consumers either copy the contents of `oxfmt.json` or reference it via the `--config` CLI flag:
58
+
59
+ ```sh
60
+ oxfmt --config ./node_modules/@solana-config/oxc/oxfmt.json
61
+ ```
package/oxfmt.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ import type { OxfmtConfig } from 'oxfmt';
2
+
3
+ declare const config: OxfmtConfig;
4
+ export default config;
package/oxfmt.js ADDED
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Shared Oxfmt configuration for Solana Kit projects.
3
+ *
4
+ * Ports {@link https://npmjs.com/package/@solana/prettier-config-solana | @solana/prettier-config-solana}
5
+ * to Oxfmt with the Solana code style: 4-space indent, 120-char print width,
6
+ * single quotes, semicolons, arrow parentheses avoided where possible.
7
+ *
8
+ * Adds {@link https://oxc.rs/docs/guide/usage/formatter/sorting | `sortImports`}
9
+ * (the Oxfmt built-in import sorter, disabled by default) to replace
10
+ * `eslint-plugin-simple-import-sort/imports` from `@solana/eslint-config-solana`,
11
+ * which has no native equivalent in Oxlint.
12
+ *
13
+ * Oxfmt has no `extends` mechanism, so consumers spread this object into their
14
+ * own `defineConfig({...})`.
15
+ *
16
+ * Authored as CommonJS so it can be imported from both CommonJS and ESM consumers.
17
+ *
18
+ * @example
19
+ * ```ts
20
+ * // oxfmt.config.ts
21
+ * import { defineConfig } from 'oxfmt';
22
+ *
23
+ * import solanaFmt from '@solana-config/oxc/oxfmt';
24
+ *
25
+ * export default defineConfig({ ...solanaFmt });
26
+ * ```
27
+ *
28
+ * @see {@link https://oxc.rs/docs/guide/usage/formatter | Oxfmt documentation}
29
+ * @type {import('oxfmt').OxfmtConfig}
30
+ */
31
+ module.exports = {
32
+ arrowParens: 'avoid',
33
+ bracketSameLine: false,
34
+ bracketSpacing: true,
35
+ jsxSingleQuote: false,
36
+ overrides: [
37
+ {
38
+ files: ['*.yaml', '*.yml'],
39
+ options: { tabWidth: 2 },
40
+ },
41
+ ],
42
+ printWidth: 120,
43
+ quoteProps: 'as-needed',
44
+ semi: true,
45
+ singleQuote: true,
46
+ sortImports: true,
47
+ tabWidth: 4,
48
+ useTabs: false,
49
+ };
package/oxfmt.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "$schema": "./node_modules/oxfmt/configuration_schema.json",
3
+ "arrowParens": "avoid",
4
+ "bracketSameLine": false,
5
+ "bracketSpacing": true,
6
+ "jsxSingleQuote": false,
7
+ "overrides": [
8
+ {
9
+ "files": ["*.yaml", "*.yml"],
10
+ "options": { "tabWidth": 2 }
11
+ }
12
+ ],
13
+ "printWidth": 120,
14
+ "quoteProps": "as-needed",
15
+ "semi": true,
16
+ "singleQuote": true,
17
+ "sortImports": true,
18
+ "tabWidth": 4,
19
+ "useTabs": false
20
+ }
package/oxlint.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ import type { OxlintConfig } from 'oxlint';
2
+
3
+ declare const config: OxlintConfig;
4
+ export default config;
package/oxlint.js ADDED
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Shared Oxlint configuration for Solana Kit projects.
3
+ *
4
+ * Ports {@link https://npmjs.com/package/@solana/eslint-config-solana | @solana/eslint-config-solana}
5
+ * to Oxlint. The configuration only sets `rules` — Oxlint requires `options.typeAware` and
6
+ * `ignorePatterns` to live in the root config that consumes this one (see the example).
7
+ *
8
+ * Several of the rules below are type-aware. The consumer's root config must set
9
+ * `options.typeAware: true` (or pass `--type-aware` on the CLI) and have
10
+ * {@link https://npmjs.com/package/oxlint-tsgolint | oxlint-tsgolint} installed alongside
11
+ * {@link https://npmjs.com/package/oxlint | oxlint} for those rules to fire.
12
+ *
13
+ * Authored as CommonJS so it can be imported from both CommonJS and ESM consumers.
14
+ *
15
+ * @example
16
+ * ```ts
17
+ * // oxlint.config.ts
18
+ * import { defineConfig } from 'oxlint';
19
+ *
20
+ * import solanaConfig from '@solana-config/oxc/oxlint';
21
+ *
22
+ * export default defineConfig({
23
+ * extends: [solanaConfig],
24
+ * options: { typeAware: true },
25
+ * });
26
+ * ```
27
+ *
28
+ * @see {@link https://oxc.rs/docs/guide/usage/linter | Oxlint documentation}
29
+ * @type {import('oxlint').OxlintConfig}
30
+ */
31
+ module.exports = {
32
+ rules: {
33
+ // Mirrors `@typescript-eslint/no-unused-vars` from `@solana/eslint-config-solana`.
34
+ // Oxlint's `eslint/no-unused-vars` is type-aware and supports the same options.
35
+ 'no-unused-vars': [
36
+ 'error',
37
+ {
38
+ argsIgnorePattern: '^_',
39
+ destructuredArrayIgnorePattern: '^_',
40
+ },
41
+ ],
42
+ // Replaces `eslint-plugin-sort-keys-fix`. Oxlint added autofix for this rule in v1.63.
43
+ 'sort-keys': 'error',
44
+ // Type-aware rules from the Solana ESLint config. Several of these are already on by
45
+ // default in Oxlint when `typeAware` is enabled, but are listed here explicitly to
46
+ // preserve intent and stay stable across Oxlint version bumps.
47
+ 'typescript/no-floating-promises': 'error',
48
+ 'typescript/prefer-promise-reject-errors': 'error',
49
+ 'typescript/require-await': 'error',
50
+ 'typescript/restrict-plus-operands': 'error',
51
+ 'typescript/restrict-template-expressions': 'error',
52
+ 'typescript/return-await': ['error', 'always'],
53
+ },
54
+ };
package/oxlint.json ADDED
@@ -0,0 +1,19 @@
1
+ {
2
+ "$schema": "./node_modules/oxlint/configuration_schema.json",
3
+ "rules": {
4
+ "no-unused-vars": [
5
+ "error",
6
+ {
7
+ "argsIgnorePattern": "^_",
8
+ "destructuredArrayIgnorePattern": "^_"
9
+ }
10
+ ],
11
+ "sort-keys": "error",
12
+ "typescript/no-floating-promises": "error",
13
+ "typescript/prefer-promise-reject-errors": "error",
14
+ "typescript/require-await": "error",
15
+ "typescript/restrict-plus-operands": "error",
16
+ "typescript/restrict-template-expressions": "error",
17
+ "typescript/return-await": ["error", "always"]
18
+ }
19
+ }
package/package.json CHANGED
@@ -1,12 +1,58 @@
1
1
  {
2
2
  "name": "@solana-config/oxc",
3
- "version": "0.0.0",
4
- "description": "",
5
- "license": "ISC",
6
- "author": "",
7
- "type": "commonjs",
8
- "main": "index.js",
9
- "scripts": {
10
- "test": "echo \"Error: no test specified\" && exit 1"
3
+ "version": "0.1.1",
4
+ "description": "Shared Oxlint and Oxfmt configurations for Solana projects",
5
+ "license": "MIT",
6
+ "author": "Solana Maintainers <maintainers@solana.com>",
7
+ "homepage": "https://github.com/solana-foundation/js-configs/tree/main/packages/oxc#readme",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/solana-foundation/js-configs.git",
11
+ "directory": "packages/oxc"
12
+ },
13
+ "bugs": {
14
+ "url": "https://github.com/solana-foundation/js-configs/issues"
15
+ },
16
+ "keywords": [
17
+ "config",
18
+ "oxc",
19
+ "oxfmt",
20
+ "oxlint",
21
+ "solana"
22
+ ],
23
+ "files": [
24
+ "oxfmt.d.ts",
25
+ "oxfmt.js",
26
+ "oxfmt.json",
27
+ "oxlint.d.ts",
28
+ "oxlint.js",
29
+ "oxlint.json"
30
+ ],
31
+ "exports": {
32
+ "./oxfmt": {
33
+ "types": "./oxfmt.d.ts",
34
+ "default": "./oxfmt.js"
35
+ },
36
+ "./oxfmt.json": "./oxfmt.json",
37
+ "./oxlint": {
38
+ "types": "./oxlint.d.ts",
39
+ "default": "./oxlint.js"
40
+ },
41
+ "./oxlint.json": "./oxlint.json"
42
+ },
43
+ "publishConfig": {
44
+ "access": "public"
45
+ },
46
+ "peerDependencies": {
47
+ "oxfmt": ">=0.48.0",
48
+ "oxlint": ">=1.63.0"
49
+ },
50
+ "peerDependenciesMeta": {
51
+ "oxfmt": {
52
+ "optional": true
53
+ },
54
+ "oxlint": {
55
+ "optional": true
56
+ }
11
57
  }
12
- }
58
+ }