Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
28 changes: 27 additions & 1 deletion packages/plugins/eslint-plugin-react-x/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,43 @@
/* eslint-disable perfectionist/sort-objects */
import { getConfigAdapters } from "@eslint-react/shared";

import * as recommendedConfig from "./configs/recommended";
import * as recommendedTypeCheckedConfig from "./configs/recommended-type-checked";
import * as recommendedTypeScriptConfig from "./configs/recommended-typescript";
import * as strictConfig from "./configs/strict";
import * as strictTypeCheckedConfig from "./configs/strict-type-checked";
import * as strictTypeScriptConfig from "./configs/strict-typescript";

import { plugin } from "./plugin";

const { toFlatConfig } = getConfigAdapters("react-x", plugin);

export default {
...plugin,
configs: {
/**
* Enforce rules that are recommended by ESLint React for general purpose React + React DOM projects
*/
["recommended"]: toFlatConfig(recommendedConfig),
["recommended-type-checked"]: toFlatConfig(recommendedTypeCheckedConfig),
/**
* Same as the `recommended` preset but disables rules that can be enforced by TypeScript
*/
["recommended-typescript"]: toFlatConfig(recommendedTypeScriptConfig),
/**
* 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
*/
["strict"]: toFlatConfig(strictConfig),
/**
* Same as the `strict` preset but enables additional rules that require type information
*/
["strict-typescript"]: toFlatConfig(strictTypeScriptConfig),
/**
* Same as the `strict-typescript` preset but enables additional rules that require type information
*/
["strict-type-checked"]: toFlatConfig(strictTypeCheckedConfig),
},
};
4 changes: 2 additions & 2 deletions packages/plugins/eslint-plugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,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/fix-strict-config-export/.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/fix-strict-config-export/LICENSE) file for details.
16 changes: 13 additions & 3 deletions packages/plugins/eslint-plugin/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ import * as offConfig from "./configs/off";
import * as recommendedConfig from "./configs/recommended";
import * as recommendedTypeCheckedConfig from "./configs/recommended-type-checked";
import * as recommendedTypeScriptConfig from "./configs/recommended-typescript";
import * as strictConfig from "./configs/strict";
import * as strictTypeCheckedConfig from "./configs/strict-type-checked";
import * as strictTypescriptConfig from "./configs/strict-typescript";
import * as webApiConfig from "./configs/web-api";
import * as xConfig from "./configs/x";

import { padKeysLeft } from "./utils";
Expand All @@ -46,7 +48,7 @@ export default {
...plugin,
configs: {
/**
* Enable all rules in this plugin
* Enable all applicable rules from this plugin
*/
["all"]: allConfig,
/**
Expand Down Expand Up @@ -100,13 +102,21 @@ export default {
*/
["recommended-typescript"]: recommendedTypeScriptConfig,
/**
* More strict version of the `recommended-type-checked` preset
* More strict version of the `recommended` preset
*/
["strict"]: strictConfig,
/**
* Same as the `strict-typescript` preset but enables additional rules that require type information
*/
["strict-type-checked"]: strictTypeCheckedConfig,
/**
* More strict version of the `recommended-typescript` preset
* Same as the `strict` preset but disables rules that can be enforced by TypeScript
*/
["strict-typescript"]: strictTypescriptConfig,
/**
* Enable rules for interacting with Web APIs
*/
["web-api"]: webApiConfig,
/**
* Enable rules for `"react"`
*/
Expand Down