@configg/oxc 0.1.6 → 0.1.7

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 (3) hide show
  1. package/README.md +13 -4
  2. package/package.json +1 -1
  3. package/src/lint.ts +28 -23
package/README.md CHANGED
@@ -40,10 +40,19 @@ export default defineConfig(configs.client)
40
40
  - `client`: browser env, type-aware, with rules relaxed for component code. Its `**/*.spec.{ts,tsx}` override enables the Vitest env and Testing Library rules, so it needs `eslint-plugin-testing-library`.
41
41
  - `scripts`: Node env, type-aware, for tooling and config files.
42
42
 
43
- Both Oxlint presets include all 18 rules from the vendored [anti-slop](https://github.com/dmmulroy/anti-slop) plugin.
44
- See [UPSTREAM.md](./src/anti-slop/UPSTREAM.md) for its source and update policy.
45
- `unicorn/prefer-reflect-apply` is off because anti-slop forbids `Reflect.apply`.
46
- The plugin ships as TypeScript, so run oxlint under Bun (`bunx --bun oxlint`): Node refuses to strip types from files in `node_modules`.
43
+ The Oxlint presets don't enable anti-slop. `antiSlop` from `@configg/oxc/lint` is an opt-in set with the plugin and all 18 rules as errors; `unicorn/prefer-reflect-apply` is off. See [UPSTREAM.md](./src/anti-slop/UPSTREAM.md) for its source and update policy.
44
+
45
+ ```ts
46
+ import { antiSlop, configs } from '@configg/oxc/lint'
47
+
48
+ export default defineConfig({
49
+ ...configs.client,
50
+ jsPlugins: [...antiSlop.jsPlugins],
51
+ rules: { ...configs.client.rules, ...antiSlop.rules },
52
+ })
53
+ ```
54
+
55
+ If your config has its own `jsPlugins`, keep the anti-slop entry in that array. The plugin ships as TypeScript, so run oxlint under Bun (`bunx --bun oxlint`): Node refuses to strip types from files in `node_modules`.
47
56
 
48
57
  Both presets allow up to two classes per file, allow `reduce()`, allow `process.exit()` (CLI scripts and
49
58
  shutdown handlers exit with a status code on purpose) and allow short identifiers (`eslint/id-length` is off). They turn `import/prefer-default-export` off, since named
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@configg/oxc",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "oxfmt and oxlint presets",
5
5
  "keywords": [
6
6
  "config",
package/src/lint.ts CHANGED
@@ -1,26 +1,8 @@
1
1
  import type { OxlintConfig } from 'oxlint'
2
2
 
3
- const antiSlop = { name: 'anti-slop', specifier: `${import.meta.dirname}/anti-slop/index.ts` }
3
+ const antiSlopPlugin = { name: 'anti-slop', specifier: `${import.meta.dirname}/anti-slop/index.ts` }
4
4
 
5
5
  const sharedRules = {
6
- 'anti-slop/no-array-filter-map': 'error',
7
- 'anti-slop/no-chained-type-assertions': 'error',
8
- 'anti-slop/no-conditional-empty-object-spread': 'error',
9
- 'anti-slop/no-known-value-widening': 'error',
10
- 'anti-slop/no-module-mocking': 'error',
11
- 'anti-slop/no-object-parameters': 'error',
12
- 'anti-slop/no-reduce-accumulator-copy': 'error',
13
- 'anti-slop/no-reflect-apply': 'error',
14
- 'anti-slop/no-reflect-get': 'error',
15
- 'anti-slop/no-runtime-typeof': 'error',
16
- 'anti-slop/no-shape-in-symbol-names': 'error',
17
- 'anti-slop/no-unknown-parameters': 'error',
18
- 'anti-slop/no-unknown-returns': 'error',
19
- 'anti-slop/no-unknown-type-aliases': 'error',
20
- 'anti-slop/no-unsafe-dictionary-type': 'error',
21
- 'anti-slop/no-widen-then-assert': 'error',
22
- 'anti-slop/require-readable-spacing': 'error',
23
- 'anti-slop/require-safety-comment-for-type-assertion': 'error',
24
6
  'eslint/id-length': 'off',
25
7
  'eslint/max-classes-per-file': ['warn', { max: 2 }],
26
8
  'eslint/max-lines-per-function': ['warn', { max: 100, skipBlankLines: true, skipComments: true }],
@@ -40,10 +22,35 @@ const sharedRules = {
40
22
  'unicorn/no-process-exit': 'off',
41
23
  // Oxfmt and Prettier write hex digits in lowercase; this rule wants uppercase and takes no option.
42
24
  'unicorn/number-literal-case': 'off',
43
- // This pushes toward Reflect.apply, which anti-slop/no-reflect-apply forbids.
44
- 'unicorn/prefer-reflect-apply': 'off',
45
25
  } as const satisfies OxlintConfig['rules']
46
26
 
27
+ /** Opt in by spreading into a preset. The plugin ships as TypeScript, so run oxlint under Bun. */
28
+ export const antiSlop = {
29
+ jsPlugins: [antiSlopPlugin],
30
+ rules: {
31
+ 'anti-slop/no-array-filter-map': 'error',
32
+ 'anti-slop/no-chained-type-assertions': 'error',
33
+ 'anti-slop/no-conditional-empty-object-spread': 'error',
34
+ 'anti-slop/no-known-value-widening': 'error',
35
+ 'anti-slop/no-module-mocking': 'error',
36
+ 'anti-slop/no-object-parameters': 'error',
37
+ 'anti-slop/no-reduce-accumulator-copy': 'error',
38
+ 'anti-slop/no-reflect-apply': 'error',
39
+ 'anti-slop/no-reflect-get': 'error',
40
+ 'anti-slop/no-runtime-typeof': 'error',
41
+ 'anti-slop/no-shape-in-symbol-names': 'error',
42
+ 'anti-slop/no-unknown-parameters': 'error',
43
+ 'anti-slop/no-unknown-returns': 'error',
44
+ 'anti-slop/no-unknown-type-aliases': 'error',
45
+ 'anti-slop/no-unsafe-dictionary-type': 'error',
46
+ 'anti-slop/no-widen-then-assert': 'error',
47
+ 'anti-slop/require-readable-spacing': 'error',
48
+ 'anti-slop/require-safety-comment-for-type-assertion': 'error',
49
+ // This pushes toward Reflect.apply, which anti-slop/no-reflect-apply forbids.
50
+ 'unicorn/prefer-reflect-apply': 'off',
51
+ },
52
+ } as const satisfies OxlintConfig
53
+
47
54
  export const configs = {
48
55
  client: {
49
56
  categories: {
@@ -59,7 +66,6 @@ export const configs = {
59
66
  browser: true,
60
67
  builtin: true,
61
68
  },
62
- jsPlugins: [antiSlop],
63
69
  options: {
64
70
  typeAware: true,
65
71
  typeCheck: true,
@@ -167,7 +173,6 @@ export const configs = {
167
173
  builtin: true,
168
174
  node: true,
169
175
  },
170
- jsPlugins: [antiSlop],
171
176
  options: {
172
177
  typeAware: true,
173
178
  typeCheck: true,