Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pkgs/configs/eslint.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ const p11tGroups = {
};
export function buildIgnoreConfig(gitignore, extra) {
return [
includeIgnoreFile(gitignore, "Imported .gitignore patterns"),
includeIgnoreFile(gitignore),
globalIgnores([
...GLOB_IGNORES,
...extra,
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@ export default defineConfig(
Disable rules in the `dom` preset.
- `disable-web-api`\
Disable rules in the `web-api` preset.
- `disable-experimental`\
Disable rules that have an "🧪 Experimental" feature flag.
- `disable-type-checked`\
Disable rules that require type information.
- `disable-conflict-eslint-plugin-react`\
Expand Down
4 changes: 3 additions & 1 deletion apps/website/content/docs/presets.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ The following presets are available in `@eslint-react/eslint-plugin`:
## General Purpose

- `recommended`\
Enforce rules that are recommended by ESLint React for general purpose React + React DOM projects.\
Enforce rules that are recommended by ESLint React for general-purpose React + React DOM projects.\
_This preset includes the `x`, `dom`, and `web-api` presets._

- `strict`\
Expand Down Expand Up @@ -44,6 +44,8 @@ The following presets are available in `@eslint-react/eslint-plugin`:
Disable rules in the `dom` preset.
- `disable-web-api`\
Disable rules in the `web-api` preset.
- `disable-experimental`\
Disable rules that have an "🧪 Experimental" feature flag.
- `disable-type-checked`\
Disable rules that require type information.
- `disable-conflict-eslint-plugin-react`\
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import type { RuleConfig } from "@eslint-react/shared";

export const name = "react-x/disable-experimental";

export const rules: Record<string, RuleConfig> = {
"react-x/jsx-key-before-spread": "off",
"react-x/jsx-no-iife": "off",
"react-x/no-duplicate-key": "off",
"react-x/no-implicit-key": "off",
"react-x/no-misused-capture-owner-stack": "off",
"react-x/no-unnecessary-key": "off",
"react-x/no-unnecessary-use-callback": "off",
"react-x/no-unnecessary-use-memo": "off",
"react-x/no-unnecessary-use-ref": "off",
"react-x/no-unused-props": "off",
"react-x/prefer-read-only-props": "off",
};
27 changes: 18 additions & 9 deletions packages/plugins/eslint-plugin-react-x/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* eslint-disable perfectionist/sort-objects */
import { getConfigAdapters } from "@eslint-react/shared";

import * as disableExperimentalConfig from "./configs/disable-experimental";
import * as disableTypeCheckedConfig from "./configs/disable-type-checked";
import * as recommendedConfig from "./configs/recommended";
import * as recommendedTypeCheckedConfig from "./configs/recommended-type-checked";
import * as recommendedTypeScriptConfig from "./configs/recommended-typescript";
Expand All @@ -16,28 +17,36 @@ export default {
...plugin,
configs: {
/**
* Enforce rules that are recommended by ESLint React for general purpose React + React DOM projects
* Disable experimental rules that might be subject to change in the future
*/
["recommended"]: toFlatConfig(recommendedConfig),
["disable-experimental"]: toFlatConfig(disableExperimentalConfig),
/**
* Same as the `recommended` preset but disables rules that can be enforced by TypeScript
* Disable rules that can be enforced by TypeScript
*/
["recommended-typescript"]: toFlatConfig(recommendedTypeScriptConfig),
["disable-type-checked"]: toFlatConfig(disableTypeCheckedConfig),
/**
* Enforce rules that are recommended by ESLint React for general purpose React + React DOM projects
*/
["recommended"]: toFlatConfig(recommendedConfig),
/**
* Same as the `recommended-typescript` preset but enables additional rules that require type information
*/
["recommended-type-checked"]: toFlatConfig(recommendedTypeCheckedConfig),
/**
* More strict version of the `recommended` preset
* Same as the `recommended` preset but disables rules that can be enforced by TypeScript
*/
["strict"]: toFlatConfig(strictConfig),
["recommended-typescript"]: toFlatConfig(recommendedTypeScriptConfig),
/**
* Same as the `strict` preset but enables additional rules that require type information
* More strict version of the `recommended` preset
*/
["strict-typescript"]: toFlatConfig(strictTypeScriptConfig),
["strict"]: toFlatConfig(strictConfig),
/**
* Same as the `strict-typescript` preset but enables additional rules that require type information
*/
["strict-type-checked"]: toFlatConfig(strictTypeCheckedConfig),
/**
* Same as the `strict` preset but disables rules that can be enforced by TypeScript
*/
["strict-typescript"]: toFlatConfig(strictTypeScriptConfig),
},
};
2 changes: 2 additions & 0 deletions packages/plugins/eslint-plugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@ export default defineConfig(
Disable rules in the `dom` preset.
- `disable-web-api`\
Disable rules in the `web-api` preset.
- `disable-experimental`\
Disable rules that have an "🧪 Experimental" feature flag.
- `disable-type-checked`\
Disable rules that require type information.
- `disable-conflict-eslint-plugin-react`\
Expand Down
17 changes: 17 additions & 0 deletions packages/plugins/eslint-plugin/src/configs/disable-experimental.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import type { RuleConfig } from "@eslint-react/shared";

export const name = "@eslint-react/disable-experimental";

export const rules: Record<string, RuleConfig> = {
"@eslint-react/jsx-key-before-spread": "off",
"@eslint-react/jsx-no-iife": "off",
"@eslint-react/no-duplicate-key": "off",
"@eslint-react/no-implicit-key": "off",
"@eslint-react/no-misused-capture-owner-stack": "off",
"@eslint-react/no-unnecessary-key": "off",
"@eslint-react/no-unnecessary-use-callback": "off",
"@eslint-react/no-unnecessary-use-memo": "off",
"@eslint-react/no-unnecessary-use-ref": "off",
"@eslint-react/no-unused-props": "off",
"@eslint-react/prefer-read-only-props": "off",
};
3 changes: 3 additions & 0 deletions packages/plugins/eslint-plugin/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import react from "eslint-plugin-react-x";
import * as allConfig from "./configs/all";
import * as disableConflictEslintPluginReact from "./configs/disable-conflict-eslint-plugin-react";
import * as disableDomConfig from "./configs/disable-dom";
import * as disableExperimentalConfig from "./configs/disable-experimental";
import * as disableTypeCheckedConfig from "./configs/disable-type-checked";
import * as disableWebApiConfig from "./configs/disable-web-api";
import * as domConfig from "./configs/dom";
Expand All @@ -24,6 +25,7 @@ type ConfigName =
| "all"
| "disable-conflict-eslint-plugin-react"
| "disable-dom"
| "disable-experimental"
| "disable-type-checked"
| "disable-web-api"
| "dom"
Expand Down Expand Up @@ -53,6 +55,7 @@ const plugin: CompatiblePlugin & {
["all"]: allConfig,
["disable-conflict-eslint-plugin-react"]: disableConflictEslintPluginReact,
["disable-dom"]: disableDomConfig,
["disable-experimental"]: disableExperimentalConfig,
["disable-type-checked"]: disableTypeCheckedConfig,
["disable-web-api"]: disableWebApiConfig,
["dom"]: domConfig,
Expand Down
Loading
Loading