@tofrankie/eslint 0.0.18 → 0.0.20

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/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # Changelog
2
2
 
3
+ ## eslint@0.0.20 (2026-04-07)
4
+
5
+ - Refactor `defineConfig()` (layered options, presets, and post-antfu patches)
6
+ - Temporarily default JSDoc to antfu-managed mode
7
+ - Disable built-in formatter integrations by default
8
+ - Remove the `OptionsConfig` type export from this package
9
+ - Re-export the full public API of `@antfu/eslint-config`
10
+ - Declare antfu optional integration plugins as direct `dependencies`
11
+ - Export `MINIPROGRAM_LANGUAGE_OPTIONS` for WeChat miniprogram globals
12
+ - Set `style/operator-linebreak` to `['error', 'after', { overrides: { '?': 'before', ':': 'before' } }]`
13
+ - Expand documentation and the Vitest-based test suite
14
+ - Miscellaneous bug fixes
15
+
16
+ ## eslint@0.0.19 (2026-04-04)
17
+
18
+ - Update `@antfu/eslint-config` to `v8.0.0`
19
+ - Update `@eslint-react/eslint-plugin` to `v4.2.3`
20
+ - Update `eslint-plugin-jsdoc` to `^62.9.0`
21
+ - Remove `eslint-plugin-react-hooks` from `dependencies`
22
+
3
23
  ## eslint@0.0.18 (2026-04-04)
4
24
 
5
25
  - Update documentation
package/README.md CHANGED
@@ -2,11 +2,17 @@
2
2
 
