@eslint-react/kit 4.2.0-beta.2 → 4.2.1-rc.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 (3) hide show
  1. package/README.md +29 -27
  2. package/dist/index.js +1 -1
  3. package/package.json +4 -4
package/README.md CHANGED
@@ -24,8 +24,8 @@ ESLint React's toolkit for building custom React rules with JavasSript functions
24
24
  - [Component: Destructure component props](#component-destructure-component-props)
25
25
  - [Hooks: Warn on custom hooks that don't call other hooks](#hooks-warn-on-custom-hooks-that-dont-call-other-hooks)
26
26
  - [Multiple Collectors: No component/hook factories](#multiple-collectors-no-componenthook-factories)
27
+ - [Override Config: Using spread syntax with `getConfig`](#Override-config-using-spread-syntax-with-getconfig)
27
28
  - [Advanced Config: Using `getPlugin` for custom plugin namespace](#advanced-config-using-getplugin-for-custom-plugin-namespace)
28
- - [More Examples](#more-examples)
29
29
 
30
30
  ## Installation
31
31
 
@@ -544,36 +544,38 @@ eslintReactKit()
544
544
  .getConfig();
545
545
  ```
546
546
 
547
- ### Advanced Config: Using `getPlugin` for custom plugin namespace
547
+ ### Override Config: Using spread syntax with `getConfig`
548
548
 
549
- Use `getPlugin()` when you want full control over the plugin namespace and rule severities instead of the all-in-one `getConfig()`.
549
+ `getConfig()` returns a plain config object. You can spread it into a new object to override or supplement its properties — for example, to scope the config to specific files or add extra settings alongside your kit rules.
550
550
 
551
551
  ```ts
552
552
  import eslintReactKit from "@eslint-react/kit";
553
553
  import type { RuleDefinition } from "@eslint-react/kit";
554
554
 
555
- function version(major = "19"): RuleDefinition {
556
- return (context, { settings }) => ({
557
- Program(program) {
558
- if (!settings.version.startsWith(`${major}.`)) {
559
- context.report({
560
- node: program,
561
- message: `This project requires React ${major}, but detected version ${settings.version}.`,
562
- });
563
- }
564
- },
565
- });
566
- }
555
+ // Spread the config into a new object to add or override properties like `files`:
556
+ export default [
557
+ {
558
+ ...eslintReactKit()
559
+ .use(noForwardRef);
560
+ .use(version, "19")
561
+ .getConfig(),
562
+ // Override `name` so it shows your own label in config inspector tools
563
+ name: "react-custom-rules",
564
+ // Override `files` to scope the kit rules to specific source files
565
+ files: ["src/**/*.ts", "src/**/*.tsx"],
566
+ },
567
+ ];
568
+ ```
567
569
 
568
- function noForwardRef(): RuleDefinition {
569
- return (context, { is }) => ({
570
- CallExpression(node) {
571
- if (is.forwardRefCall(node)) {
572
- context.report({ node, message: "forwardRef is deprecated in React 19." });
573
- }
574
- },
575
- });
576
- }
570
+ This pattern is especially useful when composing kit configs alongside other ESLint configs (e.g. `typescript-eslint`, `eslint-plugin-react-hooks`) via `defineConfig` — you can nest the spread object inside `extends` arrays and attach shared properties like `files` or `languageOptions` at the same level.
571
+
572
+ ### Advanced Config: Using `getPlugin` for custom plugin namespace
573
+
574
+ Use `getPlugin()` when you want full control over the plugin namespace and rule severities instead of the all-in-one `getConfig()`.
575
+
576
+ ```ts
577
+ import eslintReactKit from "@eslint-react/kit";
578
+ import type { RuleDefinition } from "@eslint-react/kit";
577
579
 
578
580
  const kit = eslintReactKit()
579
581
  .use(noForwardRef);
@@ -587,12 +589,12 @@ export default [
587
589
  files: ["**/*.{ts,tsx}"],
588
590
  plugins: {
589
591
  // Choose your own namespace
590
- react: plugin,
592
+ "react-custom-rules": plugin,
591
593
  },
592
594
  rules: {
593
595
  // Set individual severities
594
- "react/no-forward-ref": "error",
595
- "react/version": "error",
596
+ "react-custom-rules/no-forward-ref": "error",
597
+ "react-custom-rules/version": "error",
596
598
  },
597
599
  },
598
600
  ];
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ import { kebabCase } from "string-ts";
4
4
 
5
5
  //#region package.json
6
6
  var name = "@eslint-react/kit";
7
- var version = "4.2.0-beta.2";
7
+ var version = "4.2.1-rc.0";
8
8
 
9
9
  //#endregion
10
10
  //#region src/index.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eslint-react/kit",
3
- "version": "4.2.0-beta.2",
3
+ "version": "4.2.1-rc.0",
4
4
  "description": "ESLint React's utility module for building custom React rules with JavasSript functions.",
5
5
  "keywords": [
6
6
  "react",
@@ -38,9 +38,9 @@
38
38
  "dependencies": {
39
39
  "@typescript-eslint/utils": "^8.58.0",
40
40
  "string-ts": "^2.3.1",
41
- "@eslint-react/ast": "4.2.0-beta.2",
42
- "@eslint-react/core": "4.2.0-beta.2",
43
- "@eslint-react/shared": "4.2.0-beta.2"
41
+ "@eslint-react/ast": "4.2.1-rc.0",
42
+ "@eslint-react/core": "4.2.1-rc.0",
43
+ "@eslint-react/shared": "4.2.1-rc.0"
44
44
  },
45
45
  "devDependencies": {
46
46
  "eslint": "^10.1.0",