@lexical/eslint-plugin 0.42.0 → 0.42.1-nightly.20260323.0
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.
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
"use strict";function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];if("string"!=typeof r&&!Array.isArray(r))for(var i in r)"default"===i||i in e||(e[i]=r[i])}return e}function t(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var n,r,i={name:"@lexical/eslint-plugin",version:"0.42.0"},o={},s={},a={};function c(){return n||(n=1,a.getParentAssignmentName=function(e){const t=e.parent;return"VariableDeclarator"===t.type&&t.init===e?t.id:"AssignmentExpression"===t.type&&t.right===e&&"="===t.operator?t.left:void 0}),a}function l(){if(r)return s;r=1;const{getParentAssignmentName:e}=c();return s.getFunctionName=function(t){return"FunctionDeclaration"===t.type||"FunctionExpression"===t.type&&t.id?t.id:"FunctionExpression"===t.type||"ArrowFunctionExpression"===t.type?e(t):void 0},s}var u,f,p,d,g={};function x(){if(u)return g;function e(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}return u=1,g.buildMatcher=function(...t){const n=[],r=[];for(const i of t.flat(1))i&&("string"==typeof i?r.push(/^[(^]/.test(i)?i:`^${e(i)}$`):i&&i instanceof RegExp?i.flags?n.push(e=>i.test(e)):r.push(i.source):"function"==typeof i&&n.push(i));const i=r.map(e=>`(?:${e})`).join("|");if(i){const e=new RegExp(i);n.push(t=>e.test(t))}return e=>{if(e){if("Identifier"!==e.type)throw new Error(`Expecting Identifier, not ${e.type}`);for(const t of n)if(t(e.name,e))return!0}return!1}},g}function m(){if(f)return o;f=1;const{getFunctionName:e}=l(),{getParentAssignmentName:t}=c(),{buildMatcher:n}=x();const r={isDollarFunction:[/^\$[a-z_]/],isIgnoredFunction:[],isLexicalProvider:["parseEditorState","read","registerCommand","registerNodeTransform","update"],isSafeDollarFunction:[/^\$is[A-Z_]/]};function i(e){if(e)return"Identifier"===e.type?e:"MemberExpression"!==e.type||e.computed?void 0:i(e.property)}function s(e,t){const n=Array.isArray(e.options)?e.options[0]:void 0;return n&&t in n?n[t]:void 0}const a={oneOf:[{type:"string"},{contains:{type:"string"},type:"array"}]};return o.rulesOfLexical={create(o){const a=function(e){return e.sourceCode||e.getSourceCode()}(o),c=function(e){const t={};for(const i in r){const o=i;t[o]=n(r[o],s(e,o))}return t}(o),l=new Set,u=new Set,f=[],p=e=>l.add(e),d=e=>l.delete(e),g=n=>{const r=i(function(n){const r=e(n);if(r)return r;const o=n.parent;if("CallExpression"===o.type&&o.arguments[0]===n&&function(e){return e&&"Identifier"===e.type&&/^use([A-Z]|$)/.test(e.name)}(i(o.callee)))return t(o)}(n));f.push({name:r,node:n}),(c.isDollarFunction(r)||c.isIgnoredFunction(r)||c.isLexicalProvider(r))&&p(n)},x=e=>{f.pop(),d(e)};return{ArrowFunctionExpression:g,"ArrowFunctionExpression:exit":x,CallExpression:e=>{if((()=>{if(l.size>0)return!0;const e=f[f.length-1];return e&&"Property"===e.node.parent.type})())return;const t=i(e.callee);if(c.isLexicalProvider(t)||c.isSafeDollarFunction(t))return void p(e);if(!c.isDollarFunction(t))return;const n=(()=>{const e=f[f.length-1];return e?e.name:void 0})();if(!n||u.has(n))return;u.add(n);const r=function(e,t){const n=e.scopeManager;for(let e=t;e;e=e.parent){const r=n.getDeclaredVariables(e).find(e=>e.identifiers.includes(t));if(r)return r;const i=n.acquire(e);if(i)return i.set.get(t.name)||(i.upper?i.upper.set.get(t.name):void 0)}}(a,n),s=function(e,t){const n=function(e){return/^[a-z]/.test(e)?"$"+e:/^[A-Z][a-z]/.test(e)?"$"+e.slice(0,1).toLowerCase()+e.slice(1):`$_${e}`}(e.name);if(t)for(let e=t.scope;e;e=e.upper)if(e.set.has(n))return n+"_";return n}(n,r),d=function(e){if(e&&1===e.defs.length){const[{node:t}]=e.defs;if("ExportNamedDeclaration"===t.parent.type)return t.parent;if("VariableDeclaration"===t.parent.type&&"ExportNamedDeclaration"===t.parent.parent.type)return t.parent.parent}}(r),g={callee:a.getText(e.callee),caller:a.getText(n),suggestName:s},x=e=>{const t=new Set,i=[],o=n=>{t.has(n)||(t.add(n),i.push(e.replaceText(n,s)))};if(o(n),d&&i.push(e.insertTextAfter(d,function({caller:e,suggestName:t}){return`\n/** @deprecated renamed to {@link ${t}} by @lexical/eslint-plugin rules-of-lexical */\nexport const ${e} = ${t};`}(g))),r)for(const e of r.references)o(e.identifier);return i};o.report({data:g,fix:x,messageId:"rulesOfLexicalReport",node:n,suggest:[{data:g,fix:x,messageId:"rulesOfLexicalSuggestion"}]})},"CallExpression:exit":d,ClassBody:p,"ClassBody:exit":d,FunctionDeclaration:g,"FunctionDeclaration:exit":x,FunctionExpression:g,"FunctionExpression:exit":x}},meta:{docs:{description:"enforces the Rules of Lexical",recommended:!0,url:"https://lexical.dev/docs/packages/lexical-eslint-plugin"},fixable:"code",hasSuggestions:!0,messages:{rulesOfLexicalReport:"{{ callee }} called from {{ caller }}, without $ prefix or read/update context",rulesOfLexicalSuggestion:"Rename {{ caller }} to {{ suggestName }}"},schema:[{additionalProperties:!1,properties:{isDollarFunction:a,isIgnoredFunction:a,isLexicalProvider:a,isSafeDollarFunction:a},type:"object"}],type:"suggestion"}},o}function y(){if(d)return p;d=1;const{name:e,version:t}=i,{rulesOfLexical:n}=m(),r={plugins:["@lexical"],rules:{"@lexical/rules-of-lexical":"warn"}},o={configs:{all:r,"flat/all":null,"flat/recommended":null,"legacy-all":r,"legacy-recommended":r,recommended:r},meta:{name:e,version:t},rules:{"rules-of-lexical":n}},s={plugins:{"@lexical":o},rules:{"@lexical/rules-of-lexical":"warn"}};return o.configs["flat/all"]=s,o.configs["flat/recommended"]=s,p=o}var h=y();const v=e({__proto__:null,default:t(h)},[h]);module.exports=v;
|
|
9
|
+
"use strict";function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];if("string"!=typeof r&&!Array.isArray(r))for(var i in r)"default"===i||i in e||(e[i]=r[i])}return e}function t(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var n,r,i={name:"@lexical/eslint-plugin",version:"0.42.1-nightly.20260323.0"},o={},s={},a={};function c(){return n||(n=1,a.getParentAssignmentName=function(e){const t=e.parent;return"VariableDeclarator"===t.type&&t.init===e?t.id:"AssignmentExpression"===t.type&&t.right===e&&"="===t.operator?t.left:void 0}),a}function l(){if(r)return s;r=1;const{getParentAssignmentName:e}=c();return s.getFunctionName=function(t){return"FunctionDeclaration"===t.type||"FunctionExpression"===t.type&&t.id?t.id:"FunctionExpression"===t.type||"ArrowFunctionExpression"===t.type?e(t):void 0},s}var u,f,p,d,g={};function x(){if(u)return g;function e(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}return u=1,g.buildMatcher=function(...t){const n=[],r=[];for(const i of t.flat(1))i&&("string"==typeof i?r.push(/^[(^]/.test(i)?i:`^${e(i)}$`):i&&i instanceof RegExp?i.flags?n.push(e=>i.test(e)):r.push(i.source):"function"==typeof i&&n.push(i));const i=r.map(e=>`(?:${e})`).join("|");if(i){const e=new RegExp(i);n.push(t=>e.test(t))}return e=>{if(e){if("Identifier"!==e.type)throw new Error(`Expecting Identifier, not ${e.type}`);for(const t of n)if(t(e.name,e))return!0}return!1}},g}function m(){if(f)return o;f=1;const{getFunctionName:e}=l(),{getParentAssignmentName:t}=c(),{buildMatcher:n}=x();const r={isDollarFunction:[/^\$[a-z_]/],isIgnoredFunction:[],isLexicalProvider:["parseEditorState","read","registerCommand","registerNodeTransform","update"],isSafeDollarFunction:[/^\$is[A-Z_]/]};function i(e){if(e)return"Identifier"===e.type?e:"MemberExpression"!==e.type||e.computed?void 0:i(e.property)}function s(e,t){const n=Array.isArray(e.options)?e.options[0]:void 0;return n&&t in n?n[t]:void 0}const a={oneOf:[{type:"string"},{contains:{type:"string"},type:"array"}]};return o.rulesOfLexical={create(o){const a=function(e){return e.sourceCode||e.getSourceCode()}(o),c=function(e){const t={};for(const i in r){const o=i;t[o]=n(r[o],s(e,o))}return t}(o),l=new Set,u=new Set,f=[],p=e=>l.add(e),d=e=>l.delete(e),g=n=>{const r=i(function(n){const r=e(n);if(r)return r;const o=n.parent;if("CallExpression"===o.type&&o.arguments[0]===n&&function(e){return e&&"Identifier"===e.type&&/^use([A-Z]|$)/.test(e.name)}(i(o.callee)))return t(o)}(n));f.push({name:r,node:n}),(c.isDollarFunction(r)||c.isIgnoredFunction(r)||c.isLexicalProvider(r))&&p(n)},x=e=>{f.pop(),d(e)};return{ArrowFunctionExpression:g,"ArrowFunctionExpression:exit":x,CallExpression:e=>{if((()=>{if(l.size>0)return!0;const e=f[f.length-1];return e&&"Property"===e.node.parent.type})())return;const t=i(e.callee);if(c.isLexicalProvider(t)||c.isSafeDollarFunction(t))return void p(e);if(!c.isDollarFunction(t))return;const n=(()=>{const e=f[f.length-1];return e?e.name:void 0})();if(!n||u.has(n))return;u.add(n);const r=function(e,t){const n=e.scopeManager;for(let e=t;e;e=e.parent){const r=n.getDeclaredVariables(e).find(e=>e.identifiers.includes(t));if(r)return r;const i=n.acquire(e);if(i)return i.set.get(t.name)||(i.upper?i.upper.set.get(t.name):void 0)}}(a,n),s=function(e,t){const n=function(e){return/^[a-z]/.test(e)?"$"+e:/^[A-Z][a-z]/.test(e)?"$"+e.slice(0,1).toLowerCase()+e.slice(1):`$_${e}`}(e.name);if(t)for(let e=t.scope;e;e=e.upper)if(e.set.has(n))return n+"_";return n}(n,r),d=function(e){if(e&&1===e.defs.length){const[{node:t}]=e.defs;if("ExportNamedDeclaration"===t.parent.type)return t.parent;if("VariableDeclaration"===t.parent.type&&"ExportNamedDeclaration"===t.parent.parent.type)return t.parent.parent}}(r),g={callee:a.getText(e.callee),caller:a.getText(n),suggestName:s},x=e=>{const t=new Set,i=[],o=n=>{t.has(n)||(t.add(n),i.push(e.replaceText(n,s)))};if(o(n),d&&i.push(e.insertTextAfter(d,function({caller:e,suggestName:t}){return`\n/** @deprecated renamed to {@link ${t}} by @lexical/eslint-plugin rules-of-lexical */\nexport const ${e} = ${t};`}(g))),r)for(const e of r.references)o(e.identifier);return i};o.report({data:g,fix:x,messageId:"rulesOfLexicalReport",node:n,suggest:[{data:g,fix:x,messageId:"rulesOfLexicalSuggestion"}]})},"CallExpression:exit":d,ClassBody:p,"ClassBody:exit":d,FunctionDeclaration:g,"FunctionDeclaration:exit":x,FunctionExpression:g,"FunctionExpression:exit":x}},meta:{docs:{description:"enforces the Rules of Lexical",recommended:!0,url:"https://lexical.dev/docs/packages/lexical-eslint-plugin"},fixable:"code",hasSuggestions:!0,messages:{rulesOfLexicalReport:"{{ callee }} called from {{ caller }}, without $ prefix or read/update context",rulesOfLexicalSuggestion:"Rename {{ caller }} to {{ suggestName }}"},schema:[{additionalProperties:!1,properties:{isDollarFunction:a,isIgnoredFunction:a,isLexicalProvider:a,isSafeDollarFunction:a},type:"object"}],type:"suggestion"}},o}function y(){if(d)return p;d=1;const{name:e,version:t}=i,{rulesOfLexical:n}=m(),r={plugins:["@lexical"],rules:{"@lexical/rules-of-lexical":"warn"}},o={configs:{all:r,"flat/all":null,"flat/recommended":null,"legacy-all":r,"legacy-recommended":r,recommended:r},meta:{name:e,version:t},rules:{"rules-of-lexical":n}},s={plugins:{"@lexical":o},rules:{"@lexical/rules-of-lexical":"warn"}};return o.configs["flat/all"]=s,o.configs["flat/recommended"]=s,p=o}var h=y();const v=e({__proto__:null,default:t(h)},[h]);module.exports=v;
|
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];if("string"!=typeof r&&!Array.isArray(r))for(var i in r)"default"===i||i in e||(e[i]=r[i])}return e}function t(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var n,r,i={name:"@lexical/eslint-plugin",version:"0.42.0"},o={},s={},a={};function c(){return n||(n=1,a.getParentAssignmentName=function(e){const t=e.parent;return"VariableDeclarator"===t.type&&t.init===e?t.id:"AssignmentExpression"===t.type&&t.right===e&&"="===t.operator?t.left:void 0}),a}function l(){if(r)return s;r=1;const{getParentAssignmentName:e}=c();return s.getFunctionName=function(t){return"FunctionDeclaration"===t.type||"FunctionExpression"===t.type&&t.id?t.id:"FunctionExpression"===t.type||"ArrowFunctionExpression"===t.type?e(t):void 0},s}var u,f,p,d,g={};function x(){if(u)return g;function e(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}return u=1,g.buildMatcher=function(...t){const n=[],r=[];for(const i of t.flat(1))i&&("string"==typeof i?r.push(/^[(^]/.test(i)?i:`^${e(i)}$`):i&&i instanceof RegExp?i.flags?n.push(e=>i.test(e)):r.push(i.source):"function"==typeof i&&n.push(i));const i=r.map(e=>`(?:${e})`).join("|");if(i){const e=new RegExp(i);n.push(t=>e.test(t))}return e=>{if(e){if("Identifier"!==e.type)throw new Error(`Expecting Identifier, not ${e.type}`);for(const t of n)if(t(e.name,e))return!0}return!1}},g}function m(){if(f)return o;f=1;const{getFunctionName:e}=l(),{getParentAssignmentName:t}=c(),{buildMatcher:n}=x();const r={isDollarFunction:[/^\$[a-z_]/],isIgnoredFunction:[],isLexicalProvider:["parseEditorState","read","registerCommand","registerNodeTransform","update"],isSafeDollarFunction:[/^\$is[A-Z_]/]};function i(e){if(e)return"Identifier"===e.type?e:"MemberExpression"!==e.type||e.computed?void 0:i(e.property)}function s(e,t){const n=Array.isArray(e.options)?e.options[0]:void 0;return n&&t in n?n[t]:void 0}const a={oneOf:[{type:"string"},{contains:{type:"string"},type:"array"}]};return o.rulesOfLexical={create(o){const a=function(e){return e.sourceCode||e.getSourceCode()}(o),c=function(e){const t={};for(const i in r){const o=i;t[o]=n(r[o],s(e,o))}return t}(o),l=new Set,u=new Set,f=[],p=e=>l.add(e),d=e=>l.delete(e),g=n=>{const r=i(function(n){const r=e(n);if(r)return r;const o=n.parent;if("CallExpression"===o.type&&o.arguments[0]===n&&function(e){return e&&"Identifier"===e.type&&/^use([A-Z]|$)/.test(e.name)}(i(o.callee)))return t(o)}(n));f.push({name:r,node:n}),(c.isDollarFunction(r)||c.isIgnoredFunction(r)||c.isLexicalProvider(r))&&p(n)},x=e=>{f.pop(),d(e)};return{ArrowFunctionExpression:g,"ArrowFunctionExpression:exit":x,CallExpression:e=>{if((()=>{if(l.size>0)return!0;const e=f[f.length-1];return e&&"Property"===e.node.parent.type})())return;const t=i(e.callee);if(c.isLexicalProvider(t)||c.isSafeDollarFunction(t))return void p(e);if(!c.isDollarFunction(t))return;const n=(()=>{const e=f[f.length-1];return e?e.name:void 0})();if(!n||u.has(n))return;u.add(n);const r=function(e,t){const n=e.scopeManager;for(let e=t;e;e=e.parent){const r=n.getDeclaredVariables(e).find(e=>e.identifiers.includes(t));if(r)return r;const i=n.acquire(e);if(i)return i.set.get(t.name)||(i.upper?i.upper.set.get(t.name):void 0)}}(a,n),s=function(e,t){const n=function(e){return/^[a-z]/.test(e)?"$"+e:/^[A-Z][a-z]/.test(e)?"$"+e.slice(0,1).toLowerCase()+e.slice(1):`$_${e}`}(e.name);if(t)for(let e=t.scope;e;e=e.upper)if(e.set.has(n))return n+"_";return n}(n,r),d=function(e){if(e&&1===e.defs.length){const[{node:t}]=e.defs;if("ExportNamedDeclaration"===t.parent.type)return t.parent;if("VariableDeclaration"===t.parent.type&&"ExportNamedDeclaration"===t.parent.parent.type)return t.parent.parent}}(r),g={callee:a.getText(e.callee),caller:a.getText(n),suggestName:s},x=e=>{const t=new Set,i=[],o=n=>{t.has(n)||(t.add(n),i.push(e.replaceText(n,s)))};if(o(n),d&&i.push(e.insertTextAfter(d,function({caller:e,suggestName:t}){return`\n/** @deprecated renamed to {@link ${t}} by @lexical/eslint-plugin rules-of-lexical */\nexport const ${e} = ${t};`}(g))),r)for(const e of r.references)o(e.identifier);return i};o.report({data:g,fix:x,messageId:"rulesOfLexicalReport",node:n,suggest:[{data:g,fix:x,messageId:"rulesOfLexicalSuggestion"}]})},"CallExpression:exit":d,ClassBody:p,"ClassBody:exit":d,FunctionDeclaration:g,"FunctionDeclaration:exit":x,FunctionExpression:g,"FunctionExpression:exit":x}},meta:{docs:{description:"enforces the Rules of Lexical",recommended:!0,url:"https://lexical.dev/docs/packages/lexical-eslint-plugin"},fixable:"code",hasSuggestions:!0,messages:{rulesOfLexicalReport:"{{ callee }} called from {{ caller }}, without $ prefix or read/update context",rulesOfLexicalSuggestion:"Rename {{ caller }} to {{ suggestName }}"},schema:[{additionalProperties:!1,properties:{isDollarFunction:a,isIgnoredFunction:a,isLexicalProvider:a,isSafeDollarFunction:a},type:"object"}],type:"suggestion"}},o}function y(){if(d)return p;d=1;const{name:e,version:t}=i,{rulesOfLexical:n}=m(),r={plugins:["@lexical"],rules:{"@lexical/rules-of-lexical":"warn"}},o={configs:{all:r,"flat/all":null,"flat/recommended":null,"legacy-all":r,"legacy-recommended":r,recommended:r},meta:{name:e,version:t},rules:{"rules-of-lexical":n}},s={plugins:{"@lexical":o},rules:{"@lexical/rules-of-lexical":"warn"}};return o.configs["flat/all"]=s,o.configs["flat/recommended"]=s,p=o}var h=y();const v=e({__proto__:null,default:t(h)},[h]);export{v as default};
|
|
9
|
+
function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];if("string"!=typeof r&&!Array.isArray(r))for(var i in r)"default"===i||i in e||(e[i]=r[i])}return e}function t(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var n,r,i={name:"@lexical/eslint-plugin",version:"0.42.1-nightly.20260323.0"},o={},s={},a={};function c(){return n||(n=1,a.getParentAssignmentName=function(e){const t=e.parent;return"VariableDeclarator"===t.type&&t.init===e?t.id:"AssignmentExpression"===t.type&&t.right===e&&"="===t.operator?t.left:void 0}),a}function l(){if(r)return s;r=1;const{getParentAssignmentName:e}=c();return s.getFunctionName=function(t){return"FunctionDeclaration"===t.type||"FunctionExpression"===t.type&&t.id?t.id:"FunctionExpression"===t.type||"ArrowFunctionExpression"===t.type?e(t):void 0},s}var u,f,p,d,g={};function x(){if(u)return g;function e(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}return u=1,g.buildMatcher=function(...t){const n=[],r=[];for(const i of t.flat(1))i&&("string"==typeof i?r.push(/^[(^]/.test(i)?i:`^${e(i)}$`):i&&i instanceof RegExp?i.flags?n.push(e=>i.test(e)):r.push(i.source):"function"==typeof i&&n.push(i));const i=r.map(e=>`(?:${e})`).join("|");if(i){const e=new RegExp(i);n.push(t=>e.test(t))}return e=>{if(e){if("Identifier"!==e.type)throw new Error(`Expecting Identifier, not ${e.type}`);for(const t of n)if(t(e.name,e))return!0}return!1}},g}function m(){if(f)return o;f=1;const{getFunctionName:e}=l(),{getParentAssignmentName:t}=c(),{buildMatcher:n}=x();const r={isDollarFunction:[/^\$[a-z_]/],isIgnoredFunction:[],isLexicalProvider:["parseEditorState","read","registerCommand","registerNodeTransform","update"],isSafeDollarFunction:[/^\$is[A-Z_]/]};function i(e){if(e)return"Identifier"===e.type?e:"MemberExpression"!==e.type||e.computed?void 0:i(e.property)}function s(e,t){const n=Array.isArray(e.options)?e.options[0]:void 0;return n&&t in n?n[t]:void 0}const a={oneOf:[{type:"string"},{contains:{type:"string"},type:"array"}]};return o.rulesOfLexical={create(o){const a=function(e){return e.sourceCode||e.getSourceCode()}(o),c=function(e){const t={};for(const i in r){const o=i;t[o]=n(r[o],s(e,o))}return t}(o),l=new Set,u=new Set,f=[],p=e=>l.add(e),d=e=>l.delete(e),g=n=>{const r=i(function(n){const r=e(n);if(r)return r;const o=n.parent;if("CallExpression"===o.type&&o.arguments[0]===n&&function(e){return e&&"Identifier"===e.type&&/^use([A-Z]|$)/.test(e.name)}(i(o.callee)))return t(o)}(n));f.push({name:r,node:n}),(c.isDollarFunction(r)||c.isIgnoredFunction(r)||c.isLexicalProvider(r))&&p(n)},x=e=>{f.pop(),d(e)};return{ArrowFunctionExpression:g,"ArrowFunctionExpression:exit":x,CallExpression:e=>{if((()=>{if(l.size>0)return!0;const e=f[f.length-1];return e&&"Property"===e.node.parent.type})())return;const t=i(e.callee);if(c.isLexicalProvider(t)||c.isSafeDollarFunction(t))return void p(e);if(!c.isDollarFunction(t))return;const n=(()=>{const e=f[f.length-1];return e?e.name:void 0})();if(!n||u.has(n))return;u.add(n);const r=function(e,t){const n=e.scopeManager;for(let e=t;e;e=e.parent){const r=n.getDeclaredVariables(e).find(e=>e.identifiers.includes(t));if(r)return r;const i=n.acquire(e);if(i)return i.set.get(t.name)||(i.upper?i.upper.set.get(t.name):void 0)}}(a,n),s=function(e,t){const n=function(e){return/^[a-z]/.test(e)?"$"+e:/^[A-Z][a-z]/.test(e)?"$"+e.slice(0,1).toLowerCase()+e.slice(1):`$_${e}`}(e.name);if(t)for(let e=t.scope;e;e=e.upper)if(e.set.has(n))return n+"_";return n}(n,r),d=function(e){if(e&&1===e.defs.length){const[{node:t}]=e.defs;if("ExportNamedDeclaration"===t.parent.type)return t.parent;if("VariableDeclaration"===t.parent.type&&"ExportNamedDeclaration"===t.parent.parent.type)return t.parent.parent}}(r),g={callee:a.getText(e.callee),caller:a.getText(n),suggestName:s},x=e=>{const t=new Set,i=[],o=n=>{t.has(n)||(t.add(n),i.push(e.replaceText(n,s)))};if(o(n),d&&i.push(e.insertTextAfter(d,function({caller:e,suggestName:t}){return`\n/** @deprecated renamed to {@link ${t}} by @lexical/eslint-plugin rules-of-lexical */\nexport const ${e} = ${t};`}(g))),r)for(const e of r.references)o(e.identifier);return i};o.report({data:g,fix:x,messageId:"rulesOfLexicalReport",node:n,suggest:[{data:g,fix:x,messageId:"rulesOfLexicalSuggestion"}]})},"CallExpression:exit":d,ClassBody:p,"ClassBody:exit":d,FunctionDeclaration:g,"FunctionDeclaration:exit":x,FunctionExpression:g,"FunctionExpression:exit":x}},meta:{docs:{description:"enforces the Rules of Lexical",recommended:!0,url:"https://lexical.dev/docs/packages/lexical-eslint-plugin"},fixable:"code",hasSuggestions:!0,messages:{rulesOfLexicalReport:"{{ callee }} called from {{ caller }}, without $ prefix or read/update context",rulesOfLexicalSuggestion:"Rename {{ caller }} to {{ suggestName }}"},schema:[{additionalProperties:!1,properties:{isDollarFunction:a,isIgnoredFunction:a,isLexicalProvider:a,isSafeDollarFunction:a},type:"object"}],type:"suggestion"}},o}function y(){if(d)return p;d=1;const{name:e,version:t}=i,{rulesOfLexical:n}=m(),r={plugins:["@lexical"],rules:{"@lexical/rules-of-lexical":"warn"}},o={configs:{all:r,"flat/all":null,"flat/recommended":null,"legacy-all":r,"legacy-recommended":r,recommended:r},meta:{name:e,version:t},rules:{"rules-of-lexical":n}},s={plugins:{"@lexical":o},rules:{"@lexical/rules-of-lexical":"warn"}};return o.configs["flat/all"]=s,o.configs["flat/recommended"]=s,p=o}var h=y();const v=e({__proto__:null,default:t(h)},[h]);export{v as default};
|