-
-
Notifications
You must be signed in to change notification settings - Fork 126
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GitOrigin-RevId: a877280ec0a26692cc1a8aa394eed592d87ab640
- Loading branch information
Showing
13 changed files
with
505 additions
and
522 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,24 @@ | ||
module.exports.meta = { | ||
fixable: false, | ||
hasSuggestions: false, | ||
type: 'problem', | ||
}; | ||
|
||
module.exports.create = function noCopyExpression(context) { | ||
return { | ||
CallExpression(node) { | ||
if ( | ||
node.callee.type === 'MemberExpression' && | ||
node.callee.property.type === 'Identifier' && | ||
node.callee.property.name === 'copy' && | ||
node.parent.type === 'ExpressionStatement' | ||
) { | ||
context.report({ | ||
message: `'copy' calls are side-effect free. Did you forgot to assign the result of this call?`, | ||
node, | ||
}); | ||
} | ||
}, | ||
}; | ||
export default { | ||
create(context) { | ||
return { | ||
CallExpression(node) { | ||
if ( | ||
node.callee.type === 'MemberExpression' && | ||
node.callee.property.type === 'Identifier' && | ||
node.callee.property.name === 'copy' && | ||
node.parent.type === 'ExpressionStatement' | ||
) { | ||
context.report({ | ||
message: `'copy' calls are side-effect free. Did you forgot to assign the result of this call?`, | ||
node, | ||
}); | ||
} | ||
}, | ||
}; | ||
}, | ||
meta: { | ||
fixable: false, | ||
hasSuggestions: false, | ||
type: 'problem', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
module.exports = { | ||
export default { | ||
create(context) { | ||
return { | ||
CallExpression(node) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,38 @@ | ||
module.exports.meta = { | ||
fixable: false, | ||
hasSuggestions: false, | ||
type: 'problem', | ||
}; | ||
|
||
module.exports.create = function noInlineCSS(context) { | ||
return { | ||
TaggedTemplateExpression(node) { | ||
const parent = node.parent; | ||
const nodeToCheck = | ||
(parent?.type === 'ArrowFunctionExpression' && parent.body === node) || | ||
(parent?.parent?.parent?.type === 'ExportNamedDeclaration' && | ||
parent.init === node) | ||
? parent | ||
: parent.type === 'Property' && | ||
parent.value === node && | ||
parent.parent?.type === 'ObjectExpression' | ||
? parent.parent | ||
: node; | ||
export default { | ||
create(context) { | ||
return { | ||
TaggedTemplateExpression(node) { | ||
const parent = node.parent; | ||
const nodeToCheck = | ||
(parent?.type === 'ArrowFunctionExpression' && | ||
parent.body === node) || | ||
(parent?.parent?.parent?.type === 'ExportNamedDeclaration' && | ||
parent.init === node) | ||
? parent | ||
: parent.type === 'Property' && | ||
parent.value === node && | ||
parent.parent?.type === 'ObjectExpression' | ||
? parent.parent | ||
: node; | ||
|
||
if ( | ||
node.tag.type === 'Identifier' && | ||
node.tag.name === 'css' && | ||
nodeToCheck.parent?.parent?.type !== 'Program' && | ||
nodeToCheck.parent?.parent?.parent?.type !== 'Program' | ||
) { | ||
context.report({ | ||
message: | ||
'`css` template literals can only be used at the module top-level.', | ||
node, | ||
}); | ||
} | ||
}, | ||
}; | ||
if ( | ||
node.tag.type === 'Identifier' && | ||
node.tag.name === 'css' && | ||
nodeToCheck.parent?.parent?.type !== 'Program' && | ||
nodeToCheck.parent?.parent?.parent?.type !== 'Program' | ||
) { | ||
context.report({ | ||
message: | ||
'`css` template literals can only be used at the module top-level.', | ||
node, | ||
}); | ||
} | ||
}, | ||
}; | ||
}, | ||
meta: { | ||
fixable: false, | ||
hasSuggestions: false, | ||
type: 'problem', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,24 @@ | ||
module.exports.meta = { | ||
fixable: false, | ||
hasSuggestions: false, | ||
type: 'problem', | ||
}; | ||
|
||
module.exports.create = function noFbtImport(context) { | ||
return { | ||
ImportDeclaration(node) { | ||
if (node.source.value === 'react') { | ||
for (const specifier of node.specifiers) { | ||
if (specifier.imported && specifier.imported.name === 'lazy') { | ||
context.report({ | ||
message: `Importing 'lazy' from 'react' is forbidden. Use '@deities/ui/lib/lazy.tsx' instead.`, | ||
node: specifier, | ||
}); | ||
break; | ||
export default { | ||
create(context) { | ||
return { | ||
ImportDeclaration(node) { | ||
if (node.source.value === 'react') { | ||
for (const specifier of node.specifiers) { | ||
if (specifier.imported && specifier.imported.name === 'lazy') { | ||
context.report({ | ||
message: `Importing 'lazy' from 'react' is forbidden. Use '@deities/ui/lib/lazy.tsx' instead.`, | ||
node: specifier, | ||
}); | ||
break; | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
}; | ||
}, | ||
}; | ||
}, | ||
meta: { | ||
fixable: false, | ||
hasSuggestions: false, | ||
type: 'problem', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,5 +8,6 @@ | |
"url": "git://github.com/nkzw-tech/athena-crisis.git" | ||
}, | ||
"author": "Christoph Nakazawa <[email protected]>", | ||
"type": "module", | ||
"main": "./index.js" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.