@configg/bases 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.
package/README.md CHANGED
@@ -62,10 +62,19 @@ Installing a single package works the same way, for example `@configg/oxc/fmt` a
62
62
  - `oxlint` exports `configs`: `client` (browser env, React, and a `**/*.spec.{ts,tsx}` override with Vitest and Testing Library rules) and `scripts` (Node env).
63
63
  - `tsconfig/bun` (`strictest` + Bun), `tsconfig/vite` (`strictest` + Vite/React) and `tsconfig/client` (`vite` with ambient `types` cleared, so a package only picks up the `@types/*` it asks for).
64
64
 
65
- Both Oxlint presets include all 18 rules from the vendored [anti-slop](https://github.com/dmmulroy/anti-slop) plugin.
66
- See [UPSTREAM.md](./packages/oxc/src/anti-slop/UPSTREAM.md) for its source and update policy.
67
- `unicorn/prefer-reflect-apply` is off because anti-slop forbids `Reflect.apply`.
68
- The plugin ships as TypeScript, so run oxlint under Bun (`bunx --bun oxlint`): Node refuses to strip types from files in `node_modules`.
65
+ The Oxlint presets don't enable anti-slop. `antiSlop` from the oxlint entry is an opt-in set with the plugin and all 18 rules as errors; `unicorn/prefer-reflect-apply` is off. See [UPSTREAM.md](./packages/oxc/src/anti-slop/UPSTREAM.md) for its source and update policy.
66
+
67
+ ```ts
68
+ import { antiSlop, configs } from '@configg/bases/oxlint'
69
+
70
+ export default defineConfig({
71
+ ...configs.client,
72
+ jsPlugins: [...antiSlop.jsPlugins],
73
+ rules: { ...configs.client.rules, ...antiSlop.rules },
74
+ })
75
+ ```
76
+
77
+ 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`.
69
78
 
70
79
  `eslint-plugin-testing-library` is only needed for `configs.client` in the oxlint preset.
71
80
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@configg/bases",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "All @configg presets in one package: oxc and tsconfig",
5
5
  "keywords": [
6
6
  "config",
@@ -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,