oxlint-plugin-react-doctor 0.5.8-dev.c2ce298 → 0.5.8-dev.c72b560

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 (3) hide show
  1. package/LICENSE +14 -1
  2. package/dist/index.js +15 -5
  3. package/package.json +5 -4
package/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- MIT License
1
+ Modified MIT License
2
2
 
3
3
  Copyright (c) 2026 Million Software, Inc.
4
4
 
@@ -19,3 +19,16 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
19
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
20
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  SOFTWARE.
22
+
23
+ Our only modification is that the following uses require prior written
24
+ permission from the copyright holder. To request permission, contact
25
+ founders@million.dev.
26
+
27
+ 1. Using the Software, its source code, or any derivative works thereof, in
28
+ whole or in part, as training, fine-tuning, or evaluation data, or as input
29
+ to any automated pipeline for training or improving any machine learning
30
+ model or AI system.
31
+
32
+ 2. Selling the Software, or offering it to third parties as a paid, hosted, or
33
+ managed product or service (including any commercial API or SaaS offering)
34
+ whose value derives entirely or substantially from the Software.
package/dist/index.js CHANGED
@@ -10789,10 +10789,22 @@ const isWithinChildrenToArray = (jsxNode) => {
10789
10789
  }
10790
10790
  return false;
10791
10791
  };
10792
+ const spreadCanOverwriteKey = (spreadAttribute) => {
10793
+ const argument = spreadAttribute.argument;
10794
+ if (!isNodeOfType(argument, "ObjectExpression")) return true;
10795
+ for (const property of argument.properties) {
10796
+ if (!isNodeOfType(property, "Property")) return true;
10797
+ if (property.computed) return true;
10798
+ const propertyKey = property.key;
10799
+ if (isNodeOfType(propertyKey, "Identifier") && propertyKey.name === "key") return true;
10800
+ if (isNodeOfType(propertyKey, "Literal") && String(propertyKey.value) === "key") return true;
10801
+ }
10802
+ return false;
10803
+ };
10792
10804
  const checkKeyBeforeSpread = (context, openingElement) => {
10793
10805
  let keyIndex = null;
10794
10806
  let keyAttribute = null;
10795
- let firstSpreadIndex = null;
10807
+ let lastOverwritingSpreadIndex = null;
10796
10808
  for (let attributeIndex = 0; attributeIndex < openingElement.attributes.length; attributeIndex++) {
10797
10809
  const attribute = openingElement.attributes[attributeIndex];
10798
10810
  if (isNodeOfType(attribute, "JSXAttribute")) {
@@ -10800,11 +10812,9 @@ const checkKeyBeforeSpread = (context, openingElement) => {
10800
10812
  keyIndex = attributeIndex;
10801
10813
  keyAttribute = attribute;
10802
10814
  }
10803
- } else if (isNodeOfType(attribute, "JSXSpreadAttribute")) {
10804
- if (firstSpreadIndex === null) firstSpreadIndex = attributeIndex;
10805
- }
10815
+ } else if (isNodeOfType(attribute, "JSXSpreadAttribute") && spreadCanOverwriteKey(attribute)) lastOverwritingSpreadIndex = attributeIndex;
10806
10816
  }
10807
- if (keyIndex !== null && firstSpreadIndex !== null && keyIndex > firstSpreadIndex && keyAttribute) context.report({
10817
+ if (keyIndex !== null && lastOverwritingSpreadIndex !== null && lastOverwritingSpreadIndex > keyIndex && keyAttribute) context.report({
10808
10818
  node: keyAttribute,
10809
10819
  message: KEY_BEFORE_SPREAD
10810
10820
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "oxlint-plugin-react-doctor",
3
- "version": "0.5.8-dev.c2ce298",
4
- "description": "oxlint plugin for React Doctor: diagnose React codebases for security, performance, correctness, accessibility, bundle-size, and architecture issues",
3
+ "version": "0.5.8-dev.c72b560",
4
+ "description": "React Doctor rules for oxlint.",
5
5
  "keywords": [
6
6
  "accessibility",
7
7
  "linter",
@@ -21,7 +21,7 @@
21
21
  "bugs": {
22
22
  "url": "https://github.com/millionco/react-doctor/issues"
23
23
  },
24
- "license": "MIT",
24
+ "license": "SEE LICENSE IN LICENSE",
25
25
  "author": "Aiden Bai",
26
26
  "repository": {
27
27
  "type": "git",
@@ -30,7 +30,8 @@
30
30
  },
31
31
  "files": [
32
32
  "dist/**/*.js",
33
- "dist/**/*.d.ts"
33
+ "dist/**/*.d.ts",
34
+ "LICENSE"
34
35
  ],
35
36
  "type": "module",
36
37
  "sideEffects": false,