@newsteam/eslint-config 1.2.15 → 1.2.17

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 (150) hide show
  1. package/dist/index.d.ts +1 -1
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +2 -52
  4. package/dist/plugins/sort-react-dependency-arrays.d.ts +3 -2
  5. package/dist/plugins/sort-react-dependency-arrays.d.ts.map +1 -1
  6. package/dist/plugins/sort-react-dependency-arrays.js +95 -18
  7. package/dist/rules/array-function.d.ts +3 -0
  8. package/dist/rules/array-function.d.ts.map +1 -0
  9. package/dist/rules/array-function.js +56 -0
  10. package/dist/rules/css-modules.d.ts +3 -0
  11. package/dist/rules/css-modules.d.ts.map +1 -0
  12. package/dist/rules/css-modules.js +27 -0
  13. package/dist/rules/destructuring.d.ts +3 -0
  14. package/dist/rules/destructuring.d.ts.map +1 -0
  15. package/dist/rules/destructuring.js +39 -0
  16. package/dist/rules/eslint-comments.d.ts +3 -0
  17. package/dist/rules/eslint-comments.d.ts.map +1 -0
  18. package/dist/rules/eslint-comments.js +77 -0
  19. package/dist/rules/import-newlines.d.ts +3 -0
  20. package/dist/rules/import-newlines.d.ts.map +1 -0
  21. package/dist/rules/import-newlines.js +26 -0
  22. package/dist/rules/import-x.d.ts +3 -0
  23. package/dist/rules/import-x.d.ts.map +1 -0
  24. package/dist/rules/import-x.js +420 -0
  25. package/dist/{rules.d.ts → rules/index.d.ts} +1 -1
  26. package/dist/rules/index.d.ts.map +1 -0
  27. package/dist/{rules.js → rules/index.js} +51 -1
  28. package/dist/rules/next.d.ts +3 -0
  29. package/dist/rules/next.d.ts.map +1 -0
  30. package/dist/rules/next.js +140 -0
  31. package/dist/rules/no-unsanitized.d.ts +3 -0
  32. package/dist/rules/no-unsanitized.d.ts.map +1 -0
  33. package/dist/rules/no-unsanitized.js +38 -0
  34. package/dist/rules/no-useless-assign.d.ts +3 -0
  35. package/dist/rules/no-useless-assign.d.ts.map +1 -0
  36. package/dist/rules/no-useless-assign.js +20 -0
  37. package/dist/rules/node.d.ts +3 -0
  38. package/dist/rules/node.d.ts.map +1 -0
  39. package/dist/rules/node.js +305 -0
  40. package/dist/rules/perfectionist.d.ts +3 -0
  41. package/dist/rules/perfectionist.d.ts.map +1 -0
  42. package/dist/rules/perfectionist.js +94 -0
  43. package/dist/rules/promise.d.ts +3 -0
  44. package/dist/rules/promise.d.ts.map +1 -0
  45. package/dist/rules/promise.js +123 -0
  46. package/dist/rules/react-19-upgrade.d.ts +3 -0
  47. package/dist/rules/react-19-upgrade.d.ts.map +1 -0
  48. package/dist/rules/react-19-upgrade.js +20 -0
  49. package/dist/rules/react-compiler.d.ts +3 -0
  50. package/dist/rules/react-compiler.d.ts.map +1 -0
  51. package/dist/{plugins → rules}/react-compiler.js +7 -9
  52. package/dist/rules/react-hooks.d.ts +3 -0
  53. package/dist/rules/react-hooks.d.ts.map +1 -0
  54. package/dist/rules/react-hooks.js +163 -0
  55. package/dist/rules/react-perf.d.ts +3 -0
  56. package/dist/rules/react-perf.d.ts.map +1 -0
  57. package/dist/rules/react-perf.js +47 -0
  58. package/dist/rules/react-refresh.d.ts +3 -0
  59. package/dist/rules/react-refresh.d.ts.map +1 -0
  60. package/dist/rules/react-refresh.js +19 -0
  61. package/dist/rules/react.d.ts +3 -0
  62. package/dist/rules/react.d.ts.map +1 -0
  63. package/dist/rules/react.js +740 -0
  64. package/dist/rules/security.d.ts +3 -0
  65. package/dist/rules/security.d.ts.map +1 -0
  66. package/dist/rules/security.js +112 -0
  67. package/dist/rules/sort-react-dependency-arrays.d.ts +3 -0
  68. package/dist/rules/sort-react-dependency-arrays.d.ts.map +1 -0
  69. package/dist/rules/sort-react-dependency-arrays.js +12 -0
  70. package/dist/rules/stylistic.d.ts +3 -0
  71. package/dist/rules/stylistic.d.ts.map +1 -0
  72. package/dist/rules/stylistic.js +916 -0
  73. package/dist/rules/typescript.d.ts +3 -0
  74. package/dist/rules/typescript.d.ts.map +1 -0
  75. package/dist/{plugins → rules}/typescript.js +2 -1
  76. package/dist/rules/unicorn.d.ts +3 -0
  77. package/dist/rules/unicorn.d.ts.map +1 -0
  78. package/dist/rules/unicorn.js +998 -0
  79. package/dist/test/index.d.ts +2 -0
  80. package/dist/test/index.d.ts.map +1 -0
  81. package/dist/test/index.js +15 -0
  82. package/package.json +11 -13
  83. package/dist/plugins/array-function.d.ts +0 -3
  84. package/dist/plugins/array-function.d.ts.map +0 -1
  85. package/dist/plugins/array-function.js +0 -58
  86. package/dist/plugins/css-modules.d.ts +0 -3
  87. package/dist/plugins/css-modules.d.ts.map +0 -1
  88. package/dist/plugins/css-modules.js +0 -19
  89. package/dist/plugins/destructuring.d.ts +0 -3
  90. package/dist/plugins/destructuring.d.ts.map +0 -1
  91. package/dist/plugins/destructuring.js +0 -41
  92. package/dist/plugins/eslint-comments.d.ts +0 -3
  93. package/dist/plugins/eslint-comments.d.ts.map +0 -1
  94. package/dist/plugins/eslint-comments.js +0 -79
  95. package/dist/plugins/import-newlines.d.ts +0 -3
  96. package/dist/plugins/import-newlines.d.ts.map +0 -1
  97. package/dist/plugins/import-newlines.js +0 -28
  98. package/dist/plugins/import-x.d.ts +0 -3
  99. package/dist/plugins/import-x.d.ts.map +0 -1
  100. package/dist/plugins/import-x.js +0 -418
  101. package/dist/plugins/newline-destructuring.d.ts +0 -3
  102. package/dist/plugins/newline-destructuring.d.ts.map +0 -1
  103. package/dist/plugins/newline-destructuring.js +0 -26
  104. package/dist/plugins/next.d.ts +0 -3
  105. package/dist/plugins/next.d.ts.map +0 -1
  106. package/dist/plugins/next.js +0 -142
  107. package/dist/plugins/no-unsanitized.d.ts +0 -3
  108. package/dist/plugins/no-unsanitized.d.ts.map +0 -1
  109. package/dist/plugins/no-unsanitized.js +0 -40
  110. package/dist/plugins/no-useless-assign.d.ts +0 -3
  111. package/dist/plugins/no-useless-assign.d.ts.map +0 -1
  112. package/dist/plugins/no-useless-assign.js +0 -22
  113. package/dist/plugins/node.d.ts +0 -3
  114. package/dist/plugins/node.d.ts.map +0 -1
  115. package/dist/plugins/node.js +0 -307
  116. package/dist/plugins/perfectionist.d.ts +0 -3
  117. package/dist/plugins/perfectionist.d.ts.map +0 -1
  118. package/dist/plugins/perfectionist.js +0 -96
  119. package/dist/plugins/promise.d.ts +0 -3
  120. package/dist/plugins/promise.d.ts.map +0 -1
  121. package/dist/plugins/promise.js +0 -125
  122. package/dist/plugins/react-19-upgrade.d.ts +0 -3
  123. package/dist/plugins/react-19-upgrade.d.ts.map +0 -1
  124. package/dist/plugins/react-19-upgrade.js +0 -22
  125. package/dist/plugins/react-compiler.d.ts +0 -3
  126. package/dist/plugins/react-compiler.d.ts.map +0 -1
  127. package/dist/plugins/react-hooks.d.ts +0 -3
  128. package/dist/plugins/react-hooks.d.ts.map +0 -1
  129. package/dist/plugins/react-hooks.js +0 -165
  130. package/dist/plugins/react-perf.d.ts +0 -3
  131. package/dist/plugins/react-perf.d.ts.map +0 -1
  132. package/dist/plugins/react-perf.js +0 -49
  133. package/dist/plugins/react-refresh.d.ts +0 -3
  134. package/dist/plugins/react-refresh.d.ts.map +0 -1
  135. package/dist/plugins/react-refresh.js +0 -21
  136. package/dist/plugins/react.d.ts +0 -3
  137. package/dist/plugins/react.d.ts.map +0 -1
  138. package/dist/plugins/react.js +0 -738
  139. package/dist/plugins/security.d.ts +0 -3
  140. package/dist/plugins/security.d.ts.map +0 -1
  141. package/dist/plugins/security.js +0 -114
  142. package/dist/plugins/stylistic.d.ts +0 -3
  143. package/dist/plugins/stylistic.d.ts.map +0 -1
  144. package/dist/plugins/stylistic.js +0 -901
  145. package/dist/plugins/typescript.d.ts +0 -3
  146. package/dist/plugins/typescript.d.ts.map +0 -1
  147. package/dist/plugins/unicorn.d.ts +0 -3
  148. package/dist/plugins/unicorn.d.ts.map +0 -1
  149. package/dist/plugins/unicorn.js +0 -994
  150. package/dist/rules.d.ts.map +0 -1
