Files
FrenoCorp/node_modules/eslint-plugin-solid/dist/rules/no-react-specific-props.js
Michael Freno 7c684a42cc FRE-600: Fix code review blockers
- Consolidated duplicate UndoManagers to single instance
- Fixed connection promise to only resolve on 'connected' status
- Fixed WebSocketProvider import (WebsocketProvider)
- Added proper doc.destroy() cleanup
- Renamed isPresenceInitialized property to avoid conflict

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-04-25 00:08:01 -04:00

56 lines
2.2 KiB
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const utils_1 = require("@typescript-eslint/utils");
const utils_2 = require("../utils");
const createRule = utils_1.ESLintUtils.RuleCreator.withoutDocs;
const reactSpecificProps = [
{ from: "className", to: "class" },
{ from: "htmlFor", to: "for" },
];
exports.default = createRule({
meta: {
type: "problem",
docs: {
description: "Disallow usage of React-specific `className`/`htmlFor` props, which were deprecated in v1.4.0.",
url: "https://github.com/solidjs-community/eslint-plugin-solid/blob/main/docs/no-react-specific-props.md",
},
fixable: "code",
schema: [],
messages: {
prefer: "Prefer the `{{ to }}` prop over the deprecated `{{ from }}` prop.",
noUselessKey: "Elements in a <For> or <Index> list do not need a key prop.",
},
},
defaultOptions: [],
create(context) {
return {
JSXOpeningElement(node) {
for (const { from, to } of reactSpecificProps) {
const classNameAttribute = (0, utils_2.jsxGetProp)(node.attributes, from);
if (classNameAttribute) {
const fix = !(0, utils_2.jsxHasProp)(node.attributes, to)
? (fixer) => fixer.replaceText(classNameAttribute.name, to)
: undefined;
context.report({
node: classNameAttribute,
messageId: "prefer",
data: { from, to },
fix,
});
}
}
if (node.name.type === "JSXIdentifier" && (0, utils_2.isDOMElementName)(node.name.name)) {
const keyProp = (0, utils_2.jsxGetProp)(node.attributes, "key");
if (keyProp) {
context.report({
node: keyProp,
messageId: "noUselessKey",
fix: (fixer) => fixer.remove(keyProp),
});
}
}
},
};
},
});