pasika 0.10.88 → 0.10.89
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.
- package/dist/eslint/pasika/index.js +11 -0
- package/package.json +1 -1
|
@@ -5144,10 +5144,21 @@ var noMixedConcernsRule = {
|
|
|
5144
5144
|
if (components.length > 1) return;
|
|
5145
5145
|
const componentName = components[0]?.name;
|
|
5146
5146
|
if (!componentName) return;
|
|
5147
|
+
const isNextPageOrLayout = /(?:^|[/\\])src[/\\]app[/\\](?:[^/\\]+[/\\])*(?:page|layout)\.tsx$/.test(
|
|
5148
|
+
context.filename
|
|
5149
|
+
);
|
|
5147
5150
|
for (const statement of context.sourceCode.ast.body) {
|
|
5148
5151
|
if (statement.type === "ExportNamedDeclaration") {
|
|
5149
5152
|
if (/^export\s+(?:type|interface)\b/.test(context.sourceCode.getText(statement))) continue;
|
|
5150
5153
|
const declaration = statement.declaration;
|
|
5154
|
+
if (isNextPageOrLayout && declaration?.type === "VariableDeclaration" && declaration.declarations.every(
|
|
5155
|
+
(item) => item.id.type === "Identifier" && (item.id.name === "metadata" || item.id.name === "viewport")
|
|
5156
|
+
)) {
|
|
5157
|
+
continue;
|
|
5158
|
+
}
|
|
5159
|
+
if (isNextPageOrLayout && declaration?.type === "FunctionDeclaration" && (declaration.id.name === "generateMetadata" || declaration.id.name === "generateViewport")) {
|
|
5160
|
+
continue;
|
|
5161
|
+
}
|
|
5151
5162
|
if (declaration?.type === "FunctionDeclaration" && declaration.id.name === componentName) continue;
|
|
5152
5163
|
if (declaration?.type === "VariableDeclaration" && declaration.declarations.length === 1 && declaration.declarations[0]?.id.type === "Identifier" && declaration.declarations[0].id.name === componentName) {
|
|
5153
5164
|
continue;
|