|
1 |
| -import { name, version } from "../package.json"; |
2 |
| -import noDangerouslySetInnerHTML from "./rules/no-dangerously-set-innerhtml"; |
3 |
| -import noDangerouslySetInnerHTMLWithChildren from "./rules/no-dangerously-set-innerhtml-with-children"; |
4 |
| -import noFindDomNode from "./rules/no-find-dom-node"; |
5 |
| -import noMissingButtonType from "./rules/no-missing-button-type"; |
6 |
| -import noMissingIframeSandbox from "./rules/no-missing-iframe-sandbox"; |
7 |
| -import noNamespace from "./rules/no-namespace"; |
8 |
| -import noRenderReturnValue from "./rules/no-render-return-value"; |
9 |
| -import noScriptUrl from "./rules/no-script-url"; |
10 |
| -import noUnknownProperty from "./rules/no-unknown-property"; |
11 |
| -import noUnsafeIframeSandbox from "./rules/no-unsafe-iframe-sandbox"; |
12 |
| -import noUnsafeTargetBlank from "./rules/no-unsafe-target-blank"; |
13 |
| -import noVoidElementsWithChildren from "./rules/no-void-elements-with-children"; |
| 1 | +import type { RulePreset } from "@eslint-react/shared"; |
14 | 2 |
|
15 |
| -export default { |
16 |
| - meta: { |
17 |
| - name, |
18 |
| - version, |
19 |
| - }, |
20 |
| - rules: { |
21 |
| - "no-dangerously-set-innerhtml": noDangerouslySetInnerHTML, |
22 |
| - "no-dangerously-set-innerhtml-with-children": noDangerouslySetInnerHTMLWithChildren, |
23 |
| - "no-find-dom-node": noFindDomNode, |
24 |
| - "no-missing-button-type": noMissingButtonType, |
25 |
| - "no-missing-iframe-sandbox": noMissingIframeSandbox, |
26 |
| - "no-namespace": noNamespace, |
27 |
| - "no-render-return-value": noRenderReturnValue, |
28 |
| - "no-script-url": noScriptUrl, |
29 |
| - "no-unknown-property": noUnknownProperty, |
30 |
| - "no-unsafe-iframe-sandbox": noUnsafeIframeSandbox, |
31 |
| - "no-unsafe-target-blank": noUnsafeTargetBlank, |
32 |
| - "no-void-elements-with-children": noVoidElementsWithChildren, |
| 3 | +import * as recommendedConfig from "./configs/recommended"; |
| 4 | +import { plugin } from "./plugin"; |
| 5 | + |
| 6 | +function makeConfig(config: { name: string; rules: RulePreset }) { |
| 7 | + return { |
| 8 | + ...config, |
| 9 | + plugins: { |
| 10 | + "react-x": plugin, |
| 11 | + }, |
| 12 | + }; |
| 13 | +} |
33 | 14 |
|
34 |
| - // Part: deprecated rules |
35 |
| - /** @deprecated Use `no-void-elements-with-children` instead */ |
36 |
| - "no-children-in-void-dom-elements": noVoidElementsWithChildren, |
| 15 | +function makeLegacyConfig(config: { rules: RulePreset }) { |
| 16 | + return { |
| 17 | + plugins: ["react-x"], |
| 18 | + rules: config.rules, |
| 19 | + }; |
| 20 | +} |
| 21 | + |
| 22 | +export default { |
| 23 | + ...plugin, |
| 24 | + configs: { |
| 25 | + ["recommended"]: makeConfig(recommendedConfig), |
| 26 | + ["recommended-legacy"]: makeLegacyConfig(recommendedConfig), |
37 | 27 | },
|
38 |
| -} as const; |
| 28 | +}; |
0 commit comments