@ver0/oxlint-config 0.0.1 → 1.0.0

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.
Files changed (2) hide show
  1. package/README.md +143 -32
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,35 +1,50 @@
1
1
  <div align="center">
2
+ <h1>@ver0/oxlint-config</h1>
2
3
 
3
- # @ver0/oxlint-config
4
+ [![NPM Version](https://img.shields.io/npm/v/%40ver0%2Foxlint-config?style=flat-square)](https://www.npmjs.com/package/@ver0/oxlint-config)
5
+ [![NPM Downloads](https://img.shields.io/npm/dm/%40ver0%2Foxlint-config?style=flat-square)](https://www.npmjs.com/package/@ver0/oxlint-config)
6
+ [![Dependents (via libraries.io), scoped npm package](https://img.shields.io/librariesio/dependents/npm/%40ver0/oxlint-config?style=flat-square)](https://www.npmjs.com/package/@ver0/oxlint-config)
7
+ [![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/ver0-project/oxlint-config/ci.yml?style=flat-square)](https://github.com/ver0-project/oxlint-config/actions)
4
8
 
5
- <p>
6
- <a href="https://www.npmjs.com/package/@ver0/oxlint-config"><img alt="npm" src="https://img.shields.io/npm/v/%40ver0%2Foxlint-config"/></a>
7
- <a href="https://github.com/ver0-project/oxlint-config/actions/workflows/ci.yml"><img alt="CI" src="https://github.com/ver0-project/oxlint-config/actions/workflows/ci.yml/badge.svg"/></a>
8
- </p>
9
+ <br/>
9
10
 
10
- <p>🦀 Shared <a href="https://oxc.rs/docs/guide/usage/linter">Oxlint</a> configs used in all ver0 projects.</p>
11
+ <p>🦀 A modular Oxlint configuration used across all ver0 projects</p>
11
12
 
12
13
  </div>
13
14
 
14
- The oxlint counterpart of [`@ver0/eslint-config`](https://github.com/ver0-project/eslint-config) for the VoidZero
15
- stack (Vite+, Oxc). Rule sets are ported from the ESLint configs (XO-based) with everything mapped to oxlint's native
16
- Rust implementations — no JS plugins, no plugin peer dependencies.
15
+ ## What's Included
17
16
 
18
- ## Installation
17
+ A collection of modular [Oxlint](https://oxc.rs/docs/guide/usage/linter) configs — the
18
+ [`@ver0/eslint-config`](https://github.com/ver0-project/eslint-config) counterpart for the VoidZero stack (Vite+,
19
+ Oxc). Import only what you need and compose via `extends`.
20
+
21
+ - **JavaScript** — base rules plus `unicorn`, `import`, and `promise` plugins
22
+ - **TypeScript** — TypeScript rules with type-aware linting
23
+ - **React** — React and hooks rules
24
+ - **Node.js** — Node globals and `node` plugin rules
25
+ - **Browser** — browser globals and restricted globals
26
+ - **Vitest** — test file rules
27
+
28
+ Every rule is implemented natively in Rust inside the oxlint binary — configs need **no plugin dependencies** at all.
29
+
30
+ ## 🚀 Installation
19
31
 
20
32
  ```bash
21
33
  vp add -D @ver0/oxlint-config
22
34
  ```
23
35
 
24
- The `oxlint` package itself is optionalVite+ (`vp lint`) ships the linter; standalone usage requires it.
36
+ Under Vite+ that is all — `vp lint` ships the linter. Standalone usage additionally requires the `oxlint` package:
25
37
 
26
- ## Usage
38
+ ```bash
39
+ npm install -D oxlint @ver0/oxlint-config
40
+ ```
27
41
 
28
- Shared configs are consumed via `oxlint.config.ts` (or the `lint` block of `vite.config.ts` in Vite+ projects) — the
29
- JSON config format (`.oxlintrc.json`) does not resolve npm packages in `extends`. Pick the modules matching the
30
- project:
42
+ ## 📖 Usage
43
+
44
+ Compose the configs you need in `oxlint.config.ts` via `extends`:
31
45
 
32
46
  ```ts
47
+ // oxlint.config.ts
33
48
  import {defineConfig} from 'oxlint';
34
49
  import javascript from '@ver0/oxlint-config/javascript.js';
35
50
  import typescript from '@ver0/oxlint-config/typescript.js';
@@ -41,33 +56,129 @@ export default defineConfig({
41
56
  });
42
57
  ```
43
58
 
44
- ## Configs
59
+ In Vite+ projects the same objects go into the `lint` block of `vite.config.ts`:
60
+
61
+ ```ts
62
+ // vite.config.ts
63
+ import {defineConfig} from 'vite-plus';
64
+ import javascript from '@ver0/oxlint-config/javascript.js';
65
+ import node from '@ver0/oxlint-config/node.js';
66
+
67
+ export default defineConfig({
68
+ lint: {
69
+ extends: [javascript, node],
70
+ },
71
+ });
72
+ ```
73
+
74
+ > **Note:** shared configs require the TS config format — `.oxlintrc.json` cannot resolve npm packages in `extends`.
75
+
76
+ ## 📦 Available Configs
77
+
78
+ Each config is a standalone module scoped to its own file globs. Import it to enable, skip it to disable — no options,
79
+ no per-config dependencies.
45
80
 
46
- | Module | Applies to | Contents |
47
- | --------------- | ---------- | ---------------------------------------------------------------------- |
48
- | `javascript.js` | `*.js(x)` | ESLint core + `unicorn`, `import`, `promise` rules |
49
- | `typescript.js` | `*.ts(x)` | JS rule set + `typescript` rules, type-aware rules included |
50
- | `react.js` | JS + TS | `react` and `react-hooks` rules |
51
- | `node.js` | JS + TS | Node.js environment, globals and `node` rules (ESM flavor) |
52
- | `browser.js` | JS + TS | Browser environment plus `no-restricted-globals` for confusing globals |
53
- | `vitest.js` | `*.test.*` | `vitest` plugin rules for test files |
81
+ - **JavaScript** (`javascript.js`) base rules for `*.js(x)` files: ESLint core plus `unicorn`, `import`, and
82
+ `promise` rules. Always include this one — other configs build on top of it.
54
83
 
55
- `typescript.js` additionally exports `typescriptUnsafe` that disables strict `no-unsafe-*` type-safety rules.
84
+ - **TypeScript** (`typescript.js`) the JS rule set plus `typescript` rules for `*.ts(x)` files. Enables type-aware
85
+ linting — see [Type-aware linting](#type-aware-linting). Also exports `typescriptUnsafe` to disable strict
86
+ `no-unsafe-*` type-safety rules:
87
+
88
+ ```ts
89
+ import typescript, {typescriptUnsafe} from '@ver0/oxlint-config/typescript.js';
90
+
91
+ export default defineConfig({
92
+ extends: [typescript, typescriptUnsafe],
93
+ });
94
+ ```
95
+
96
+ - **React** (`react.js`) — React and hooks rules. Stylistic JSX rules are intentionally absent — that is oxfmt's job.
97
+
98
+ - **Node.js** (`node.js`) — Node.js environment and globals (ESM flavor — CJS globals like `require` and `__dirname`
99
+ are disallowed) plus `node` plugin rules.
100
+
101
+ - **Browser** (`browser.js`) — browser environment and globals, restricts confusing globals like `event`, `name`,
102
+ `location` shadowing.
103
+
104
+ - **Vitest** (`vitest.js`) — rules for test and benchmark files (`*.test.*`, `*.benchmark.*`).
56
105
 
57
106
  ### Type-aware linting
58
107
 
59
- `typescript.js` enables `typeAware` and includes rules that need type information. They require
108
+ `typescript.js` turns on `typeAware` and includes rules that need type information. They require
60
109
  [`oxlint-tsgolint`](https://github.com/oxc-project/tsgolint):
61
110
 
62
111
  ```bash
63
112
  vp add -D oxlint-tsgolint
64
113
  ```
65
114
 
66
- Without it, disable type-aware mode in the consuming config: `options: {typeAware: false}`.
115
+ Not ready for type-aware linting? Disable it in the consuming config:
116
+
117
+ ```ts
118
+ export default defineConfig({
119
+ extends: [javascript, typescript],
120
+ options: {typeAware: false},
121
+ });
122
+ ```
123
+
124
+ ## 🌟 Common Configurations
67
125
 
68
- ## Scope
126
+ **Node.js API project:**
69
127
 
70
- This package covers only what oxlint lints natively. Svelte template rules, JSON and Markdown linting stay with
71
- [`@ver0/eslint-config`](https://github.com/ver0-project/eslint-config) — oxlint only lints `<script>` blocks of
72
- `.svelte` files. Formatting is [oxfmt](https://oxc.rs/docs/guide/usage/formatter)'s job — stylistic rules are
73
- deliberately absent.
128
+ ```ts
129
+ // oxlint.config.ts
130
+ import {defineConfig} from 'oxlint';
131
+ import javascript from '@ver0/oxlint-config/javascript.js';
132
+ import typescript from '@ver0/oxlint-config/typescript.js';
133
+ import node from '@ver0/oxlint-config/node.js';
134
+ import vitest from '@ver0/oxlint-config/vitest.js';
135
+
136
+ export default defineConfig({
137
+ extends: [javascript, typescript, node, vitest],
138
+ });
139
+ ```
140
+
141
+ **React web application:**
142
+
143
+ ```ts
144
+ // oxlint.config.ts
145
+ import {defineConfig} from 'oxlint';
146
+ import javascript from '@ver0/oxlint-config/javascript.js';
147
+ import typescript from '@ver0/oxlint-config/typescript.js';
148
+ import react from '@ver0/oxlint-config/react.js';
149
+ import browser from '@ver0/oxlint-config/browser.js';
150
+ import vitest from '@ver0/oxlint-config/vitest.js';
151
+
152
+ export default defineConfig({
153
+ extends: [javascript, typescript, react, browser, vitest],
154
+ });
155
+ ```
156
+
157
+ ## 🔬 Relationship to @ver0/eslint-config
158
+
159
+ This package covers what oxlint lints natively. The rest stays with
160
+ [`@ver0/eslint-config`](https://github.com/ver0-project/eslint-config):
161
+
162
+ - **Svelte** — oxlint only lints `<script>` blocks of `.svelte` files; template and runes rules need
163
+ `eslint-plugin-svelte`
164
+ - **JSON / Markdown** — not oxlint's domain
165
+ - **Formatting** — [oxfmt](https://oxc.rs/docs/guide/usage/formatter) replaces Prettier entirely; stylistic lint rules
166
+ are deliberately absent from these configs
167
+
168
+ ## 🛠️ Troubleshooting
169
+
170
+ **Rules conflicting with your existing setup?** Rules defined next to `extends` win over the extended configs:
171
+
172
+ ```ts
173
+ // oxlint.config.ts
174
+ import {defineConfig} from 'oxlint';
175
+ import javascript from '@ver0/oxlint-config/javascript.js';
176
+ import node from '@ver0/oxlint-config/node.js';
177
+
178
+ export default defineConfig({
179
+ extends: [javascript, node],
180
+ rules: {
181
+ 'some-rule': 'off', // Override any rule
182
+ },
183
+ });
184
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ver0/oxlint-config",
3
- "version": "0.0.1",
3
+ "version": "1.0.0",
4
4
  "description": "Oxlint configs used in all ver0 projects",
5
5
  "keywords": [
6
6
  "config",