@lexical/eslint-plugin 0.35.1-nightly.20250924.0 → 0.36.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.
|
@@ -25,69 +25,10 @@ function getDefaultExportFromCjs (x) {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
var name$1 = "@lexical/eslint-plugin";
|
|
28
|
-
var
|
|
29
|
-
var keywords = [
|
|
30
|
-
"eslint",
|
|
31
|
-
"eslint-plugin",
|
|
32
|
-
"eslintplugin",
|
|
33
|
-
"lexical",
|
|
34
|
-
"editor"
|
|
35
|
-
];
|
|
36
|
-
var version$1 = "0.35.1-nightly.20250924.0";
|
|
37
|
-
var license = "MIT";
|
|
38
|
-
var repository = {
|
|
39
|
-
type: "git",
|
|
40
|
-
url: "git+https://github.com/facebook/lexical.git",
|
|
41
|
-
directory: "packages/lexical-eslint-plugin"
|
|
42
|
-
};
|
|
43
|
-
var main = "LexicalEslintPlugin.js";
|
|
44
|
-
var types = "index.d.ts";
|
|
45
|
-
var bugs = {
|
|
46
|
-
url: "https://github.com/facebook/lexical/issues"
|
|
47
|
-
};
|
|
48
|
-
var homepage = "https://lexical.dev/docs/packages/lexical-eslint-plugin";
|
|
49
|
-
var sideEffects = false;
|
|
50
|
-
var peerDependencies = {
|
|
51
|
-
eslint: ">=7.31.0 || ^8.0.0"
|
|
52
|
-
};
|
|
53
|
-
var exports$1 = {
|
|
54
|
-
".": {
|
|
55
|
-
"import": {
|
|
56
|
-
types: "./index.d.ts",
|
|
57
|
-
development: "./LexicalEslintPlugin.dev.mjs",
|
|
58
|
-
production: "./LexicalEslintPlugin.prod.mjs",
|
|
59
|
-
node: "./LexicalEslintPlugin.node.mjs",
|
|
60
|
-
"default": "./LexicalEslintPlugin.mjs"
|
|
61
|
-
},
|
|
62
|
-
require: {
|
|
63
|
-
types: "./index.d.ts",
|
|
64
|
-
development: "./LexicalEslintPlugin.dev.js",
|
|
65
|
-
production: "./LexicalEslintPlugin.prod.js",
|
|
66
|
-
"default": "./LexicalEslintPlugin.js"
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
var devDependencies = {
|
|
71
|
-
"@types/eslint": "^8.56.9"
|
|
72
|
-
};
|
|
73
|
-
var module$1 = "LexicalEslintPlugin.mjs";
|
|
28
|
+
var version$1 = "0.36.0";
|
|
74
29
|
var require$$0 = {
|
|
75
30
|
name: name$1,
|
|
76
|
-
|
|
77
|
-
keywords: keywords,
|
|
78
|
-
version: version$1,
|
|
79
|
-
license: license,
|
|
80
|
-
repository: repository,
|
|
81
|
-
main: main,
|
|
82
|
-
types: types,
|
|
83
|
-
bugs: bugs,
|
|
84
|
-
homepage: homepage,
|
|
85
|
-
sideEffects: sideEffects,
|
|
86
|
-
peerDependencies: peerDependencies,
|
|
87
|
-
exports: exports$1,
|
|
88
|
-
devDependencies: devDependencies,
|
|
89
|
-
module: module$1
|
|
90
|
-
};
|
|
31
|
+
version: version$1};
|
|
91
32
|
|
|
92
33
|
var rulesOfLexical$1 = {};
|
|
93
34
|
|
|
@@ -23,69 +23,10 @@ function getDefaultExportFromCjs (x) {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
var name$1 = "@lexical/eslint-plugin";
|
|
26
|
-
var
|
|
27
|
-
var keywords = [
|
|
28
|
-
"eslint",
|
|
29
|
-
"eslint-plugin",
|
|
30
|
-
"eslintplugin",
|
|
31
|
-
"lexical",
|
|
32
|
-
"editor"
|
|
33
|
-
];
|
|
34
|
-
var version$1 = "0.35.1-nightly.20250924.0";
|
|
35
|
-
var license = "MIT";
|
|
36
|
-
var repository = {
|
|
37
|
-
type: "git",
|
|
38
|
-
url: "git+https://github.com/facebook/lexical.git",
|
|
39
|
-
directory: "packages/lexical-eslint-plugin"
|
|
40
|
-
};
|
|
41
|
-
var main = "LexicalEslintPlugin.js";
|
|
42
|
-
var types = "index.d.ts";
|
|
43
|
-
var bugs = {
|
|
44
|
-
url: "https://github.com/facebook/lexical/issues"
|
|
45
|
-
};
|
|
46
|
-
var homepage = "https://lexical.dev/docs/packages/lexical-eslint-plugin";
|
|
47
|
-
var sideEffects = false;
|
|
48
|
-
var peerDependencies = {
|
|
49
|
-
eslint: ">=7.31.0 || ^8.0.0"
|
|
50
|
-
};
|
|
51
|
-
var exports = {
|
|
52
|
-
".": {
|
|
53
|
-
"import": {
|
|
54
|
-
types: "./index.d.ts",
|
|
55
|
-
development: "./LexicalEslintPlugin.dev.mjs",
|
|
56
|
-
production: "./LexicalEslintPlugin.prod.mjs",
|
|
57
|
-
node: "./LexicalEslintPlugin.node.mjs",
|
|
58
|
-
"default": "./LexicalEslintPlugin.mjs"
|
|
59
|
-
},
|
|
60
|
-
require: {
|
|
61
|
-
types: "./index.d.ts",
|
|
62
|
-
development: "./LexicalEslintPlugin.dev.js",
|
|
63
|
-
production: "./LexicalEslintPlugin.prod.js",
|
|
64
|
-
"default": "./LexicalEslintPlugin.js"
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
var devDependencies = {
|
|
69
|
-
"@types/eslint": "^8.56.9"
|
|
70
|
-
};
|
|
71
|
-
var module = "LexicalEslintPlugin.mjs";
|
|
26
|
+
var version$1 = "0.36.0";
|
|
72
27
|
var require$$0 = {
|
|
73
28
|
name: name$1,
|
|
74
|
-
|
|
75
|
-
keywords: keywords,
|
|
76
|
-
version: version$1,
|
|
77
|
-
license: license,
|
|
78
|
-
repository: repository,
|
|
79
|
-
main: main,
|
|
80
|
-
types: types,
|
|
81
|
-
bugs: bugs,
|
|
82
|
-
homepage: homepage,
|
|
83
|
-
sideEffects: sideEffects,
|
|
84
|
-
peerDependencies: peerDependencies,
|
|
85
|
-
exports: exports,
|
|
86
|
-
devDependencies: devDependencies,
|
|
87
|
-
module: module
|
|
88
|
-
};
|
|
29
|
+
version: version$1};
|
|
89
30
|
|
|
90
31
|
var rulesOfLexical$1 = {};
|
|
91
32
|
|
|
@@ -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
|
|
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={name:"@lexical/eslint-plugin",version:"0.36.0"},r={},i={},o={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}};const{getParentAssignmentName:s}=o;i.getFunctionName=function(e){return"FunctionDeclaration"===e.type||"FunctionExpression"===e.type&&e.id?e.id:"FunctionExpression"===e.type||"ArrowFunctionExpression"===e.type?s(e):void 0};var a={};a.buildMatcher=function(...e){const t=[],n=[];for(const i of e.flat(1))i&&("string"==typeof i?n.push(/^[(^]/.test(i)?i:`^${r=i,r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}$`):i&&i instanceof RegExp?i.flags?t.push((e=>i.test(e))):n.push(i.source):"function"==typeof i&&t.push(i));var r;const i=n.map((e=>`(?:${e})`)).join("|");if(i){const e=new RegExp(i);t.push((t=>e.test(t)))}return e=>{if(e){if("Identifier"!==e.type)throw new Error(`Expecting Identifier, not ${e.type}`);for(const n of t)if(n(e.name,e))return!0}return!1}};const{getFunctionName:c}=i,{getParentAssignmentName:l}=o,{buildMatcher:u}=a;const p={isDollarFunction:[/^\$[a-z_]/],isIgnoredFunction:[],isLexicalProvider:["parseEditorState","read","registerCommand","registerNodeTransform","update"],isSafeDollarFunction:[/^\$is[A-Z_]/]};function f(e){if(e)return"Identifier"===e.type?e:"MemberExpression"!==e.type||e.computed?void 0:f(e.property)}function d(e,t){const n=Array.isArray(e.options)?e.options[0]:void 0;return n&&t in n?n[t]:void 0}const g={oneOf:[{type:"string"},{contains:{type:"string"},type:"array"}]};r.rulesOfLexical={create(e){const t=function(e){return e.getSourceCode()}(e),n=function(e){const t={};for(const n in p){const r=n;t[r]=u(p[r],d(e,r))}return t}(e),r=new Set,i=new Set,o=[],s=e=>r.add(e),a=e=>r.delete(e),g=e=>{const t=f(function(e){const t=c(e);if(t)return t;const n=e.parent;if("CallExpression"===n.type&&n.arguments[0]===e&&function(e){return e&&"Identifier"===e.type&&/^use([A-Z]|$)/.test(e.name)}(f(n.callee)))return l(n)}(e));o.push({name:t,node:e}),(n.isDollarFunction(t)||n.isIgnoredFunction(t)||n.isLexicalProvider(t))&&s(e)},x=e=>{o.pop(),a(e)};return{ArrowFunctionExpression:g,"ArrowFunctionExpression:exit":x,CallExpression:a=>{if((()=>{if(r.size>0)return!0;const e=o[o.length-1];return e&&"Property"===e.node.parent.type})())return;const c=f(a.callee);if(n.isLexicalProvider(c)||n.isSafeDollarFunction(c))return void s(a);if(!n.isDollarFunction(c))return;const l=(e=>{const t=o[o.length-1];return t?t.name:void 0})();if(!l||i.has(l))return;i.add(l);const u=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)}}(t,l),p=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}(l,u),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}}(u),g={callee:t.getText(a.callee),caller:t.getText(l),suggestName:p},x=e=>{const t=new Set,n=[],r=r=>{t.has(r)||(t.add(r),n.push(e.replaceText(r,p)))};if(r(l),d&&n.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))),u)for(const e of u.references)r(e.identifier);return n};e.report({data:g,fix:x,messageId:"rulesOfLexicalReport",node:l,suggest:[{data:g,fix:x,messageId:"rulesOfLexicalSuggestion"}]})},"CallExpression:exit":a,ClassBody:s,"ClassBody:exit":a,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:g,isIgnoredFunction:g,isLexicalProvider:g,isSafeDollarFunction:g},type:"object"}],type:"suggestion"}};const{name:x,version:m}=n,{rulesOfLexical:y}=r,h={plugins:["@lexical"],rules:{"@lexical/rules-of-lexical":"warn"}};var v={configs:{all:h,recommended:h},meta:{name:x,version:m},rules:{"rules-of-lexical":y}},F=e({__proto__:null,default:t(v)},[v]);module.exports=F;
|
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
function e(e,t){for(var n=0;n<t.length;n++){var
|
|
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={name:"@lexical/eslint-plugin",version:"0.36.0"},r={},i={},o={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}};const{getParentAssignmentName:s}=o;i.getFunctionName=function(e){return"FunctionDeclaration"===e.type||"FunctionExpression"===e.type&&e.id?e.id:"FunctionExpression"===e.type||"ArrowFunctionExpression"===e.type?s(e):void 0};var a={};a.buildMatcher=function(...e){const t=[],n=[];for(const i of e.flat(1))i&&("string"==typeof i?n.push(/^[(^]/.test(i)?i:`^${r=i,r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}$`):i&&i instanceof RegExp?i.flags?t.push((e=>i.test(e))):n.push(i.source):"function"==typeof i&&t.push(i));var r;const i=n.map((e=>`(?:${e})`)).join("|");if(i){const e=new RegExp(i);t.push((t=>e.test(t)))}return e=>{if(e){if("Identifier"!==e.type)throw new Error(`Expecting Identifier, not ${e.type}`);for(const n of t)if(n(e.name,e))return!0}return!1}};const{getFunctionName:c}=i,{getParentAssignmentName:l}=o,{buildMatcher:u}=a;const p={isDollarFunction:[/^\$[a-z_]/],isIgnoredFunction:[],isLexicalProvider:["parseEditorState","read","registerCommand","registerNodeTransform","update"],isSafeDollarFunction:[/^\$is[A-Z_]/]};function f(e){if(e)return"Identifier"===e.type?e:"MemberExpression"!==e.type||e.computed?void 0:f(e.property)}function d(e,t){const n=Array.isArray(e.options)?e.options[0]:void 0;return n&&t in n?n[t]:void 0}const g={oneOf:[{type:"string"},{contains:{type:"string"},type:"array"}]};r.rulesOfLexical={create(e){const t=function(e){return e.getSourceCode()}(e),n=function(e){const t={};for(const n in p){const r=n;t[r]=u(p[r],d(e,r))}return t}(e),r=new Set,i=new Set,o=[],s=e=>r.add(e),a=e=>r.delete(e),g=e=>{const t=f(function(e){const t=c(e);if(t)return t;const n=e.parent;if("CallExpression"===n.type&&n.arguments[0]===e&&function(e){return e&&"Identifier"===e.type&&/^use([A-Z]|$)/.test(e.name)}(f(n.callee)))return l(n)}(e));o.push({name:t,node:e}),(n.isDollarFunction(t)||n.isIgnoredFunction(t)||n.isLexicalProvider(t))&&s(e)},x=e=>{o.pop(),a(e)};return{ArrowFunctionExpression:g,"ArrowFunctionExpression:exit":x,CallExpression:a=>{if((()=>{if(r.size>0)return!0;const e=o[o.length-1];return e&&"Property"===e.node.parent.type})())return;const c=f(a.callee);if(n.isLexicalProvider(c)||n.isSafeDollarFunction(c))return void s(a);if(!n.isDollarFunction(c))return;const l=(e=>{const t=o[o.length-1];return t?t.name:void 0})();if(!l||i.has(l))return;i.add(l);const u=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)}}(t,l),p=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}(l,u),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}}(u),g={callee:t.getText(a.callee),caller:t.getText(l),suggestName:p},x=e=>{const t=new Set,n=[],r=r=>{t.has(r)||(t.add(r),n.push(e.replaceText(r,p)))};if(r(l),d&&n.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))),u)for(const e of u.references)r(e.identifier);return n};e.report({data:g,fix:x,messageId:"rulesOfLexicalReport",node:l,suggest:[{data:g,fix:x,messageId:"rulesOfLexicalSuggestion"}]})},"CallExpression:exit":a,ClassBody:s,"ClassBody:exit":a,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:g,isIgnoredFunction:g,isLexicalProvider:g,isSafeDollarFunction:g},type:"object"}],type:"suggestion"}};const{name:x,version:m}=n,{rulesOfLexical:y}=r,h={plugins:["@lexical"],rules:{"@lexical/rules-of-lexical":"warn"}};var v={configs:{all:h,recommended:h},meta:{name:x,version:m},rules:{"rules-of-lexical":y}},F=e({__proto__:null,default:t(v)},[v]);export{F as default};
|