@peerigon/configs 1.0.0-beta.1

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.
Files changed (53) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +452 -0
  3. package/eslint/lib/glob-patterns.js +11 -0
  4. package/eslint/lib/rule-options.js +130 -0
  5. package/eslint/presets/javascript-browser.js +6 -0
  6. package/eslint/presets/javascript-node.js +6 -0
  7. package/eslint/presets/javascript.js +5 -0
  8. package/eslint/presets/javascript.test/eslint.config.js +1 -0
  9. package/eslint/presets/javascript.test/main.js +62 -0
  10. package/eslint/presets/javascript.test/other.js +2 -0
  11. package/eslint/presets/typescript-node.js +13 -0
  12. package/eslint/presets/typescript-react.js +15 -0
  13. package/eslint/presets/typescript-react.test/App.tsx +45 -0
  14. package/eslint/presets/typescript-react.test/Other.tsx +5 -0
  15. package/eslint/presets/typescript-react.test/eslint.config.js +1 -0
  16. package/eslint/presets/typescript-react.test/tsconfig.json +7 -0
  17. package/eslint/presets/typescript.js +6 -0
  18. package/eslint/presets/typescript.test/eslint.config.js +1 -0
  19. package/eslint/presets/typescript.test/main.ts +31 -0
  20. package/eslint/presets/typescript.test/message.ts +3 -0
  21. package/eslint/presets/typescript.test/test.json +1 -0
  22. package/eslint/presets/typescript.test/tsconfig.json +4 -0
  23. package/eslint/presets/typescript.test/types.d.ts +11 -0
  24. package/eslint/rules/base.js +18 -0
  25. package/eslint/rules/browser.js +12 -0
  26. package/eslint/rules/javascript.js +147 -0
  27. package/eslint/rules/node.js +12 -0
  28. package/eslint/rules/react.js +169 -0
  29. package/eslint/rules/typescript.js +198 -0
  30. package/eslint/styles/jsx-no-literals.js +31 -0
  31. package/eslint/styles/jsx-no-literals.test/eslint.config.js +4 -0
  32. package/eslint/styles/jsx-no-literals.test/main.tsx +4 -0
  33. package/eslint/styles/jsx-no-literals.test/tsconfig.json +7 -0
  34. package/eslint/styles/no-default-export.js +19 -0
  35. package/eslint/styles/no-default-export.test/eslint.config.js +4 -0
  36. package/eslint/styles/no-default-export.test/main.ts +2 -0
  37. package/eslint/styles/no-default-export.test/tsconfig.json +4 -0
  38. package/eslint/styles/no-null.js +10 -0
  39. package/eslint/styles/no-null.test/eslint.config.js +4 -0
  40. package/eslint/styles/no-null.test/main.ts +2 -0
  41. package/eslint/styles/no-null.test/tsconfig.json +4 -0
  42. package/eslint/styles/prefer-array-shorthand.js +15 -0
  43. package/eslint/styles/prefer-array-shorthand.test/eslint.config.js +4 -0
  44. package/eslint/styles/prefer-array-shorthand.test/main.ts +4 -0
  45. package/eslint/styles/prefer-array-shorthand.test/tsconfig.json +4 -0
  46. package/eslint/styles/prefer-interface.js +10 -0
  47. package/eslint/styles/prefer-interface.test/eslint.config.js +4 -0
  48. package/eslint/styles/prefer-interface.test/main.ts +8 -0
  49. package/eslint/styles/prefer-interface.test/tsconfig.json +4 -0
  50. package/eslint/types.d.ts +48 -0
  51. package/package.json +108 -0
  52. package/prettier/base.js +30 -0
  53. package/typescript/base.json +20 -0