3
3
  ![npm version](https://img.shields.io/npm/v/@tofrankie/eslint) ![node version](https://img.shields.io/node/v/@tofrankie/eslint) ![npm package license](https://img.shields.io/npm/l/@tofrankie/eslint) ![npm last update](https://img.shields.io/npm/last-update/@tofrankie/eslint)
4
4
 
5
- A shared ESLint configuration built on [@antfu/eslint-config](https://github.com/antfu/eslint-config), with opinionated presets.
5
+ Shared [ESLint](https://eslint.org/) configuration built on [@antfu/eslint-config](https://github.com/antfu/eslint-config).
6
6
 
7
7
  > [!IMPORTANT]
8
8
  > Before 1.0.0, releases may include breaking changes. Read the [CHANGELOG](CHANGELOG.md) before upgrading.
9
9
 
10
+ ## Requirements
11
+
12
+ - Node.js >= 20
13
+ - ESLint >= 9.10.0
14
+ - Flat config only
15
+
10
16
  ## Quick Start
11
17
 
12
18
  Install dependencies:
@@ -15,7 +21,7 @@ Install dependencies:
15
21
  $ pnpm add eslint @tofrankie/eslint -D
16
22
  ```
17
23
 
18
- Create an `eslint.config.js` in your project root:
24
+ ESM (`eslint.config.mjs`):
19
25
 
20
26
  ```js
21
27
  import { defineConfig } from '@tofrankie/eslint'
@@ -23,54 +29,125 @@ import { defineConfig } from '@tofrankie/eslint'
23
29
  export default defineConfig()
24
30
  ```
25
31
 
26
- **Customization:** [antfu/eslint-config](https://github.com/antfu/eslint-config#customization)
32
+ CJS (`eslint.config.cjs`):
33
+
34
+ ```js
35
+ const { defineConfig } = require('@tofrankie/eslint')
36
+
37
+ module.exports = defineConfig()
38
+ ```
39
+
40
+ ## Configuration
41
+
42
+ `defineConfig(antfuOptions?, ...flatConfigItems)` mirrors [@antfu/eslint-config usage](https://github.com/antfu/eslint-config#customization): the first argument is antfu-style options (integrations, `rules`, etc.); rest arguments are extra flat config items appended after the generated stack.
27
43
 
28
44
  ```js
29
45
  import { defineConfig } from '@tofrankie/eslint'
30
46
 
31
47
  export default defineConfig(
32
48
  {
33
- // antfu options...
34
- ignores: ['node_modules', 'dist'],
35
49
  typescript: true,
36
50
  react: true,
37
- rules: {
38
- // user's custom rules...
39
- 'no-console': 'off',
40
- },
41
51
  },
42
52
  {
43
- // user's eslint flat configs...
53
+ // additional flat config item
44
54
  }
45
55
  )
46
56
  ```
47
57
 
48
- ## Examples
58
+ - The first argument uses antfu-compatible options.
59
+ - User `rules` in the first argument follow antfu's fused-config semantics and stay ahead of any extra flat configs passed in the rest arguments.
60
+
61
+ > `@tofrankie/eslint` already ships the plugin dependencies behind antfu's renamed rule prefixes. In normal usage you do not need to install those ESLint plugins again in your project. Enable the corresponding antfu options as needed, such as `typescript`, `vue`, `react`, `test`, or `formatters`.
49
62
 
50
- ### Native Miniprogram
63
+ ### Integration `overrides` vs global `rules`
64
+
65
+ Prefer per-integration `overrides` when a rule belongs to a specific stack (correct file globs and plugin context). Use top-level `rules` only for truly global tweaks; that layer is not scoped to integration file patterns.
51
66
 
52
67
  ```js
53
68
  import { defineConfig } from '@tofrankie/eslint'
54
69
 
55
- export default defineConfig(
56
- {
57
- ignores: ['project.config.json', 'project.private.config.json'],
58
- // other antfu options...
70
+ export default defineConfig({
71
+ vue: {
72
+ overrides: {
73
+ 'vue/operator-linebreak': ['error', 'before'],
74
+ },
59
75
  },
60
- {
61
- languageOptions: {
62
- globals: {
63
- wx: true,
64
- App: true,
65
- getApp: true,
66
- getCurrentPages: true,
67
- Page: true,
68
- Component: true,
69
- Behavior: true,
70
- requireMiniProgram: true,
71
- requirePlugin: true,
72
- },
76
+ typescript: {
77
+ overrides: {
78
+ 'ts/consistent-type-definitions': ['error', 'interface'],
73
79
  },
74
- }
80
+ },
81
+ })
82
+ ```
83
+
84
+ ```js
85
+ export default defineConfig({
86
+ rules: { 'no-console': 'off' },
87
+ })
88
+ ```
89
+
90
+ ## TypeScript
91
+
92
+ Activation follows antfu: when `typescript` is left unset, support turns on if a `typescript` package is present. Set `typescript: false` for JS-only repos that still install TypeScript for tooling.
93
+
94
+ Type-aware rules need `typescript.tsconfigPath` (stricter, slower, requires a valid `tsconfig.json`). With React enabled, React type-aware rules follow the same gate.
95
+
96
+ ```js
97
+ export default defineConfig({
98
+ typescript: { tsconfigPath: 'tsconfig.json' },
99
+ })
100
+ ```
101
+
102
+ ## Formatters
103
+
104
+ @antfu/eslint-config can wire formatters (CSS, HTML, Markdown, GraphQL, Astro, etc.). **This preset disables those integrations by default** so ESLint does not duplicate work when you already use Prettier (and optionally Stylelint). Defaults still include a `formatters.prettierOptions` base aligned with `@tofrankie/prettier`; it applies once you turn formatters on.
105
+
106
+ Behavior:
107
+
108
+ - `formatters: false` — all formatter integrations off
109
+ - `formatters: true` — enables the same subset as antfu's boolean shortcut (`css`, `html`, `markdown`, `graphql`), merged with the built-in `prettierOptions` base
110
+ - `formatters: { ... }` — deep-merged with the preset defaults (individual flags off until you set them)
111
+
112
+ ```js
113
+ export default defineConfig({
114
+ formatters: {
115
+ html: true,
116
+ markdown: true,
117
+ prettierOptions: { printWidth: 100 },
118
+ },
119
+ })
120
+ ```
121
+
122
+ <!--
123
+ ## JSDoc
124
+
125
+ JSDoc stays on antfu's built-in integration; this package layers rule and settings overrides without registering the `jsdoc` plugin twice. Details: [JSDoc strategy](./docs/jsdoc-strategy.md).
126
+ -->
127
+
128
+ ## Unused variables
129
+
130
+ With default options:
131
+
132
+ - `.js` — `unused-imports/no-unused-vars`
133
+ - `.ts` — `ts/no-unused-vars`
134
+ - Vue SFCs with TypeScript `<script>` — `ts/no-unused-vars`
135
+
136
+ ## WeChat miniprogram
137
+
138
+ `MINIPROGRAM_LANGUAGE_OPTIONS` exposes common miniprogram globals for an extra flat item:
139
+
140
+ ```js
141
+ import { defineConfig, MINIPROGRAM_LANGUAGE_OPTIONS } from '@tofrankie/eslint'
142
+
143
+ export default defineConfig(
144
+ { ignores: ['project.config.json', 'project.private.config.json'] },
145
+ { languageOptions: MINIPROGRAM_LANGUAGE_OPTIONS }
75
146
  )
76
147
  ```
148
+
149
+ ## Acknowledgements
150
+
151
+ Thanks to these referenced packages:
152
+
153
+ - [`@antfu/eslint-config`](https://github.com/antfu/eslint-config)