-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build: add type check using typescript --checkJs #2267
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -157,8 +157,8 @@ function isTagName(node) { | |
|
||
/** | ||
* Extracts the tag name for the JSXAttribute | ||
* @param {Object} node - JSXAttribute being tested. | ||
* @returns {String} tag name | ||
* @param {JSXAttribute} node - JSXAttribute being tested. | ||
* @returns {String|null} tag name | ||
*/ | ||
function getTagName(node) { | ||
if (node && node.parent && node.parent.name && node.parent.name) { | ||
|
@@ -193,7 +193,7 @@ function getStandardName(name) { | |
if (SVGDOM_ATTRIBUTE_NAMES[name]) { | ||
return SVGDOM_ATTRIBUTE_NAMES[name]; | ||
} | ||
let i; | ||
let i = -1; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems to be useless, but I assume tells tsc what the type of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
const found = DOM_PROPERTY_NAMES.some((element, index) => { | ||
i = index; | ||
return element.toLowerCase() === name; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -102,17 +102,17 @@ module.exports = { | |
|
||
/** | ||
* Check if we should report this property node | ||
* @param node | ||
* @param expectedRule | ||
* @param {ASTNode} node | ||
* @param {string} expectedRule | ||
*/ | ||
function reportNodeIncorrectlyPositioned(node, expectedRule) { | ||
// Detect if this node is an expected property declaration adn return the property name | ||
const name = classProperties.find(propertyName => { | ||
if (propertiesToCheck[propertyName](node)) { | ||
return propertyName; | ||
return !!propertyName; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Assuming the return value of |
||
} | ||
|
||
return null; | ||
return false; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. and |
||
}); | ||
|
||
// If name is set but the configured rule does not match expected then report error | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import eslint from 'eslint'; | ||
import estree from 'estree'; | ||
|
||
declare global { | ||
interface ASTNode extends estree.BaseNode { | ||
[_: string]: any; // TODO: fixme | ||
} | ||
type Scope = eslint.Scope.Scope; | ||
type Token = eslint.AST.Token; | ||
type Fixer = eslint.Rule.RuleFixer; | ||
type JSXAttribute = ASTNode; | ||
type JSXSpreadAttribute = ASTNode; | ||
|
||
interface Context extends eslint.SourceCode { | ||
getFirstTokens(node: estree.Node | ASTNode, options?: eslint.SourceCode.CursorWithCountOptions): eslint.AST.Token[]; | ||
} | ||
|
||
type TypeDeclarationBuilder = (annotation: ASTNode, parentName: string, seen: Set<typeof annotation>) => object; | ||
|
||
type TypeDeclarationBuilders = { | ||
[k in string]: TypeDeclarationBuilder; | ||
}; | ||
|
||
type UnionTypeDefinitionChildren = unknown[]; | ||
type UnionTypeDefinition = { | ||
type: 'union' | 'shape'; | ||
children: UnionTypeDefinitionChildren | true; | ||
}; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a harmless extra arg being passed - good to clean up. semver-patch.