@@ -0,0 +1,2 @@
1
+ export const a = 1;
2
+ export const b = 2;
@@ -0,0 +1,13 @@
1
+ import eslintConfigPrettier from "eslint-config-prettier";
2
+ import { base } from "../rules/base.js";
3
+ import { javascript } from "../rules/javascript.js";
4
+ import { node } from "../rules/node.js";
5
+ import { typescript } from "../rules/typescript.js";
6
+
7
+ export default [
8
+ ...base,
9
+ ...javascript,
10
+ ...typescript,
11
+ ...node,
12
+ eslintConfigPrettier,
13
+ ];
@@ -0,0 +1,15 @@
1
+ import eslintConfigPrettier from "eslint-config-prettier";
2
+ import { base } from "../rules/base.js";
3
+ import { browser } from "../rules/browser.js";
4
+ import { javascript } from "../rules/javascript.js";
5
+ import { react } from "../rules/react.js";
6
+ import { typescript } from "../rules/typescript.js";
7
+
8
+ export default [
9
+ ...base,
10
+ ...javascript,
11
+ ...typescript,
12
+ ...react,
13
+ ...browser,
14
+ eslintConfigPrettier,
15
+ ];
@@ -0,0 +1,45 @@
1
+ import { useEffect, useRef, useState } from "react";
2
+
3
+ export const App = (_props: { name: string; count: number }) => {
4
+ for (let index = 0; index < 10; index++) {
5
+ // eslint-disable-next-line react-compiler/react-compiler
6
+ // eslint-disable-next-line react-hooks/rules-of-hooks
7
+ useEffect(() => {
8
+ void index;
9
+
10
+ // eslint-disable-next-line react-compiler/react-compiler
11
+ // eslint-disable-next-line react-hooks/exhaustive-deps
12
+ }, []);
13
+ }
14
+
15
+ // eslint-disable-next-line @eslint-react/naming-convention/use-state
16
+ const [state, updateState] = useState(0);
17
+
18
+ useEffect(() => {
19
+ // eslint-disable-next-line @eslint-react/hooks-extra/no-direct-set-state-in-use-effect
20
+ updateState(1);
21
+ }, [state]);
22
+
23
+ return (
24
+ <>
25
+ {/* eslint-disable-next-line jsx-a11y/alt-text */}
26
+ <img src="some-image.jpg" />
27
+ {/* eslint-disable-next-line react/jsx-curly-brace-presence */}
28
+ {"Hello world"}
29
+ {/* eslint-disable-next-line @eslint-react/no-leaked-conditional-rendering */}
30
+ <>{_props.count && <view />}</>
31
+ </>
32
+ );
33
+ };
34
+
35
+ // eslint-disable-next-line react-refresh/only-export-components
36
+ export const doesntWorkWithHmr = () => {};
37
+
38
+ export const InvalidRefAccessDuringRender = () => {
39
+ const ref = useRef(null);
40
+ // eslint-disable-next-line react-compiler/react-compiler
41
+ const value = ref.current;
42
+ return value;
43
+ };
44
+
45
+ <App name="John" count={0} />;
@@ -0,0 +1,5 @@
1
+ // Missing React import should not be reported
2
+
3
+ export const Other = () => {
4
+ return <h1>Hello World</h1>;
5
+ };
@@ -0,0 +1 @@
1
+ export { default } from "../typescript-react.js";
@@ -0,0 +1,7 @@
1
+ {
2
+ "extends": ["../../../typescript/base.json"],
3
+ "compilerOptions": {
4
+ "jsx": "react-jsx"
5
+ },
6
+ "include": ["**/*"]
7
+ }
@@ -0,0 +1,6 @@
1
+ import eslintConfigPrettier from "eslint-config-prettier";
2
+ import { base } from "../rules/base.js";
3
+ import { javascript } from "../rules/javascript.js";
4
+ import { typescript } from "../rules/typescript.js";
5
+
6
+ export default [...base, ...javascript, ...typescript, eslintConfigPrettier];
@@ -0,0 +1 @@
1
+ export { default } from "../typescript-node.js";
@@ -0,0 +1,31 @@
1
+ import { getMessage } from "./message.js";
2
+ // Check if import attributes are detected and formatted correctly
3
+ import test from "./test.json" with { type: "json" };
4
+
5
+ // eslint-disable-next-line @typescript-eslint/naming-convention
6
+ const snake_case = 123;
7
+
8
+ class SomeClass {
9
+ #someProp = true;
10
+ private someEventHandler = () => {
11
+ // Arrow functions as class properties should be ok...
12
+ };
13
+
14
+ someMethod(_unused: string) {
15
+ // ...as well as regular functions.
16
+ // See styles/prefer-arrow.js for an explanation.
17
+ console.log(this.#someProp);
18
+ }
19
+
20
+ // Should be an error
21
+ // eslint-disable-next-line @typescript-eslint/naming-convention
22
+ snake_case() {}
23
+ }
24
+
25
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
26
+ type SomeType = {
27
+ // eslint-disable-next-line @typescript-eslint/method-signature-style
28
+ someMethod(): void;
29
+ };
30
+
31
+ console.log(getMessage(), SomeClass, snake_case, test);
@@ -0,0 +1,3 @@
1
+ export const getMessage: () => string = () => {
2
+ return "Hello World";
3
+ };
@@ -0,0 +1,4 @@
1
+ {
2
+ "extends": ["../../../typescript/base.json"],
3
+ "include": ["**/*"]
4
+ }
@@ -0,0 +1,11 @@
1
+ interface SomeInterface {
2
+ // Should not complain about the method signature style here because
3
+ // it's sometimes necessary to define these overloads for 3rd party packages
4
+ someMethod(param: boolean): void;
5
+ someMethod(param1: number, param2: number): void;
6
+ }
7
+
8
+ declare module "some-module" {
9
+ // Should not complain about export default
10
+ export default SomeInterface;
11
+ }
@@ -0,0 +1,18 @@
1
+ import fs from "node:fs";
2
+ import path from "node:path";
3
+ import { includeIgnoreFile } from "@eslint/compat";
4
+
5
+ const gitignorePath = path.resolve(process.cwd(), ".gitignore");
6
+ const gitignoreExists = fs.existsSync(gitignorePath);
7
+
8
+ /** @type {import("eslint").Linter.Config[]} */
9
+ export const base = [
10
+ gitignoreExists ? includeIgnoreFile(gitignorePath) : {},
11
+ {
12
+ linterOptions: {
13
+ reportUnusedDisableDirectives: "warn",
14
+ },
15
+ },
16
+ ];
17
+
18
+ export default base;
@@ -0,0 +1,12 @@
1
+ import globals from "globals";
2
+
3
+ /** @type {import("eslint").Linter.Config[]} */
4
+ export const browser = [
5
+ {
6
+ languageOptions: {
7
+ globals: { ...globals.browser },
8
+ },
9
+ },
10
+ ];
11
+
12
+ export default browser;
@@ -0,0 +1,147 @@
1
+ import js from "@eslint/js";
2
+ import unicornPlugin from "eslint-plugin-unicorn";
3
+ import { globPatterns } from "../lib/glob-patterns.js";
4
+ import { ruleOptions } from "../lib/rule-options.js";
5
+
6
+ /** @type {import("eslint").Linter.Config[]} */
7
+ export const javascript = [
8
+ js.configs.recommended,
9
+ unicornPlugin.configs["flat/recommended"],
10
+ {
11
+ rules: {
12
+ // Turn of too opinionated rules
13
+ // https://github.com/sindresorhus/eslint-plugin-unicorn/issues/896
14
+ "unicorn/prevent-abbreviations": "off",
15
+ "unicorn/filename-case": "off",
16
+ "unicorn/no-nested-ternary": "off",
17
+ "unicorn/no-null": "off",
18
+ "unicorn/no-useless-undefined": "off",
19
+ "unicorn/prefer-query-selector": "off",
20
+ // Also turn off the following rules because they're too opinionated
21
+ "unicorn/require-array-join-separator": "off",
22
+ "unicorn/no-array-for-each": "off",
23
+ "unicorn/no-array-reduce": "off",
24
+ "unicorn/prefer-global-this": "off", // Too many false positives
25
+ "unicorn/prefer-ternary": "off",
26
+ },
27
+ },
28
+ {
29
+ linterOptions: {
30
+ reportUnusedDisableDirectives: "warn",
31
+ },
32
+ },
33
+ {
34
+ files: globPatterns.javascript,
35
+ languageOptions: { parserOptions: { ecmaFeatures: { jsx: true } } },
36
+ },
37
+ {
38
+ rules: {
39
+ // Possible Problems
40
+ // ----------------------------------------------
41
+ "array-callback-return": "warn", // https://eslint.org/docs/latest/rules/array-callback-return
42
+ "no-await-in-loop": "warn", // https://eslint.org/docs/latest/rules/no-await-in-loop
43
+ "no-constructor-return": "warn", // https://eslint.org/docs/latest/rules/no-constructor-return
44
+ "no-duplicate-imports": "warn", // https://eslint.org/docs/latest/rules/no-duplicate-imports
45
+ "no-promise-executor-return": "warn", // https://eslint.org/docs/latest/rules/no-promise-executor-return
46
+ "no-self-compare": "warn", // https://eslint.org/docs/latest/rules/no-self-compare
47
+ "no-template-curly-in-string": "warn", // https://eslint.org/docs/latest/rules/no-template-curly-in-string
48
+ "no-unmodified-loop-condition": "warn", // https://eslint.org/docs/latest/rules/no-unmodified-loop-condition
49
+ "no-unreachable-loop": "warn", // https://eslint.org/docs/latest/rules/no-unreachable-loop
50
+ "no-useless-assignment": "warn", // https://eslint.org/docs/latest/rules/no-useless-assignment
51
+ "require-atomic-updates": "warn", // https://eslint.org/docs/latest/rules/require-atomic-updates
52
+
53
+ // Suggestions
54
+ // ----------------------------------------------
55
+ "accessor-pairs": "warn", // https://eslint.org/docs/latest/rules/accessor-pairs
56
+ "block-scoped-var": "warn", // https://eslint.org/docs/latest/rules/block-scoped-var
57
+ camelcase: ["warn", ruleOptions.camelcase], // https://eslint.org/docs/latest/rules/camelcase
58
+ "consistent-return": "warn", // https://eslint.org/docs/latest/rules/consistent-return
59
+ "dot-notation": "warn", // https://eslint.org/docs/latest/rules/dot-notation
60
+ eqeqeq: ["warn", "always", { null: "ignore" }], // https://eslint.org/docs/latest/rules/eqeqeq
61
+ "func-style": ["warn", "declaration"], // https://eslint.org/docs/latest/rules/func-style
62
+ "grouped-accessor-pairs": ["warn", "setBeforeGet"], // https://eslint.org/docs/latest/rules/grouped-accessor-pairs
63
+ "max-depth": ["warn", 5], // https://eslint.org/docs/latest/rules/max-depth
64
+ "max-nested-callbacks": ["warn", 3], // https://eslint.org/docs/latest/rules/max-nested-callbacks
65
+ "max-params": ["warn", { max: 4 }], // https://eslint.org/docs/latest/rules/max-params
66
+ "new-cap": "warn", // https://eslint.org/docs/latest/rules/new-cap
67
+ "no-alert": "warn", // https://eslint.org/docs/latest/rules/no-alert
68
+ "no-array-constructor": "warn", // https://eslint.org/docs/latest/rules/no-array-constructor
69
+ "no-bitwise": "warn", // https://eslint.org/docs/latest/rules/no-bitwise
70
+ "no-caller": "warn", // https://eslint.org/docs/latest/rules/no-caller
71
+ "no-else-return": "warn", // https://eslint.org/docs/latest/rules/no-else-return
72
+ "no-eval": "warn", // https://eslint.org/docs/latest/rules/no-eval
73
+ "no-extend-native": "warn", // https://eslint.org/docs/latest/rules/no-extend-native
74
+ "no-extra-bind": "warn", // https://eslint.org/docs/latest/rules/no-extra-bind
75
+ "no-extra-label": "warn", // https://eslint.org/docs/latest/rules/no-extra-label
76
+ "no-implicit-globals": "warn", // https://eslint.org/docs/latest/rules/no-implicit-globals
77
+ "no-implied-eval": "warn", // https://eslint.org/docs/latest/rules/no-implied-eval
78
+ "no-iterator": "warn", // https://eslint.org/docs/latest/rules/no-iterator
79
+ "no-label-var": "warn", // https://eslint.org/docs/latest/rules/no-label-var
80
+ "no-labels": "warn", // https://eslint.org/docs/latest/rules/no-labels
81
+ "no-lone-blocks": "warn", // https://eslint.org/docs/latest/rules/no-lone-blocks
82
+ "no-multi-str": "warn", // https://eslint.org/docs/latest/rules/no-multi-str
83
+ "no-negated-condition": "warn", // https://eslint.org/docs/latest/rules/no-negated-condition
84
+ "no-new": "warn", // https://eslint.org/docs/latest/rules/no-new
85
+ "no-new-func": "warn", // https://eslint.org/docs/latest/rules/no-new-func
86
+ "no-new-wrappers": "warn", // https://eslint.org/docs/latest/rules/no-new-wrappers
87
+ "no-object-constructor": "warn", // https://eslint.org/docs/latest/rules/no-object-constructor
88
+ "no-octal-escape": "warn", // https://eslint.org/docs/latest/rules/no-octal-escape
89
+ "no-proto": "warn", // https://eslint.org/docs/latest/rules/no-proto
90
+ "no-restricted-exports": [
91
+ "warn",
92
+ {
93
+ restrictedNamedExports: [
94
+ // If "then" is a function, the module will not be loadedable by an async import()
95
+ // because it looks like a promise. The JS engine will call the .then() function in that case
96
+ // Since this is super confusing, let's warn the user about it
97
+ "then",
98
+ ],
99
+ },
100
+ ], // https://eslint.org/docs/latest/rules/no-restricted-exports
101
+ "no-restricted-globals": ["warn", "event"], // https://eslint.org/docs/latest/rules/no-restricted-globals
102
+ "no-restricted-syntax": ["warn", "WithStatement"], // https://eslint.org/docs/latest/rules/no-restricted-syntax
103
+ "no-script-url": "warn", // https://eslint.org/docs/latest/rules/no-script-url
104
+ "no-sequences": "warn", // https://eslint.org/docs/latest/rules/no-sequences
105
+ "no-throw-literal": "warn", // https://eslint.org/docs/latest/rules/no-throw-literal
106
+ "no-undef-init": "warn", // https://eslint.org/docs/latest/rules/no-undef-init
107
+ "no-unneeded-ternary": "warn", // https://eslint.org/docs/latest/rules/no-unneeded-ternary
108
+ "no-unused-expressions": ["warn", ruleOptions["no-unused-expressions"]], // https://eslint.org/docs/latest/rules/no-unused-expressions
109
+ "no-unused-vars": ["error", ruleOptions["no-unused-vars"]],
110
+ "no-useless-call": "warn", // https://eslint.org/docs/latest/rules/no-useless-call
111
+ "no-useless-computed-key": "warn", // https://eslint.org/docs/latest/rules/no-useless-computed-key
112
+ "no-useless-concat": "warn", // https://eslint.org/docs/latest/rules/no-useless-concat
113
+ "no-useless-constructor": "warn", // https://eslint.org/docs/latest/rules/no-useless-constructor
114
+ "no-useless-escape": "warn", // https://eslint.org/docs/latest/rules/no-useless-escape
115
+ "no-useless-rename": "warn", // https://eslint.org/docs/latest/rules/no-useless-rename
116
+ "no-useless-return": "warn", // https://eslint.org/docs/latest/rules/no-useless-return
117
+ "no-var": "warn", // https://eslint.org/docs/latest/rules/no-var
118
+ "object-shorthand": ["warn", "always"], // https://eslint.org/docs/latest/rules/object-shorthand
119
+ "one-var": ["warn", "never"], // https://eslint.org/docs/latest/rules/one-var
120
+ "prefer-arrow-callback": "warn", // https://eslint.org/docs/latest/rules/prefer-arrow-callback
121
+ "prefer-const": "warn", // https://eslint.org/docs/latest/rules/prefer-const
122
+ "prefer-exponentiation-operator": "warn", // https://eslint.org/docs/latest/rules/prefer-exponentiation-operator
123
+ "prefer-numeric-literals": "warn", // https://eslint.org/docs/latest/rules/prefer-numeric-literals
124
+ "prefer-object-has-own": "warn", // https://eslint.org/docs/latest/rules/prefer-object-has-own
125
+ "prefer-promise-reject-errors": "warn", // https://eslint.org/docs/latest/rules/prefer-promise-reject-errors
126
+ "prefer-regex-literals": "warn", // https://eslint.org/docs/latest/rules/prefer-regex-literals
127
+ "prefer-rest-params": "warn", // https://eslint.org/docs/latest/rules/prefer-rest-params
128
+ "prefer-spread": "warn", // https://eslint.org/docs/latest/rules/prefer-spread
129
+ strict: "warn", // https://eslint.org/docs/latest/rules/strict
130
+ "symbol-description": "warn", // https://eslint.org/docs/latest/rules/symbol-description
131
+ yoda: ["warn", "never"], // https://eslint.org/docs/latest/rules/yoda
132
+
133
+ // Layout & Formatting
134
+ // ----------------------------------------------
135
+ "unicode-bom": "warn", // https://eslint.org/docs/latest/rules/unicode-bom
136
+ },
137
+ },
138
+ {
139
+ files: globPatterns.tests,
140
+ rules: {
141
+ // Top-level await might slow down the test suite start up
142
+ "unicorn/prefer-top-level-await": "off",
143
+ },
144
+ },
145
+ ];
146
+
147
+ export default javascript;
@@ -0,0 +1,12 @@
1
+ import globals from "globals";
2
+
3
+ /** @type {import("eslint").Linter.Config[]} */
4
+ export const node = [
5
+ {
6
+ languageOptions: {
7
+ globals: { ...globals.node },
8
+ },
9
+ },
10
+ ];
11
+
12
+ export default node;
@@ -0,0 +1,169 @@
1
+ import reactPlugin2 from "@eslint-react/eslint-plugin";
2
+ import jsxA11yPlugin from "eslint-plugin-jsx-a11y";
3
+ import reactPlugin from "eslint-plugin-react";
4
+ import reactCompilerPlugin from "eslint-plugin-react-compiler";
5
+ import reactHooksPlugin from "eslint-plugin-react-hooks";
6
+ import reactRefreshPlugin from "eslint-plugin-react-refresh";
7
+ import { globPatterns } from "../lib/glob-patterns.js";
8
+
9
+ const files = [globPatterns.jsx, globPatterns.typescriptJsx];
10
+
11
+ /** @type {import("eslint").Linter.Config[]} */
12
+ export const react = [
13
+ {
14
+ ...reactPlugin.configs.flat.recommended,
15
+ files,
16
+ languageOptions: {
17
+ ...reactPlugin.configs.flat.recommended.languageOptions,
18
+ },
19
+ settings: {
20
+ react: {
21
+ version: "detect",
22
+ },
23
+ },
24
+ },
25
+ {
26
+ ...reactPlugin.configs.flat["jsx-runtime"],
27
+ files,
28
+ },
29
+ // @ts-expect-error Seems like reactPlugin2's types are broken
30
+ {
31
+ ...reactPlugin2.configs.recommended,
32
+ files,
33
+ },
34
+ // @ts-expect-error Seems like reactPlugin2's types are broken
35
+ {
36
+ ...reactPlugin2.configs["recommended-type-checked"],
37
+ files,
38
+ },
39
+ {
40
+ ...jsxA11yPlugin.flatConfigs.recommended,
41
+ files,
42
+ },
43
+ {
44
+ ...jsxA11yPlugin.flatConfigs.strict,
45
+ files,
46
+ },
47
+ {
48
+ files,
49
+ plugins: {
50
+ "react-refresh": reactRefreshPlugin,
51
+ },
52
+ rules: {
53
+ "react-refresh/only-export-components": [
54
+ "warn",
55
+ {
56
+ allowConstantExport: true,
57
+ allowExportNames: [
58
+ // Next.js
59
+ "getServerSideProps",
60
+ // Remix
61
+ "meta",
62
+ "links",
63
+ "headers",
64
+ "loader",
65
+ "action",
66
+ ],
67
+ },
68
+ ],
69
+ },
70
+ },
71
+ // There's currently no official recommended flat config for react-hooks.
72
+ // TODO: Use recommended config when it's available.
73
+ {
74
+ files,
75
+ plugins: {
76
+ "react-hooks": reactHooksPlugin,
77
+ },
78
+ rules: {
79
+ "react-hooks/rules-of-hooks": "error",
80
+ "react-hooks/exhaustive-deps": "warn",
81
+ },
82
+ },
83
+ // There's currently no official recommended flat config for react-compiler.
84
+ // TODO: Use recommended config when it's available.
85
+ {
86
+ files,
87
+ plugins: {
88
+ "react-compiler": reactCompilerPlugin,
89
+ },
90
+ rules: {
91
+ "react-compiler/react-compiler": "error",
92
+ },
93
+ },
94
+ {
95
+ files,
96
+ rules: {
97
+ "react/button-has-type": "warn", // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/boolean-prop-naming.md
98
+ "react/default-props-match-prop-types": "warn", // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/default-props-match-prop-types.md
99
+ "react/display-name": "warn", // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/display-name.md
100
+ "react/forbid-foreign-prop-types": "warn", // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/forbid-foreign-prop-types.md
101
+ "react/forbid-prop-types": [
102
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/forbid-prop-types.md
103
+ "warn",
104
+ {
105
+ checkChildContextTypes: true,
106
+ checkContextTypes: true,
107
+ },
108
+ ],
109
+ // Superseded by @eslint-react/naming-convention/use-state because it handles
110
+ // [, setState] = useState() as well.
111
+ "react/hook-use-state": ["off", { allowDestructuredState: true }], // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/hook-use-state.md
112
+ "react/iframe-missing-sandbox": "warn", // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/iframe-missing-sandbox.md
113
+ "react/jsx-boolean-value": ["warn", "never"], // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-boolean-value.md
114
+ "react/jsx-curly-brace-presence": ["warn", "never"], // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-curly-brace-presence.md
115
+ "react/jsx-filename-extension": [
116
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-filename-extension.md
117
+ "warn",
118
+ {
119
+ extensions: [".jsx", ".tsx"],
120
+ },
121
+ ],
122
+ "react/jsx-handler-names": [
123
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-handler-names.md
124
+ "warn",
125
+ {
126
+ eventHandlerPrefix: "handle",
127
+ eventHandlerPropPrefix: "on",
128
+ },
129
+ ],
130
+ "react/jsx-key": "warn", // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-key.md
131
+ "react/jsx-no-constructed-context-values": "warn", // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-constructed-context-values.md
132
+ // Superseded by @eslint-react/no-leaked-conditional-rendering because it's more
133
+ // accurate by using type information.
134
+ "react/jsx-no-leaked-render": "off", // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-leaked-render.md
135
+ "react/jsx-no-script-url": "warn", // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-script-url.md
136
+ "react/jsx-no-undef": "warn", // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-undef.md
137
+ "react/jsx-pascal-case": "warn", // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-pascal-case.md
138
+ "react/jsx-props-no-spread-multi": "warn", // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-props-no-spread-multi.md
139
+ "react/no-access-state-in-setstate": "warn", // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-access-state-in-setstate.md
140
+ "react/no-array-index-key": "warn", // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-array-index-key.md
141
+ "react/no-danger": "warn", // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-danger.md
142
+ "react/no-did-mount-set-state": ["warn", "disallow-in-func"], // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-did-mount-set-state.md
143
+ "react/no-did-update-set-state": ["warn", "disallow-in-func"], // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-did-update-set-state.md
144
+ "react/no-invalid-html-attribute": "warn", // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-invalid-html-attribute.md
145
+ "react/no-redundant-should-component-update": "warn", // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-redundant-should-component-update.md
146
+ "react/no-this-in-sfc": "warn", // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-this-in-sfc.md
147
+ "react/no-typos": "warn", // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-typos.md
148
+ "react/no-unstable-nested-components": "warn", // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-unstable-nested-components.md
149
+ "react/no-unused-prop-types": "warn", // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-unused-prop-types.md
150
+ "react/no-unused-state": "warn", // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-unused-state.md
151
+ "react/no-will-update-set-state": "warn", // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-will-update-set-state.md
152
+ "react/prefer-es6-class": "warn", // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/prefer-es6-class.md
153
+ "react/prefer-stateless-function": [
154
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/prefer-stateless-function.md
155
+ "warn",
156
+ {
157
+ ignorePureComponents: true,
158
+ },
159
+ ],
160
+ "react/self-closing-comp": "warn", // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/self-closing-comp.md
161
+ "react/style-prop-object": "warn", // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/style-prop-object.md
162
+ "react/void-dom-elements-no-children": "warn", // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/void-dom-elements-no-children.md
163
+ "@eslint-react/naming-convention/use-state": "warn", // https://eslint-react.xyz/docs/rules/naming-convention-use-state
164
+ "@eslint-react/no-leaked-conditional-rendering": "warn", // https://eslint-react.xyz/docs/rules/no-leaked-conditional-rendering
165
+ },
166
+ },
167
+ ];
168
+
169
+ export default react;