Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
210 changes: 105 additions & 105 deletions apps/website/content/docs/migration.mdx

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions apps/website/content/docs/presets.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ The following presets are available in `@eslint-react/eslint-plugin`:
- `recommended-type-checked`\
Same as the `recommended-typescript` preset but enables additional rules that require type information.

### Combined

- `no-deprecated`\
Enable all non-deprecated rules from the `x`, `dom`, and `web-api` presets.\
_This preset sets the severity of these rules to `"error"`._

## Other

- `disable-dom`\
Expand Down
4 changes: 2 additions & 2 deletions packages/plugins/eslint-plugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@ ESLint React is not affiliated with Meta Corporation or [facebook/react](https:/

Contributions are welcome!

Please follow our [contributing guidelines](https://github.com/Rel1cx/eslint-react/tree/main/.github/CONTRIBUTING.md).
Please follow our [contributing guidelines](https://github.com/Rel1cx/eslint-react/tree/add-no-deprecated-preset/.github/CONTRIBUTING.md).

## License

This project is licensed under the MIT License - see the [LICENSE](https://github.com/Rel1cx/eslint-react/tree/main/LICENSE) file for details.
This project is licensed under the MIT License - see the [LICENSE](https://github.com/Rel1cx/eslint-react/tree/add-no-deprecated-preset/LICENSE) file for details.
2 changes: 1 addition & 1 deletion packages/plugins/eslint-plugin/src/configs/all.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,5 +116,5 @@ export const plugins = {
};

export const settings = {
...dom.settings,
...x.settings,
};
5 changes: 0 additions & 5 deletions packages/plugins/eslint-plugin/src/configs/dom.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type { RuleConfig } from "@eslint-react/kit";
import { DEFAULT_ESLINT_REACT_SETTINGS } from "@eslint-react/shared";
import reactDom from "eslint-plugin-react-dom";

export const name = "@eslint-react/dom";
Expand All @@ -25,7 +24,3 @@ export const rules = {
export const plugins = {
"@eslint-react/dom": reactDom,
};

export const settings = {
"react-x": DEFAULT_ESLINT_REACT_SETTINGS,
};
24 changes: 24 additions & 0 deletions packages/plugins/eslint-plugin/src/configs/no-deprecated.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import type { RuleConfig } from "@eslint-react/kit";

import * as dom from "./dom";
import * as x from "./x";

export const name = "@eslint-react/no-deprecated";

export const rules = {
"@eslint-react/no-component-will-mount": "error",
"@eslint-react/no-component-will-receive-props": "error",
"@eslint-react/no-component-will-update": "error",
"@eslint-react/no-create-ref": "error",
"@eslint-react/no-forward-ref": "error",

"@eslint-react/dom/no-find-dom-node": "error",
"@eslint-react/dom/no-hydrate": "error",
"@eslint-react/dom/no-render": "error",
"@eslint-react/dom/no-render-return-value": "error",
} as const satisfies Record<string, RuleConfig>;

export const plugins = {
...x.plugins,
...dom.plugins,
};
2 changes: 1 addition & 1 deletion packages/plugins/eslint-plugin/src/configs/recommended.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ export const plugins = {
};

export const settings = {
...dom.settings,
...x.settings,
};
4 changes: 2 additions & 2 deletions packages/plugins/eslint-plugin/src/configs/web-api.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { RuleConfig } from "@eslint-react/kit";
import reactWebApi from "eslint-plugin-react-web-api";

import * as dom from "./dom";
import * as x from "./x";

export const name = "@eslint-react/web-api";

Expand All @@ -17,5 +17,5 @@ export const plugins = {
};

export const settings = {
...dom.settings,
...x.settings,
};
49 changes: 48 additions & 1 deletion packages/plugins/eslint-plugin/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { name, version } from "../package.json";

import type { CompatiblePlugin } from "@eslint-react/kit";
import reactDebug from "eslint-plugin-react-debug";
import reactDom from "eslint-plugin-react-dom";
Expand All @@ -6,7 +8,6 @@ import reactNamingConvention from "eslint-plugin-react-naming-convention";
import reactWebApi from "eslint-plugin-react-web-api";
import react from "eslint-plugin-react-x";

import { name, version } from "../package.json";
import * as allConfig from "./configs/all";
import * as debugConfig from "./configs/debug";
import * as disableConflictEslintPluginReact from "./configs/disable-conflict-eslint-plugin-react";
Expand All @@ -15,6 +16,7 @@ import * as disableDomConfig from "./configs/disable-dom";
import * as disableTypeCheckedConfig from "./configs/disable-type-checked";
import * as disableWebApiConfig from "./configs/disable-web-api";
import * as domConfig from "./configs/dom";
import * as noDeprecatedConfig from "./configs/no-deprecated";
import * as offConfig from "./configs/off";
import * as recommendedConfig from "./configs/recommended";
import * as recommendedTypeCheckedConfig from "./configs/recommended-type-checked";
Expand All @@ -40,18 +42,63 @@ const plugin: CompatiblePlugin = {
export default {
...plugin,
configs: {
/**
* Enable all rules in this plugin
*/
["all"]: allConfig,
/**
* Enable debug rules
*/
["debug"]: debugConfig,
/**
* Disable rules in `eslint-plugin-react` that conflict with rules in our plugins
*/
["disable-conflict-eslint-plugin-react"]: disableConflictEslintPluginReact,
/**
* Disable debug rules
*/
["disable-debug"]: disableDebugConfig,
/**
* Disable rules in the `dom` preset
*/
["disable-dom"]: disableDomConfig,
/**
* Disable rules that require type information
*/
["disable-type-checked"]: disableTypeCheckedConfig,
/**
* Disable rules in the `web-api` preset
*/
["disable-web-api"]: disableWebApiConfig,
/**
* Enable rules for `"react-dom"`
*/
["dom"]: domConfig,
/**
* Enable all non-deprecated rules from the `x`, `dom`, and `web-api` presets
* This preset sets the severity of these rules to `"error"`
*/
["no-deprecated"]: noDeprecatedConfig,
/**
* Disable all rules in this plugin except for debug rules
*/
["off"]: offConfig,
/**
* 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
*/
["recommended"]: recommendedConfig,
/**
* Same as the `recommended-typescript` preset but enables additional rules that require type information
*/
["recommended-type-checked"]: recommendedTypeCheckedConfig,
/**
* Same as the `recommended` preset but disables rules that can be enforced by TypeScript
*/
["recommended-typescript"]: recommendedTypeScriptConfig,
/**
* Enable rules for `"react"`
*/
["x"]: xConfig,
},
};