@peerigon/configs 4.2.0 → 4.3.0-beta.2

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 (148) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/{types → dist}/eslint/lib/glob-patterns.d.ts +0 -1
  3. package/dist/eslint/lib/glob-patterns.js +11 -0
  4. package/{types → dist}/eslint/lib/rule-options.d.ts +0 -1
  5. package/dist/eslint/lib/rule-options.js +127 -0
  6. package/{types → dist}/eslint/presets/javascript-browser.d.ts +0 -1
  7. package/{eslint → dist/eslint}/presets/javascript-browser.js +4 -6
  8. package/{types → dist}/eslint/presets/javascript-node.d.ts +0 -1
  9. package/{eslint → dist/eslint}/presets/javascript-node.js +4 -6
  10. package/{types → dist}/eslint/presets/javascript.d.ts +0 -1
  11. package/{eslint → dist/eslint}/presets/javascript.js +0 -2
  12. package/{types → dist}/eslint/presets/typescript-node.d.ts +0 -1
  13. package/{eslint → dist/eslint}/presets/typescript-node.js +5 -7
  14. package/{types → dist}/eslint/presets/typescript-react.d.ts +0 -1
  15. package/{eslint → dist/eslint}/presets/typescript-react.js +6 -8
  16. package/{types → dist}/eslint/presets/typescript.d.ts +0 -1
  17. package/{eslint → dist/eslint}/presets/typescript.js +4 -6
  18. package/{types → dist}/eslint/rules/base.d.ts +0 -1
  19. package/{eslint → dist/eslint}/rules/base.js +5 -8
  20. package/{types → dist}/eslint/rules/browser.d.ts +0 -1
  21. package/{eslint → dist/eslint}/rules/browser.js +4 -6
  22. package/{types → dist}/eslint/rules/javascript.d.ts +0 -1
  23. package/dist/eslint/rules/javascript.js +151 -0
  24. package/{types → dist}/eslint/rules/node.d.ts +0 -1
  25. package/{eslint → dist/eslint}/rules/node.js +4 -6
  26. package/{types → dist}/eslint/rules/react.d.ts +0 -1
  27. package/dist/eslint/rules/react.js +166 -0
  28. package/{types → dist}/eslint/rules/typescript.d.ts +0 -1
  29. package/dist/eslint/rules/typescript.js +195 -0
  30. package/{types → dist}/eslint/styles/jsx-no-literals.d.ts +0 -1
  31. package/dist/eslint/styles/jsx-no-literals.js +29 -0
  32. package/{types → dist}/eslint/styles/no-default-export.d.ts +0 -1
  33. package/dist/eslint/styles/no-default-export.js +18 -0
  34. package/{types → dist}/eslint/styles/no-null.d.ts +0 -1
  35. package/{eslint → dist/eslint}/styles/no-null.js +4 -5
  36. package/{types → dist}/eslint/styles/prefer-array-shorthand.d.ts +0 -1
  37. package/dist/eslint/styles/prefer-array-shorthand.js +14 -0
  38. package/{types → dist}/eslint/styles/prefer-interface.d.ts +0 -1
  39. package/dist/eslint/styles/prefer-interface.js +9 -0
  40. package/dist/prettier/base.d.ts +8 -0
  41. package/dist/prettier/base.js +55 -0
  42. package/{types → dist}/semantic-release/base.d.ts +0 -1
  43. package/dist/semantic-release/base.js +40 -0
  44. package/{types → dist}/semantic-release/cross-publish.d.ts +4 -1
  45. package/dist/semantic-release/cross-publish.js +35 -0
  46. package/dist/typescript/base.json +43 -0
  47. package/dist/typescript/configs.d.ts +1 -0
  48. package/dist/typescript/configs.js +4 -0
  49. package/dist/typescript/js-lib.json +11 -0
  50. package/dist/typescript/lib.json +13 -0
  51. package/package.json +24 -74
  52. package/eslint/README.md +0 -119
  53. package/eslint/lib/glob-patterns.js +0 -11
  54. package/eslint/lib/rule-options.js +0 -130
  55. package/eslint/presets/javascript.test/eslint.config.js +0 -1
  56. package/eslint/presets/javascript.test/main.js +0 -62
  57. package/eslint/presets/javascript.test/other.js +0 -2
  58. package/eslint/presets/typescript-react.test/App.tsx +0 -47
  59. package/eslint/presets/typescript-react.test/Other.tsx +0 -5
  60. package/eslint/presets/typescript-react.test/eslint.config.js +0 -1
  61. package/eslint/presets/typescript-react.test/tsconfig.json +0 -7
  62. package/eslint/presets/typescript.test/eslint.config.js +0 -1
  63. package/eslint/presets/typescript.test/main.ts +0 -42
  64. package/eslint/presets/typescript.test/message.ts +0 -3
  65. package/eslint/presets/typescript.test/test.json +0 -1
  66. package/eslint/presets/typescript.test/tsconfig.json +0 -4
  67. package/eslint/presets/typescript.test/types.d.ts +0 -11
  68. package/eslint/rules/javascript.js +0 -157
  69. package/eslint/rules/react.js +0 -169
  70. package/eslint/rules/typescript.js +0 -206
  71. package/eslint/styles/jsx-no-literals.js +0 -31
  72. package/eslint/styles/jsx-no-literals.test/eslint.config.js +0 -4
  73. package/eslint/styles/jsx-no-literals.test/main.tsx +0 -4
  74. package/eslint/styles/jsx-no-literals.test/tsconfig.json +0 -7
  75. package/eslint/styles/no-default-export.js +0 -20
  76. package/eslint/styles/no-default-export.test/eslint.config.js +0 -4
  77. package/eslint/styles/no-default-export.test/main.ts +0 -2
  78. package/eslint/styles/no-default-export.test/tsconfig.json +0 -4
  79. package/eslint/styles/no-default-export.test/vitest.config.ts +0 -1
  80. package/eslint/styles/no-null.test/eslint.config.js +0 -4
  81. package/eslint/styles/no-null.test/main.ts +0 -2
  82. package/eslint/styles/no-null.test/tsconfig.json +0 -4
  83. package/eslint/styles/prefer-array-shorthand.js +0 -15
  84. package/eslint/styles/prefer-array-shorthand.test/eslint.config.js +0 -4
  85. package/eslint/styles/prefer-array-shorthand.test/main.ts +0 -4
  86. package/eslint/styles/prefer-array-shorthand.test/tsconfig.json +0 -4
  87. package/eslint/styles/prefer-interface.js +0 -10
  88. package/eslint/styles/prefer-interface.test/eslint.config.js +0 -4
  89. package/eslint/styles/prefer-interface.test/main.ts +0 -8
  90. package/eslint/styles/prefer-interface.test/tsconfig.json +0 -4
  91. package/eslint/types.d.ts +0 -50
  92. package/prettier/README.md +0 -35
  93. package/prettier/base.js +0 -35
  94. package/prettier/css.test/styles.css +0 -9
  95. package/semantic-release/README.md +0 -81
  96. package/semantic-release/base.js +0 -41
  97. package/semantic-release/cross-publish.js +0 -41
  98. package/types/eslint/lib/glob-patterns.d.ts.map +0 -1
  99. package/types/eslint/lib/rule-options.d.ts.map +0 -1
  100. package/types/eslint/presets/javascript-browser.d.ts.map +0 -1
  101. package/types/eslint/presets/javascript-node.d.ts.map +0 -1
  102. package/types/eslint/presets/javascript.d.ts.map +0 -1
  103. package/types/eslint/presets/javascript.test/eslint.config.d.ts +0 -2
  104. package/types/eslint/presets/javascript.test/eslint.config.d.ts.map +0 -1
  105. package/types/eslint/presets/javascript.test/main.d.ts +0 -2
  106. package/types/eslint/presets/javascript.test/main.d.ts.map +0 -1
  107. package/types/eslint/presets/javascript.test/other.d.ts +0 -3
  108. package/types/eslint/presets/javascript.test/other.d.ts.map +0 -1
  109. package/types/eslint/presets/typescript-node.d.ts.map +0 -1
  110. package/types/eslint/presets/typescript-react.d.ts.map +0 -1
  111. package/types/eslint/presets/typescript.d.ts.map +0 -1
  112. package/types/eslint/rules/base.d.ts.map +0 -1
  113. package/types/eslint/rules/browser.d.ts.map +0 -1
  114. package/types/eslint/rules/javascript.d.ts.map +0 -1
  115. package/types/eslint/rules/node.d.ts.map +0 -1
  116. package/types/eslint/rules/react.d.ts.map +0 -1
  117. package/types/eslint/rules/typescript.d.ts.map +0 -1
  118. package/types/eslint/styles/jsx-no-literals.d.ts.map +0 -1
  119. package/types/eslint/styles/no-default-export.d.ts.map +0 -1
  120. package/types/eslint/styles/no-default-export.test/eslint.config.d.ts +0 -3
  121. package/types/eslint/styles/no-default-export.test/eslint.config.d.ts.map +0 -1
  122. package/types/eslint/styles/no-default-export.test/main.d.ts +0 -3
  123. package/types/eslint/styles/no-default-export.test/main.d.ts.map +0 -1
  124. package/types/eslint/styles/no-default-export.test/vitest.config.d.ts +0 -3
  125. package/types/eslint/styles/no-default-export.test/vitest.config.d.ts.map +0 -1
  126. package/types/eslint/styles/no-null.d.ts.map +0 -1
  127. package/types/eslint/styles/no-null.test/eslint.config.d.ts +0 -3
  128. package/types/eslint/styles/no-null.test/eslint.config.d.ts.map +0 -1
  129. package/types/eslint/styles/no-null.test/main.d.ts +0 -2
  130. package/types/eslint/styles/no-null.test/main.d.ts.map +0 -1
  131. package/types/eslint/styles/prefer-array-shorthand.d.ts.map +0 -1
  132. package/types/eslint/styles/prefer-array-shorthand.test/eslint.config.d.ts +0 -3
  133. package/types/eslint/styles/prefer-array-shorthand.test/eslint.config.d.ts.map +0 -1
  134. package/types/eslint/styles/prefer-array-shorthand.test/main.d.ts +0 -3
  135. package/types/eslint/styles/prefer-array-shorthand.test/main.d.ts.map +0 -1
  136. package/types/eslint/styles/prefer-interface.d.ts.map +0 -1
  137. package/types/eslint/styles/prefer-interface.test/eslint.config.d.ts +0 -3
  138. package/types/eslint/styles/prefer-interface.test/eslint.config.d.ts.map +0 -1
  139. package/types/eslint/styles/prefer-interface.test/main.d.ts +0 -7
  140. package/types/eslint/styles/prefer-interface.test/main.d.ts.map +0 -1
  141. package/types/prettier/base.d.ts +0 -4
  142. package/types/prettier/base.d.ts.map +0 -1
  143. package/types/semantic-release/base.d.ts.map +0 -1
  144. package/types/semantic-release/cross-publish.d.ts.map +0 -1
  145. package/typescript/README.md +0 -63
  146. package/typescript/base.json +0 -44
  147. package/typescript/js-lib.json +0 -8
  148. package/typescript/lib.json +0 -11
