@eslint-react/kit 4.2.0-beta.3 → 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.
package/README.md CHANGED
@@ -552,47 +552,15 @@ eslintReactKit()
552
552
  import eslintReactKit from "@eslint-react/kit";
553
553
  import type { RuleDefinition } from "@eslint-react/kit";
554
554
 
555
- function functionComponentDefinition(): RuleDefinition {
556
- return (context, { collect }) => {
557
- const { query, visitor } = collect.components(context);
558
- return {
559
- ...visitor,
560
- "Program:exit"(program) {
561
- for (const { name, node } of query.all(program)) {
562
- if (node.type !== "FunctionDeclaration") {
563
- context.report({
564
- node,
565
- message: `Component "${name ?? "(anonymous)"}" must be a function declaration.`,
566
- });
567
- }
568
- }
569
- },
570
- };
571
- };
572
- }
573
-
574
- function version(major = "19"): RuleDefinition {
575
- return (context, { settings }) => ({
576
- Program(program) {
577
- if (!settings.version.startsWith(`${major}.`)) {
578
- context.report({
579
- node: program,
580
- message: `This project requires React ${major}, but detected version ${settings.version}.`,
581
- });
582
- }
583
- },
584
- });
585
- }
586
-
587
555
  // Spread the config into a new object to add or override properties like `files`:
588
556
  export default [
589
557
  {
590
558
  ...eslintReactKit()
591
- .use(functionComponentDefinition)
559
+ .use(noForwardRef);
592
560
  .use(version, "19")
593
561
  .getConfig(),
594
562
  // Override `name` so it shows your own label in config inspector tools
595
- name: "my-app/kit-rules",
563
+ name: "react-custom-rules",
596
564
  // Override `files` to scope the kit rules to specific source files
597
565
  files: ["src/**/*.ts", "src/**/*.tsx"],
598
566
  },
@@ -609,29 +577,6 @@ Use `getPlugin()` when you want full control over the plugin namespace and rule
609
577
  import eslintReactKit from "@eslint-react/kit";
610
578
  import type { RuleDefinition } from "@eslint-react/kit";
611
579
 
612
- function version(major = "19"): RuleDefinition {
613
- return (context, { settings }) => ({
614
- Program(program) {
615
- if (!settings.version.startsWith(`${major}.`)) {
616
- context.report({
617
- node: program,
618
- message: `This project requires React ${major}, but detected version ${settings.version}.`,
619
- });
620
- }
621
- },
622
- });
623
- }
624
-
625
- function noForwardRef(): RuleDefinition {
626
- return (context, { is }) => ({
627
- CallExpression(node) {
628
- if (is.forwardRefCall(node)) {
629
- context.report({ node, message: "forwardRef is deprecated in React 19." });
630
- }
631
- },
632
- });
633
- }
634
-
635
580
  const kit = eslintReactKit()
636
581
  .use(noForwardRef);
637
582
  .use(version, "19")
@@ -644,12 +589,12 @@ export default [
644
589
  files: ["**/*.{ts,tsx}"],
645
590
  plugins: {
646
591
  // Choose your own namespace
647
- react: plugin,
592
+ "react-custom-rules": plugin,
648
593
  },
649
594
  rules: {
650
595
  // Set individual severities
651
- "react/no-forward-ref": "error",
652
- "react/version": "error",
596
+ "react-custom-rules/no-forward-ref": "error",
597
+ "react-custom-rules/version": "error",
653
598
  },
654
599
  },
655
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.3";
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.3",
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.3",
42
- "@eslint-react/core": "4.2.0-beta.3",
43
- "@eslint-react/shared": "4.2.0-beta.3"
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",