@@ -4,13 +4,11 @@ import reactCompiler from "eslint-plugin-react-compiler";
4
4
  *
5
5
  * https://www.npmjs.com/package/eslint-plugin-react-compiler
6
6
  */
7
- export const reactCompilerPlugin = [
8
- {
9
- plugins: {
10
- "react-compiler": reactCompiler,
11
- },
12
- rules: {
13
- "react-compiler/react-compiler": "warn",
14
- },
7
+ export const reactCompilerPluginConfig = {
8
+ plugins: {
9
+ "react-compiler": reactCompiler,
15
10
  },
16
- ];
11
+ rules: {
12
+ "react-compiler/react-compiler": "warn",
13
+ },
14
+ };
@@ -0,0 +1,3 @@
1
+ import type { Linter } from "eslint";
2
+ export declare const reactHooksPluginConfig: Linter.Config;
3
+ //# sourceMappingURL=react-hooks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react-hooks.d.ts","sourceRoot":"","sources":["../../src/rules/react-hooks.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAWrC,eAAO,MAAM,sBAAsB,EAAE,MAAM,CAAC,MAwL3C,CAAC"}
@@ -0,0 +1,163 @@
1
+ import reactHooks from "eslint-plugin-react-hooks";
2
+ /*
3
+ * This ESLint plugin enforces the Rules of Hooks.
4
+ *
5
+ * It is a part of the Hooks API for React.
6
+ *
7
+ * https://www.npmjs.com/package/eslint-plugin-react-hooks
8
+ * https://reactjs.org/docs/hooks-rules.html
9
+ */
10
+ export const reactHooksPluginConfig = {
11
+ plugins: {
12
+ "react-hooks": reactHooks,
13
+ },
14
+ rules: {
15
+ /*
16
+ * Verifies that automatic effect dependencies are compiled if opted-in
17
+ */
18
+ "react-hooks/automatic-effect-dependencies": "warn",
19
+ /*
20
+ * Validates against calling capitalized functions/methods instead of using JSX
21
+ */
22
+ "react-hooks/capitalized-calls": "warn",
23
+ /*
24
+ * Validates against higher order functions defining nested components or hooks.
25
+ * Components and hooks should be defined at the module level
26
+ */
27
+ "react-hooks/component-hook-factories": "warn",
28
+ /*
29
+ * Validates the compiler configuration options
30
+ */
31
+ "react-hooks/config": "warn",
32
+ /*
33
+ * Validates usage of error boundaries instead of try/catch for errors in child components
34
+ */
35
+ "react-hooks/error-boundaries": "warn",
36
+ /*
37
+ * Checks effect dependencies
38
+ *
39
+ * This is off because it doesn't always make sense to list all dependencies
40
+ */
41
+ // TODO (this should be turned on eventually)
42
+ "react-hooks/exhaustive-deps": "off",
43
+ /*
44
+ * Validates usage of fbt
45
+ *
46
+ * We don't use fbt
47
+ */
48
+ "react-hooks/fbt": "off",
49
+ /*
50
+ * Validates usage of `fire`
51
+ *
52
+ * We don't use fire
53
+ */
54
+ "react-hooks/fire": "off",
55
+ /*
56
+ * Validates configuration of
57
+ *
58
+ * We don't use gating
59
+ *
60
+ * https://react.dev/reference/react-compiler/gating
61
+ */
62
+ "react-hooks/gating": "off",
63
+ /*
64
+ * Validates against assignment/mutation of globals during render, part of ensuring that [side effects must render outside of render](https://react.dev/reference/rules/components-and-hooks-must-be-pure#side-effects-must-run-outside-of-render)
65
+ */
66
+ "react-hooks/globals": "warn",
67
+ /*
68
+ * Validates the rules of hooks
69
+ */
70
+ "react-hooks/hooks": "warn",
71
+ /*
72
+ * Validates against mutating props, state, and other values that [are immutable](https://react.dev/reference/rules/components-and-hooks-must-be-pure#props-and-state-are-immutable)
73
+ */
74
+ "react-hooks/immutability": "warn",
75
+ /*
76
+ * Validates against usage of libraries which are incompatible with memoization (manual or automatic)
77
+ */
78
+ "react-hooks/incompatible-library": "warn",
79
+ /*
80
+ * Internal invariants
81
+ */
82
+ "react-hooks/invariant": "warn",
83
+ /*
84
+ * Validates that effect dependencies are memoized
85
+ */
86
+ "react-hooks/memoized-effect-dependencies": "warn",
87
+ /*
88
+ * Checks for unnessessary setState calls in useEffect hooks
89
+ *
90
+ * https://react.dev/learn/you-might-not-need-an-effect#updating-state-based-on-props-or-state
91
+ */
92
+ "react-hooks/no-deriving-state-in-effects": "warn",
93
+ // Apprently this doesn't exist anymore
94
+ // "react-hooks/no-unused-directives": "warn",
95
+ /*
96
+ * Validates that existing manual memoized is preserved by the compiler.
97
+ * React Compiler will only compile components and hooks if its inference
98
+ *
99
+ * https://react.dev/learn/react-compiler/introduction#what-should-i-do-about-usememo-usecallback-and-reactmemo
100
+ *
101
+ */
102
+ // TODO (this should be turned on eventually)
103
+ "react-hooks/preserve-manual-memoization": "off",
104
+ /*
105
+ * Validates that [components/hooks are pure](https://react.dev/reference/rules/components-and-hooks-must-be-pure) by checking that they do not call known-impure functions
106
+ */
107
+ "react-hooks/purity": "warn",
108
+ /*
109
+ * Validates correct usage of refs, not reading/writing during render. See the "pitfalls" section in [`useRef()` usage](https://react.dev/reference/react/useRef#usage)
110
+ *
111
+ * see https://medium.com/@teh_builder/ref-objects-inside-useeffect-hooks-eb7c15198780
112
+ */
113
+ "react-hooks/refs": "warn",
114
+ /*
115
+ * Validates against suppression of other rules
116
+ *
117
+ * Yeah we can suppress without having to do it twice
118
+ */
119
+ "react-hooks/rule-suppression": "off",
120
+ /*
121
+ * Validates the rules of hooks
122
+ */
123
+ "react-hooks/rules-of-hooks": "warn",
124
+ /*
125
+ * Validates against calling setState synchronously in an effect, which can lead to re-renders that degrade performance
126
+ */
127
+ // TODO (this should be turned on eventually)
128
+ "react-hooks/set-state-in-effect": "off",
129
+ /*
130
+ * Validates against setting state during render, which can trigger additional renders and potential infinite render loops
131
+ */
132
+ "react-hooks/set-state-in-render": "warn",
133
+ /*
134
+ * Validates that components are static, not recreated every render.
135
+ * Components that are recreated dynamically can reset state and trigger excessive re-rendering
136
+ */
137
+ "react-hooks/static-components": "warn",
138
+ /*
139
+ * Validates against invalid syntax
140
+ */
141
+ "react-hooks/syntax": "warn",
142
+ /*
143
+ * Unimplemented features
144
+ *
145
+ * It's unclear what this does, leaving it off
146
+ */
147
+ "react-hooks/todo": "off",
148
+ /*
149
+ * Validates against syntax that we do not plan to support in React Compiler
150
+ */
151
+ "react-hooks/unsupported-syntax": "warn",
152
+ /*
153
+ * Validates usage of the useMemo() hook against common mistakes.
154
+ *
155
+ * https://react.dev/reference/react/useMemo
156
+ */
157
+ "react-hooks/use-memo": "warn",
158
+ /*
159
+ * Validates that useMemos always return a value. See [`useMemo()` docs](https://react.dev/reference/react/useMemo) for more information.
160
+ */
161
+ "react-hooks/void-use-memo": "warn",
162
+ },
163
+ };
@@ -0,0 +1,3 @@
1
+ import type { Linter } from "eslint";
2
+ export declare const reactPerfPluginConfig: Linter.Config;
3
+ //# sourceMappingURL=react-perf.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react-perf.d.ts","sourceRoot":"","sources":["../../src/rules/react-perf.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AASrC,eAAO,MAAM,qBAAqB,EAAE,MAAM,CAAC,MA0C1C,CAAC"}
@@ -0,0 +1,47 @@
1
+ import { fixupPluginRules } from "@eslint/compat";
2
+ import reactPerf from "eslint-plugin-react-perf";
3
+ /*
4
+ * Performance-minded React linting rules for ESLint motivated by esamatti's
5
+ * post "React.js pure render performance anti-pattern".
6
+ * https://medium.com/@esamatti/react-js-pure-render-performance-anti-pattern-fb88c101332f
7
+ *
8
+ * https://www.npmjs.com/package/eslint-plugin-react-perf
9
+ */
10
+ export const reactPerfPluginConfig = {
11
+ plugins: {
12
+ "react-perf": fixupPluginRules(reactPerf),
13
+ },
14
+ rules: {
15
+ /*
16
+ * Prevent JSX that are local to the current method from being used as values of JSX props
17
+ *
18
+ * We're unwilling to turn this on since it's a pretty common pattern and
19
+ * we're not convinced it'll make a noticable difference.
20
+ *
21
+ * https://github.com/cvazac/eslint-plugin-react-perf/blob/HEAD/docs/rules/jsx-no-jsx-as-prop.md
22
+ */
23
+ "react-perf/jsx-no-jsx-as-prop": "off",
24
+ /*
25
+ * Prevent Arrays that are local to the current method from being used as values of JSX props
26
+ *
27
+ * So common that we do this it's annoying
28
+ *
29
+ * https://github.com/cvazac/eslint-plugin-react-perf/blob/HEAD/docs/rules/jsx-no-new-array-as-prop.md
30
+ */
31
+ "react-perf/jsx-no-new-array-as-prop": "off",
32
+ /*
33
+ * Prevent Functions that are local to the current method from being used as values of JSX props
34
+ *
35
+ * https://github.com/cvazac/eslint-plugin-react-perf/blob/HEAD/docs/rules/jsx-no-new-function-as-prop.md
36
+ */
37
+ "react-perf/jsx-no-new-function-as-prop": "warn",
38
+ /*
39
+ * Prevent Objects that are local to the current method from being used as values of JSX props
40
+ *
41
+ * This is really annoying in practice, we're turning it off
42
+ *
43
+ * https://github.com/cvazac/eslint-plugin-react-perf/blob/HEAD/docs/rules/jsx-no-new-object-as-prop.md
44
+ */
45
+ "react-perf/jsx-no-new-object-as-prop": "off",
46
+ },
47
+ };
@@ -0,0 +1,3 @@
1
+ import type { Linter } from "eslint";
2
+ export declare const reactRefreshPluginConfig: Linter.Config;
3
+ //# sourceMappingURL=react-refresh.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react-refresh.d.ts","sourceRoot":"","sources":["../../src/rules/react-refresh.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAQrC,eAAO,MAAM,wBAAwB,EAAE,MAAM,CAAC,MAc7C,CAAC"}
@@ -0,0 +1,19 @@
1
+ import reactRefresh from "eslint-plugin-react-refresh";
2
+ /*
3
+ * Validate that your components can safely be updated with fast refresh.
4
+ *
5
+ * https://github.com/ArnaudBarre/eslint-plugin-react-refresh
6
+ */
7
+ export const reactRefreshPluginConfig = {
8
+ plugins: {
9
+ "react-refresh": reactRefresh,
10
+ },
11
+ rules: {
12
+ /*
13
+ * Validate that your components can safely be updated with fast refresh.
14
+ *
15
+ * https://github.com/ArnaudBarre/eslint-plugin-react-refresh#usage
16
+ */
17
+ "react-refresh/only-export-components": "warn",
18
+ },
19
+ };
@@ -0,0 +1,3 @@
1
+ import type { Linter } from "eslint";
2
+ export declare const reactPluginConfig: Linter.Config;
3
+ //# sourceMappingURL=react.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../../src/rules/react.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAQrC,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAm0BtC,CAAC"}