@@ -1,11 +0,0 @@
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
- }
@@ -1,157 +0,0 @@
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
- // The default of import-style is highly subjective and not always the best choice.
17
- // E.g. bundlers are able to tree-shake named imports easier than default imports.
18
- "unicorn/import-style": "off",
19
- "unicorn/no-nested-ternary": "off",
20
- "unicorn/no-null": "off",
21
- "unicorn/no-useless-undefined": "off",
22
- "unicorn/prefer-query-selector": "off",
23
- // Also turn off the following rules because they're too opinionated
24
- "unicorn/require-array-join-separator": "off",
25
- "unicorn/no-array-for-each": "off",
26
- "unicorn/no-array-reduce": "off",
27
- "unicorn/prefer-global-this": "off", // Too many false positives
28
- "unicorn/prefer-ternary": "off",
29
- // It makes sense to use Promise.all() with a single promise when we expect more to be added later.
30
- // In that case we don't want to refactor the code, but just add the new promise.
31
- "unicorn/no-single-promise-in-promise-methods": "off",
32
- },
33
- },
34
- {
35
- linterOptions: {
36
- reportUnusedDisableDirectives: "warn",
37
- },
38
- },
39
- {
40
- files: globPatterns.javascript,
41
- languageOptions: { parserOptions: { ecmaFeatures: { jsx: true } } },
42
- },
43
- {
44
- rules: {
45
- // Possible Problems
46
- // ----------------------------------------------
47
- "array-callback-return": "warn", // https://eslint.org/docs/latest/rules/array-callback-return
48
- "no-await-in-loop": "warn", // https://eslint.org/docs/latest/rules/no-await-in-loop
49
- "no-constructor-return": "warn", // https://eslint.org/docs/latest/rules/no-constructor-return
50
- "no-duplicate-imports": "warn", // https://eslint.org/docs/latest/rules/no-duplicate-imports
51
- "no-promise-executor-return": "warn", // https://eslint.org/docs/latest/rules/no-promise-executor-return
52
- "no-self-compare": "warn", // https://eslint.org/docs/latest/rules/no-self-compare
53
- "no-template-curly-in-string": "warn", // https://eslint.org/docs/latest/rules/no-template-curly-in-string
54
- "no-unmodified-loop-condition": "warn", // https://eslint.org/docs/latest/rules/no-unmodified-loop-condition
55
- "no-unreachable-loop": "warn", // https://eslint.org/docs/latest/rules/no-unreachable-loop
56
- "no-useless-assignment": "warn", // https://eslint.org/docs/latest/rules/no-useless-assignment
57
- "require-atomic-updates": "warn", // https://eslint.org/docs/latest/rules/require-atomic-updates
58
-
59
- // Suggestions
60
- // ----------------------------------------------
61
- "accessor-pairs": "warn", // https://eslint.org/docs/latest/rules/accessor-pairs
62
- "block-scoped-var": "warn", // https://eslint.org/docs/latest/rules/block-scoped-var
63
- camelcase: ["warn", ruleOptions.camelcase], // https://eslint.org/docs/latest/rules/camelcase
64
- "consistent-return": "warn", // https://eslint.org/docs/latest/rules/consistent-return
65
- "dot-notation": "warn", // https://eslint.org/docs/latest/rules/dot-notation
66
- eqeqeq: ["warn", "always", { null: "ignore" }], // https://eslint.org/docs/latest/rules/eqeqeq
67
- "func-style": ["warn", "declaration"], // https://eslint.org/docs/latest/rules/func-style
68
- "grouped-accessor-pairs": ["warn", "setBeforeGet"], // https://eslint.org/docs/latest/rules/grouped-accessor-pairs
69
- "max-depth": ["warn", 5], // https://eslint.org/docs/latest/rules/max-depth
70
- "max-nested-callbacks": ["warn", 3], // https://eslint.org/docs/latest/rules/max-nested-callbacks
71
- "max-params": ["warn", { max: 4 }], // https://eslint.org/docs/latest/rules/max-params
72
- "new-cap": "warn", // https://eslint.org/docs/latest/rules/new-cap
73
- "no-alert": "warn", // https://eslint.org/docs/latest/rules/no-alert
74
- "no-array-constructor": "warn", // https://eslint.org/docs/latest/rules/no-array-constructor
75
- "no-bitwise": "warn", // https://eslint.org/docs/latest/rules/no-bitwise
76
- "no-caller": "warn", // https://eslint.org/docs/latest/rules/no-caller
77
- "no-else-return": "warn", // https://eslint.org/docs/latest/rules/no-else-return
78
- "no-eval": "warn", // https://eslint.org/docs/latest/rules/no-eval
79
- "no-extend-native": "warn", // https://eslint.org/docs/latest/rules/no-extend-native
80
- "no-extra-bind": "warn", // https://eslint.org/docs/latest/rules/no-extra-bind
81
- "no-extra-label": "warn", // https://eslint.org/docs/latest/rules/no-extra-label
82
- "no-implicit-globals": "warn", // https://eslint.org/docs/latest/rules/no-implicit-globals
83
- "no-implied-eval": "warn", // https://eslint.org/docs/latest/rules/no-implied-eval
84
- "no-iterator": "warn", // https://eslint.org/docs/latest/rules/no-iterator
85
- "no-label-var": "warn", // https://eslint.org/docs/latest/rules/no-label-var
86
- "no-labels": "warn", // https://eslint.org/docs/latest/rules/no-labels
87
- "no-lone-blocks": "warn", // https://eslint.org/docs/latest/rules/no-lone-blocks
88
- "no-multi-str": "warn", // https://eslint.org/docs/latest/rules/no-multi-str
89
- "no-negated-condition": "warn", // https://eslint.org/docs/latest/rules/no-negated-condition
90
- "no-new": "warn", // https://eslint.org/docs/latest/rules/no-new
91
- "no-new-func": "warn", // https://eslint.org/docs/latest/rules/no-new-func
92
- "no-new-wrappers": "warn", // https://eslint.org/docs/latest/rules/no-new-wrappers
93
- "no-object-constructor": "warn", // https://eslint.org/docs/latest/rules/no-object-constructor
94
- "no-octal-escape": "warn", // https://eslint.org/docs/latest/rules/no-octal-escape
95
- "no-proto": "warn", // https://eslint.org/docs/latest/rules/no-proto
96
- "no-restricted-exports": [
97
- "warn",
98
- {
99
- restrictedNamedExports: [
100
- // If "then" is a function, the module will not be loadedable by an async import()
101
- // because it looks like a promise. The JS engine will call the .then() function in that case
102
- // Since this is super confusing, let's warn the user about it
103
- "then",
104
- ],
105
- },
106
- ], // https://eslint.org/docs/latest/rules/no-restricted-exports
107
- "no-restricted-globals": ["warn", "event"], // https://eslint.org/docs/latest/rules/no-restricted-globals
108
- "no-restricted-syntax": ["warn", "WithStatement"], // https://eslint.org/docs/latest/rules/no-restricted-syntax
109
- "no-script-url": "warn", // https://eslint.org/docs/latest/rules/no-script-url
110
- "no-sequences": "warn", // https://eslint.org/docs/latest/rules/no-sequences
111
- "no-throw-literal": "warn", // https://eslint.org/docs/latest/rules/no-throw-literal
112
- "no-undef-init": "warn", // https://eslint.org/docs/latest/rules/no-undef-init
113
- "no-unneeded-ternary": "warn", // https://eslint.org/docs/latest/rules/no-unneeded-ternary
114
- "no-unused-expressions": ["warn", ruleOptions["no-unused-expressions"]], // https://eslint.org/docs/latest/rules/no-unused-expressions
115
- "no-unused-vars": ["error", ruleOptions["no-unused-vars"]],
116
- "no-useless-call": "warn", // https://eslint.org/docs/latest/rules/no-useless-call
117
- "no-useless-computed-key": "warn", // https://eslint.org/docs/latest/rules/no-useless-computed-key
118
- "no-useless-concat": "warn", // https://eslint.org/docs/latest/rules/no-useless-concat
119
- "no-useless-constructor": "warn", // https://eslint.org/docs/latest/rules/no-useless-constructor
120
- "no-useless-escape": "warn", // https://eslint.org/docs/latest/rules/no-useless-escape
121
- "no-useless-rename": "warn", // https://eslint.org/docs/latest/rules/no-useless-rename
122
- "no-useless-return": "warn", // https://eslint.org/docs/latest/rules/no-useless-return
123
- "no-var": "warn", // https://eslint.org/docs/latest/rules/no-var
124
- "object-shorthand": ["warn", "always"], // https://eslint.org/docs/latest/rules/object-shorthand
125
- "one-var": ["warn", "never"], // https://eslint.org/docs/latest/rules/one-var
126
- "prefer-arrow-callback": "warn", // https://eslint.org/docs/latest/rules/prefer-arrow-callback
127
- "prefer-const": "warn", // https://eslint.org/docs/latest/rules/prefer-const
128
- "prefer-exponentiation-operator": "warn", // https://eslint.org/docs/latest/rules/prefer-exponentiation-operator
129
- "prefer-numeric-literals": "warn", // https://eslint.org/docs/latest/rules/prefer-numeric-literals
130
- "prefer-object-has-own": "warn", // https://eslint.org/docs/latest/rules/prefer-object-has-own
131
- "prefer-promise-reject-errors": "warn", // https://eslint.org/docs/latest/rules/prefer-promise-reject-errors
132
- "prefer-regex-literals": "warn", // https://eslint.org/docs/latest/rules/prefer-regex-literals
133
- "prefer-rest-params": "warn", // https://eslint.org/docs/latest/rules/prefer-rest-params
134
- "prefer-spread": "warn", // https://eslint.org/docs/latest/rules/prefer-spread
135
- strict: "warn", // https://eslint.org/docs/latest/rules/strict
136
- "symbol-description": "warn", // https://eslint.org/docs/latest/rules/symbol-description
137
- yoda: ["warn", "never"], // https://eslint.org/docs/latest/rules/yoda
138
-
139
- // Layout & Formatting
140
- // ----------------------------------------------
141
- "unicode-bom": "warn", // https://eslint.org/docs/latest/rules/unicode-bom
142
- },
143
- },
144
- {
145
- files: globPatterns.tests,
146
- rules: {
147
- // Top-level await might slow down the test suite start up
148
- "unicorn/prefer-top-level-await": "off",
149
- // Nesting is pretty common in tests when you group tests
150
- "max-nested-callbacks": "off",
151
- // In case you want to test errors thrown by a constructor
152
- "no-new": "off",
153
- },
154
- },
155
- ];
156
-
157
- export default javascript;
@@ -1,169 +0,0 @@
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;
@@ -1,206 +0,0 @@
1
- import preferArrow from "eslint-plugin-prefer-arrow";
2
- import tsEslint from "typescript-eslint";
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 typescript =
8
- // We need to do a type assertion here because tsEslint.config() returns
9
- // something that is not assignable to import("eslint").Linter.Config[].
10
- // This seems to be a type inconsistency between eslint and typescript-eslint.
11
- /** @type {import("eslint").Linter.Config[]} */ (
12
- tsEslint.config(
13
- ...tsEslint.configs.strictTypeChecked,
14
- ...tsEslint.configs.stylisticTypeChecked,
15
- {
16
- languageOptions: {
17
- parserOptions: {
18
- projectService: true,
19
- },
20
- },
21
- },
22
- {
23
- files: [
24
- globPatterns.typescript,
25
- globPatterns.typescriptAmbient,
26
- globPatterns.typescriptJsx,
27
- ],
28
- plugins: {
29
- ["prefer-arrow"]: preferArrow,
30
- },
31
- rules: {
32
- "@typescript-eslint/array-type": ["warn", { default: "generic" }],
33
- "@typescript-eslint/ban-ts-comment": [
34
- // https://typescript-eslint.io/rules/ban-ts-comment
35
- "warn",
36
- {
37
- "ts-expect-error": "allow-with-description",
38
- },
39
- ],
40
- "@typescript-eslint/class-literal-property-style": "off", // https://typescript-eslint.io/rules/class-literal-property-style
41
- "@typescript-eslint/consistent-type-definitions": ["warn", "type"], // https://typescript-eslint.io/rules/consistent-type-definitions
42
- "@typescript-eslint/explicit-member-accessibility": [
43
- // https://typescript-eslint.io/rules/explicit-member-accessibility
44
- "warn",
45
- {
46
- accessibility: "no-public",
47
- overrides: {
48
- parameterProperties: "explicit",
49
- },
50
- },
51
- ],
52
- "@typescript-eslint/method-signature-style": ["warn", "property"], // https://typescript-eslint.io/rules/method-signature-style
53
- "@typescript-eslint/naming-convention": [
54
- // https://typescript-eslint.io/rules/naming-convention
55
- "warn",
56
- ...ruleOptions["@typescript-eslint/naming-convention"].defaultRules,
57
- ],
58
- "@typescript-eslint/no-base-to-string": "off", // https://typescript-eslint.io/rules/no-base-to-string
59
- "@typescript-eslint/no-confusing-void-expression": [
60
- // https://typescript-eslint.io/rules/no-confusing-void-expression
61
- "off",
62
- {
63
- ignoreArrowShorthand: true,
64
- ignoreVoidOperator: true,
65
- },
66
- ],
67
- "@typescript-eslint/no-empty-function": "off", // https://typescript-eslint.io/rules/no-empty-function
68
- "@typescript-eslint/no-empty-interface": "off", // https://typescript-eslint.io/rules/no-empty-interface
69
- // `any` is sometimes useful for small and abstract functions.
70
- // Should only be used in isolated parts of the codebase.
71
- // Appropriate usage can only be checked in a PR review.
72
- "@typescript-eslint/no-explicit-any": [
73
- // https://typescript-eslint.io/rules/no-explicit-any
74
- "off",
75
- {
76
- fixToUnknown: false,
77
- ignoreRestArgs: true,
78
- },
79
- ],
80
- "@typescript-eslint/no-non-null-assertion": "off", // https://typescript-eslint.io/rules/no-non-null-assertion
81
- "@typescript-eslint/no-unnecessary-boolean-literal-compare": "off", // https://typescript-eslint.io/rules/no-unnecessary-boolean-literal-compare
82
- "@typescript-eslint/no-unnecessary-condition": [
83
- "warn",
84
- {
85
- allowConstantLoopConditions: true,
86
- },
87
- ], // https://typescript-eslint.io/rules/no-unnecessary-condition
88
- "@typescript-eslint/no-unnecessary-qualifier": "warn", // https://typescript-eslint.io/rules/no-unnecessary-qualifier
89
- "@typescript-eslint/no-unsafe-argument": "off", // https://typescript-eslint.io/rules/no-unsafe-argument
90
- "@typescript-eslint/no-unsafe-assignment": "off", // https://typescript-eslint.io/rules/no-unsafe-assignment
91
- "@typescript-eslint/no-unsafe-call": "off", // https://typescript-eslint.io/rules/no-unsafe-call
92
- "@typescript-eslint/no-unsafe-member-access": "off", // https://typescript-eslint.io/rules/no-unsafe-member-access
93
- "@typescript-eslint/no-unused-expressions": [
94
- // https://typescript-eslint.io/rules/no-unused-expressions
95
- "warn",
96
- {
97
- allowShortCircuit: true,
98
- allowTernary: true,
99
- },
100
- ],
101
- "@typescript-eslint/no-unused-vars": [
102
- // https://typescript-eslint.io/rules/no-unused-vars
103
- "error",
104
- ruleOptions["no-unused-vars"],
105
- ],
106
- "@typescript-eslint/promise-function-async": [
107
- // https://typescript-eslint.io/rules/promise-function-async
108
- "warn",
109
- {
110
- allowAny: true,
111
- allowedPromiseNames: [],
112
- checkArrowFunctions: true,
113
- checkFunctionDeclarations: true,
114
- checkFunctionExpressions: true,
115
- checkMethodDeclarations: true,
116
- },
117
- ],
118
- "@typescript-eslint/require-await": "off", // https://typescript-eslint.io/rules/require-await
119
- "@typescript-eslint/restrict-plus-operands": "off", // https://typescript-eslint.io/rules/restrict-plus-operands
120
- "@typescript-eslint/restrict-template-expressions": [
121
- // https://typescript-eslint.io/rules/restrict-template-expressions
122
- "off",
123
- {
124
- allowBoolean: false,
125
- allowNullable: false,
126
- allowNumber: true,
127
- },
128
- ],
129
- // TS' noImplicitReturns catches this already more effectively
130
- "consistent-return": "off",
131
- "no-return-await": "off",
132
- "@typescript-eslint/return-await": ["warn", "in-try-catch"], // https://typescript-eslint.io/rules/return-await
133
- "@typescript-eslint/switch-exhaustiveness-check": [
134
- "warn",
135
- {
136
- // It should not be necessary to list all possible values for a union type
137
- // explicitly in a switch statement. E.g. if the types are generated, we don't
138
- // want to adjust all switch statements every time the types are changed.
139
- considerDefaultExhaustiveForUnions: true,
140
- },
141
- ], // https://typescript-eslint.io/rules/switch-exhaustiveness-check
142
- camelcase: "off",
143
- "max-lines": [
144
- "warn",
145
- {
146
- max: 1400,
147
- skipBlankLines: true,
148
- skipComments: true,
149
- },
150
- ],
151
- "func-style": ["warn", "expression"], // https://eslint.org/docs/latest/rules/func-style
152
- "prefer-arrow/prefer-arrow-functions": [
153
- // https://github.com/TristonJ/eslint-plugin-prefer-arrow
154
- "warn",
155
- {
156
- disallowPrototype: false,
157
- singleReturnOnly: false,
158
- // We used to enforce arrow functions also for class methods (as class properties)
159
- // but arrow functions in sub-classes can't call their overridden counterpart
160
- // in their super-class, see https://stackoverflow.com/a/52823577
161
- classPropertiesAllowed: false,
162
- },
163
- ],
164
- "@typescript-eslint/use-unknown-in-catch-callback-variable": "off", // https://typescript-eslint.io/rules/use-unknown-in-catch-callback-variable
165
- },
166
- },
167
- {
168
- files: globPatterns.typescriptAmbient,
169
- rules: {
170
- // In d.ts files it might be necessary to merge an existing interface
171
- "@typescript-eslint/consistent-type-definitions": "off", // https://typescript-eslint.io/rules/consistent-type-definitions
172
- // In d.ts files it's sometimes necessary to overload existing methods
173
- "@typescript-eslint/method-signature-style": "off", // https://typescript-eslint.io/rules/method-signature-style
174
- "@typescript-eslint/naming-convention": "off", // https://typescript-eslint.io/rules/naming-convention
175
- // Unused vars can be common in d.ts files when declaration merging is used
176
- "@typescript-eslint/no-unused-vars": "off", // https://typescript-eslint.io/rules/no-unused-vars
177
- // Since d.ts files are used to type external modules, we can't control the coding style
178
- "import/no-default-export": "off",
179
- // When someone wants to extend the typings of a third-party module, it might
180
- // be necessary to import the module so that TypeScript finds the typings that should be extended.
181
- // This is a better alternative to the triple-slash directive
182
- "import/no-unassigned-import": "off",
183
- },
184
- },
185
- {
186
- files: globPatterns.tests,
187
- rules: {
188
- // Type assertions are quite common in tests
189
- "@typescript-eslint/consistent-type-assertions": "off", // https://typescript-eslint.io/rules/consistent-type-assertions
190
- // Mocking often requires to mock objects with a different naming convention
191
- "@typescript-eslint/naming-convention": "off", // https://typescript-eslint.io/rules/naming-convention
192
- // We allow any to be used in tests, so returning it is ok
193
- "@typescript-eslint/no-unsafe-return": "off", // https://typescript-eslint.io/rules/no-unsafe-return
194
- // chai uses these as assertions
195
- "@typescript-eslint/no-unused-expressions": "off", // https://typescript-eslint.io/rules/no-unused-expressions
196
- // It's uncommon to use async/await in Cypress tests
197
- // https://docs.cypress.io/guides/core-concepts/introduction-to-cypress.html#Commands-Are-Asynchronous
198
- "@typescript-eslint/promise-function-async": "off", // https://typescript-eslint.io/rules/promise-function-async
199
- // Passing functions around like this can be common with mocking
200
- "@typescript-eslint/unbound-method": "off", // https://typescript-eslint.io/rules/unbound-method
201
- },
202
- },
203
- )
204
- );
205
-
206
- export default typescript;
@@ -1,31 +0,0 @@
1
- import { globPatterns } from "../lib/glob-patterns.js";
2
-
3
- /** @type {import("eslint").Linter.Config[]} */
4
- export const jsxNoLiterals = [
5
- {
6
- files: [globPatterns.jsx, globPatterns.typescriptJsx],
7
- rules: {
8
- // If we don't adjust this rule, it would autofix the escape hatch
9
- // {"some string"} allowed by "jsx-no-literals"
10
- "react/jsx-curly-brace-presence": [
11
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-curly-brace-presence.md
12
- "warn",
13
- {
14
- children: "always",
15
- props: "never",
16
- },
17
- ],
18
- "react/jsx-no-literals": "warn", // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-literals.md
19
- },
20
- },
21
- {
22
- files: globPatterns.tests,
23
- rules: {
24
- // It's quite common in tests to use example strings
25
- "react/jsx-curly-brace-presence": ["warn", "never"],
26
- "react/jsx-no-literals": "off",
27
- },
28
- },
29
- ];
30
-
31
- export default jsxNoLiterals;
@@ -1,4 +0,0 @@
1
- import typescriptReact from "../../presets/typescript-react.js";
2
- import { jsxNoLiterals } from "../jsx-no-literals.js";
3
-
4
- export default [...typescriptReact, ...jsxNoLiterals];
@@ -1,4 +0,0 @@
1
- /* eslint-disable @typescript-eslint/no-unused-vars */
2
- // eslint-disable-next-line react/jsx-no-literals, react/jsx-curly-brace-presence
3
- const shouldError = <div>test</div>;
4
- const shouldBeOk = <div>{"test"}</div>;
@@ -1,7 +0,0 @@
1
- {
2
- "extends": ["../../../typescript/base.json"],
3
- "compilerOptions": {
4
- "jsx": "react-jsx"
5
- },
6
- "include": ["**/*"]
7
- }
@@ -1,20 +0,0 @@
1
- /** @type {import("eslint").Linter.Config[]} */
2
- export const noDefaultExport = [
3
- {
4
- // Config files often have a single default export
5
- ignores: ["*.config.{js,ts}"],
6
- rules: {
7
- "no-restricted-syntax": [
8
- "error",
9
- {
10
- selector: "ExportDefaultDeclaration",
11
- message:
12
- "Please use named exports instead. Named exports ensure consistent naming and make it easier to auto-import symbols.",
13
- },
14
- ],
15
- },
16
- },
17
- ];
18
-
19
- // Such irony... 🙃
20
- export default noDefaultExport;
@@ -1,4 +0,0 @@
1
- import typescriptReact from "../../presets/typescript-react.js";
2
- import { noDefaultExport } from "../no-default-export.js";
3
-
4
- export default [...typescriptReact, ...noDefaultExport];
@@ -1,2 +0,0 @@
1
- // eslint-disable-next-line no-restricted-syntax
2
- export default "Should not work";
@@ -1,4 +0,0 @@
1
- {
2
- "extends": ["../../../typescript/base.json"],
3
- "include": ["**/*"]
4
- }