Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 80 additions & 0 deletions packages/eslint-plugin/dist/index.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
'use strict';

const all = {
plugins: ["@react-three"],
rules: {
"@react-three/no-clone-in-loop": "error",
"@react-three/no-new-in-loop": "error"
}
};

const recommended = {
plugins: ["@react-three"],
rules: {
"@react-three/no-clone-in-loop": "error",
"@react-three/no-new-in-loop": "error"
}
};

function gitHubUrl(name) {
return `https://github.com/pmndrs/react-three-fiber/blob/master/packages/eslint-plugin/docs/rules/${name}.md`;
}

const rule$1 = {
meta: {
messages: {
noClone: "Cloning vectors in the frame loop can cause performance problems. Instead, create once in a useMemo or a single, shared reference outside of the component."
},
docs: {
url: gitHubUrl("no-clone-in-loop"),
recommended: true,
description: "Disallow cloning vectors in the frame loop which can cause performance problems."
}
},
create(ctx) {
return {
["CallExpression[callee.name=useFrame] CallExpression MemberExpression Identifier[name=clone]"](node) {
ctx.report({
messageId: "noClone",
node
});
}
};
}
};

const rule = {
meta: {
messages: {
noNew: "Instantiating new objects in the frame loop can cause performance problems. Instead, create once in a useMemo or a single, shared reference outside of the component."
},
docs: {
url: gitHubUrl("no-new-in-loop"),
recommended: true,
description: "Disallow instantiating new objects in the frame loop which can cause performance problems."
}
},
create(ctx) {
return {
["CallExpression[callee.name=useFrame] NewExpression"](node) {
ctx.report({
messageId: "noNew",
node
});
}
};
}
};

const index = {
"no-clone-in-loop": rule$1,
"no-new-in-loop": rule
};

const configs = {
all,
recommended
};

exports.configs = configs;
exports.rules = index;
25 changes: 25 additions & 0 deletions packages/eslint-plugin/dist/index.d.cts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import * as eslint from 'eslint';

declare const _default: {
'no-clone-in-loop': eslint.Rule.RuleModule;
'no-new-in-loop': eslint.Rule.RuleModule;
};

declare const configs: {
all: {
plugins: string[];
rules: {
'@react-three/no-clone-in-loop': string;
'@react-three/no-new-in-loop': string;
};
};
recommended: {
plugins: string[];
rules: {
'@react-three/no-clone-in-loop': string;
'@react-three/no-new-in-loop': string;
};
};
};

export { configs, _default as rules };
25 changes: 25 additions & 0 deletions packages/eslint-plugin/dist/index.d.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import * as eslint from 'eslint';

declare const _default: {
'no-clone-in-loop': eslint.Rule.RuleModule;
'no-new-in-loop': eslint.Rule.RuleModule;
};

declare const configs: {
all: {
plugins: string[];
rules: {
'@react-three/no-clone-in-loop': string;
'@react-three/no-new-in-loop': string;
};
};
recommended: {
plugins: string[];
rules: {
'@react-three/no-clone-in-loop': string;
'@react-three/no-new-in-loop': string;
};
};
};

export { configs, _default as rules };
25 changes: 25 additions & 0 deletions packages/eslint-plugin/dist/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import * as eslint from 'eslint';

declare const _default: {
'no-clone-in-loop': eslint.Rule.RuleModule;
'no-new-in-loop': eslint.Rule.RuleModule;
};

declare const configs: {
all: {
plugins: string[];
rules: {
'@react-three/no-clone-in-loop': string;
'@react-three/no-new-in-loop': string;
};
};
recommended: {
plugins: string[];
rules: {
'@react-three/no-clone-in-loop': string;
'@react-three/no-new-in-loop': string;
};
};
};

export { configs, _default as rules };
77 changes: 77 additions & 0 deletions packages/eslint-plugin/dist/index.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
const all = {
plugins: ["@react-three"],
rules: {
"@react-three/no-clone-in-loop": "error",
"@react-three/no-new-in-loop": "error"
}
};

const recommended = {
plugins: ["@react-three"],
rules: {
"@react-three/no-clone-in-loop": "error",
"@react-three/no-new-in-loop": "error"
}
};

function gitHubUrl(name) {
return `https://github.com/pmndrs/react-three-fiber/blob/master/packages/eslint-plugin/docs/rules/${name}.md`;
}

const rule$1 = {
meta: {
messages: {
noClone: "Cloning vectors in the frame loop can cause performance problems. Instead, create once in a useMemo or a single, shared reference outside of the component."
},
docs: {
url: gitHubUrl("no-clone-in-loop"),
recommended: true,
description: "Disallow cloning vectors in the frame loop which can cause performance problems."
}
},
create(ctx) {
return {
["CallExpression[callee.name=useFrame] CallExpression MemberExpression Identifier[name=clone]"](node) {
ctx.report({
messageId: "noClone",
node
});
}
};
}
};

const rule = {
meta: {
messages: {
noNew: "Instantiating new objects in the frame loop can cause performance problems. Instead, create once in a useMemo or a single, shared reference outside of the component."
},
docs: {
url: gitHubUrl("no-new-in-loop"),
recommended: true,
description: "Disallow instantiating new objects in the frame loop which can cause performance problems."
}
},
create(ctx) {
return {
["CallExpression[callee.name=useFrame] NewExpression"](node) {
ctx.report({
messageId: "noNew",
node
});
}
};
}
};

const index = {
"no-clone-in-loop": rule$1,
"no-new-in-loop": rule
};

const configs = {
all,
recommended
};

export { configs, index as rules };
Loading