Skip to content

fix: exclude unused files from publish process #1141

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

Closed
wants to merge 3 commits into from
Closed
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
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ test
.*
*.log
CONTRIBUTING.md
tsconfig*.json
90 changes: 45 additions & 45 deletions src/jsdocUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,10 @@ const flattenRoots = (params, root = '') => {
};

/**
* @param {import('@typescript-eslint/types').TSESTree.TSIndexSignature|
* import('@typescript-eslint/types').TSESTree.TSConstructSignatureDeclaration|
* import('@typescript-eslint/types').TSESTree.TSCallSignatureDeclaration|
* import('@typescript-eslint/types').TSESTree.TSPropertySignature} propSignature
* @param {import('@typescript-eslint/types/dist').TSESTree.TSIndexSignature|
* import('@typescript-eslint/types/dist').TSESTree.TSConstructSignatureDeclaration|
* import('@typescript-eslint/types/dist').TSESTree.TSCallSignatureDeclaration|
* import('@typescript-eslint/types/dist').TSESTree.TSPropertySignature} propSignature
* @returns {undefined|string|[string, string[]]}
*/
const getPropertiesFromPropertySignature = (propSignature) => {
Expand All @@ -183,13 +183,13 @@ const getPropertiesFromPropertySignature = (propSignature) => {

if (propSignature.typeAnnotation && propSignature.typeAnnotation.typeAnnotation.type === 'TSTypeLiteral') {
return [
/** @type {import('@typescript-eslint/types').TSESTree.Identifier} */ (
/** @type {import('@typescript-eslint/types/dist').TSESTree.Identifier} */ (
propSignature.key
).name,
propSignature.typeAnnotation.typeAnnotation.members.map((member) => {
return /** @type {string} */ (
getPropertiesFromPropertySignature(
/** @type {import('@typescript-eslint/types').TSESTree.TSPropertySignature} */ (
/** @type {import('@typescript-eslint/types/dist').TSESTree.TSPropertySignature} */ (
member
),
)
Expand All @@ -198,7 +198,7 @@ const getPropertiesFromPropertySignature = (propSignature) => {
];
}

return /** @type {import('@typescript-eslint/types').TSESTree.Identifier} */ (
return /** @type {import('@typescript-eslint/types/dist').TSESTree.Identifier} */ (
propSignature.key
).name;
};
Expand All @@ -217,13 +217,13 @@ const getFunctionParameterNames = (
* @param {import('estree').Identifier|import('estree').AssignmentPattern|
* import('estree').ObjectPattern|import('estree').Property|
* import('estree').RestElement|import('estree').ArrayPattern|
* import('@typescript-eslint/types').TSESTree.TSParameterProperty|
* import('@typescript-eslint/types').TSESTree.Property|
* import('@typescript-eslint/types').TSESTree.RestElement|
* import('@typescript-eslint/types').TSESTree.Identifier|
* import('@typescript-eslint/types').TSESTree.ObjectPattern|
* import('@typescript-eslint/types').TSESTree.BindingName|
* import('@typescript-eslint/types').TSESTree.Parameter
* import('@typescript-eslint/types/dist').TSESTree.TSParameterProperty|
* import('@typescript-eslint/types/dist').TSESTree.Property|
* import('@typescript-eslint/types/dist').TSESTree.RestElement|
* import('@typescript-eslint/types/dist').TSESTree.Identifier|
* import('@typescript-eslint/types/dist').TSESTree.ObjectPattern|
* import('@typescript-eslint/types/dist').TSESTree.BindingName|
* import('@typescript-eslint/types/dist').TSESTree.Parameter
* } param
* @param {boolean} [isProperty]
* @returns {ParamNameInfo|[string, ParamNameInfo[]]}
Expand All @@ -234,16 +234,16 @@ const getFunctionParameterNames = (

if ('typeAnnotation' in param || hasLeftTypeAnnotation) {
const typeAnnotation = hasLeftTypeAnnotation ?
/** @type {import('@typescript-eslint/types').TSESTree.Identifier} */ (
/** @type {import('@typescript-eslint/types/dist').TSESTree.Identifier} */ (
param.left
).typeAnnotation :
/** @type {import('@typescript-eslint/types').TSESTree.Identifier|import('@typescript-eslint/types').TSESTree.ObjectPattern} */
/** @type {import('@typescript-eslint/types/dist').TSESTree.Identifier|import('@typescript-eslint/types/dist').TSESTree.ObjectPattern} */
(param).typeAnnotation;

if (typeAnnotation?.typeAnnotation?.type === 'TSTypeLiteral') {
const propertyNames = typeAnnotation.typeAnnotation.members.map((member) => {
return getPropertiesFromPropertySignature(
/** @type {import('@typescript-eslint/types').TSESTree.TSPropertySignature} */
/** @type {import('@typescript-eslint/types/dist').TSESTree.TSPropertySignature} */
(member),
);
});
Expand All @@ -257,10 +257,10 @@ const getFunctionParameterNames = (
if ('name' in param || hasLeftName) {
return [
hasLeftName ?
/** @type {import('@typescript-eslint/types').TSESTree.Identifier} */ (
/** @type {import('@typescript-eslint/types/dist').TSESTree.Identifier} */ (
param.left
).name :
/** @type {import('@typescript-eslint/types').TSESTree.Identifier} */ (
/** @type {import('@typescript-eslint/types/dist').TSESTree.Identifier} */ (
param
).name,
flattened,
Expand Down Expand Up @@ -288,12 +288,12 @@ const getFunctionParameterNames = (
param
).left.type === 'ObjectPattern')
) {
const properties = /** @type {import('@typescript-eslint/types').TSESTree.ObjectPattern} */ (
const properties = /** @type {import('@typescript-eslint/types/dist').TSESTree.ObjectPattern} */ (
param
).properties ||
/** @type {import('estree').ObjectPattern} */
(
/** @type {import('@typescript-eslint/types').TSESTree.AssignmentPattern} */ (
/** @type {import('@typescript-eslint/types/dist').TSESTree.AssignmentPattern} */ (
param
).left
)?.properties;
Expand Down Expand Up @@ -435,8 +435,8 @@ const getFunctionParameterNames = (
].includes(param.type)) {
return {
isRestProperty: isProperty,
name: /** @type {import('@typescript-eslint/types').TSESTree.Identifier} */ (
/** @type {import('@typescript-eslint/types').TSESTree.RestElement} */ (
name: /** @type {import('@typescript-eslint/types/dist').TSESTree.Identifier} */ (
/** @type {import('@typescript-eslint/types/dist').TSESTree.RestElement} */ (
param
).argument).name,
restElement: true,
Expand All @@ -445,8 +445,8 @@ const getFunctionParameterNames = (

if (param.type === 'TSParameterProperty') {
return getParamName(
/** @type {import('@typescript-eslint/types').TSESTree.Identifier} */ (
/** @type {import('@typescript-eslint/types').TSESTree.TSParameterProperty} */ (
/** @type {import('@typescript-eslint/types/dist').TSESTree.Identifier} */ (
/** @type {import('@typescript-eslint/types/dist').TSESTree.TSParameterProperty} */ (
param
).parameter
),
Expand All @@ -461,9 +461,9 @@ const getFunctionParameterNames = (
return [];
}

return (/** @type {import('@typescript-eslint/types').TSESTree.FunctionDeclaration} */ (
return (/** @type {import('@typescript-eslint/types/dist').TSESTree.FunctionDeclaration} */ (
functionNode
).params || /** @type {import('@typescript-eslint/types').TSESTree.MethodDefinition} */ (
).params || /** @type {import('@typescript-eslint/types/dist').TSESTree.MethodDefinition} */ (
functionNode
).value?.params || []).map((param) => {
return getParamName(param);
Expand All @@ -476,7 +476,7 @@ const getFunctionParameterNames = (
*/
const hasParams = (functionNode) => {
// Should also check `functionNode.value.params` if supporting `MethodDefinition`
return /** @type {import('@typescript-eslint/types').TSESTree.FunctionDeclaration} */ (
return /** @type {import('@typescript-eslint/types/dist').TSESTree.FunctionDeclaration} */ (
functionNode
).params.length;
};
Expand Down Expand Up @@ -1059,7 +1059,7 @@ const hasNonFunctionYield = (node, checkYieldReturnValue) => {
node.handler && node.handler.body, checkYieldReturnValue,
) ||
hasNonFunctionYield(
/** @type {import('@typescript-eslint/types').TSESTree.BlockStatement} */
/** @type {import('@typescript-eslint/types/dist').TSESTree.BlockStatement} */
(node.finalizer),
checkYieldReturnValue,
);
Expand Down Expand Up @@ -1201,13 +1201,13 @@ const hasNonFunctionYield = (node, checkYieldReturnValue) => {
* @returns {boolean}
*/
const hasYieldValue = (node, checkYieldReturnValue) => {
return /** @type {import('@typescript-eslint/types').TSESTree.FunctionDeclaration} */ (
return /** @type {import('@typescript-eslint/types/dist').TSESTree.FunctionDeclaration} */ (
node
).generator && (
/** @type {import('@typescript-eslint/types').TSESTree.FunctionDeclaration} */ (
/** @type {import('@typescript-eslint/types/dist').TSESTree.FunctionDeclaration} */ (
node
).expression || hasNonFunctionYield(
/** @type {import('@typescript-eslint/types').TSESTree.FunctionDeclaration} */
/** @type {import('@typescript-eslint/types/dist').TSESTree.FunctionDeclaration} */
(node).body,
checkYieldReturnValue,
)
Expand Down Expand Up @@ -1466,7 +1466,7 @@ const getIndent = (sourceCode) => {
*/
const isConstructor = (node) => {
return node?.type === 'MethodDefinition' && node.kind === 'constructor' ||
/** @type {import('@typescript-eslint/types').TSESTree.MethodDefinition} */ (
/** @type {import('@typescript-eslint/types/dist').TSESTree.MethodDefinition} */ (
node?.parent
)?.kind === 'constructor';
};
Expand All @@ -1478,8 +1478,8 @@ const isConstructor = (node) => {
const isGetter = (node) => {
return node !== null &&
/**
* @type {import('@typescript-eslint/types').TSESTree.MethodDefinition|
* import('@typescript-eslint/types').TSESTree.Property}
* @type {import('@typescript-eslint/types/dist').TSESTree.MethodDefinition|
* import('@typescript-eslint/types/dist').TSESTree.Property}
*/ (
node.parent
)?.kind === 'get';
Expand All @@ -1492,8 +1492,8 @@ const isGetter = (node) => {
const isSetter = (node) => {
return node !== null &&
/**
* @type {import('@typescript-eslint/types').TSESTree.MethodDefinition|
* import('@typescript-eslint/types').TSESTree.Property}
* @type {import('@typescript-eslint/types/dist').TSESTree.MethodDefinition|
* import('@typescript-eslint/types/dist').TSESTree.Property}
*/(
node.parent
)?.kind === 'set';
Expand All @@ -1510,22 +1510,22 @@ const hasAccessorPair = (node) => {
key,
} =
/**
* @type {import('@typescript-eslint/types').TSESTree.MethodDefinition|
* import('@typescript-eslint/types').TSESTree.Property}
* @type {import('@typescript-eslint/types/dist').TSESTree.MethodDefinition|
* import('@typescript-eslint/types/dist').TSESTree.Property}
*/ (node);

const sourceName =
/** @type {import('@typescript-eslint/types').TSESTree.Identifier} */ (
/** @type {import('@typescript-eslint/types/dist').TSESTree.Identifier} */ (
key
).name;

const oppositeKind = sourceKind === 'get' ? 'set' : 'get';

const sibling = type === 'MethodDefinition' ?
/** @type {import('@typescript-eslint/types').TSESTree.ClassBody} */ (
/** @type {import('@typescript-eslint/types/dist').TSESTree.ClassBody} */ (
node.parent
).body :
/** @type {import('@typescript-eslint/types').TSESTree.ObjectExpression} */ (
/** @type {import('@typescript-eslint/types/dist').TSESTree.ObjectExpression} */ (
node.parent
).properties;

Expand All @@ -1535,12 +1535,12 @@ const hasAccessorPair = (node) => {
kind,
key: ky,
} = /**
* @type {import('@typescript-eslint/types').TSESTree.MethodDefinition|
* import('@typescript-eslint/types').TSESTree.Property}
* @type {import('@typescript-eslint/types/dist').TSESTree.MethodDefinition|
* import('@typescript-eslint/types/dist').TSESTree.Property}
*/ (child);

const name =
/** @type {import('@typescript-eslint/types').TSESTree.Identifier} */ (
/** @type {import('@typescript-eslint/types/dist').TSESTree.Identifier} */ (
ky
).name;

Expand Down
2 changes: 1 addition & 1 deletion src/rules/checkTagNames.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export default iterateJsdoc(({
return subNode.type === 'Program' ?
context.getFilename().endsWith('.d.ts') :
Boolean(
/** @type {import('@typescript-eslint/types').TSESTree.VariableDeclaration} */ (
/** @type {import('@typescript-eslint/types/dist').TSESTree.VariableDeclaration} */ (
subNode
).declare,
) || isInAmbientContext(subNode.parent);
Expand Down
16 changes: 8 additions & 8 deletions src/rules/informativeDocs.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const defaultUselessWords = [
/* eslint-disable complexity -- Temporary */

/**
* @param {import('eslint').Rule.Node|import('@typescript-eslint/types').TSESTree.Node|null|undefined} node
* @param {import('eslint').Rule.Node|import('@typescript-eslint/types/dist').TSESTree.Node|null|undefined} node
* @returns {string[]}
*/
const getNamesFromNode = (node) => {
Expand All @@ -29,12 +29,12 @@ const getNamesFromNode = (node) => {
case 'TSAbstractPropertyDefinition':
return [
...getNamesFromNode(
/** @type {import('@typescript-eslint/types').TSESTree.Node} */ (
/** @type {import('@typescript-eslint/types/dist').TSESTree.Node} */ (
node.parent
).parent,
),
...getNamesFromNode(
/** @type {import('@typescript-eslint/types').TSESTree.Node} */
/** @type {import('@typescript-eslint/types/dist').TSESTree.Node} */
(node.key),
),
];
Expand All @@ -50,7 +50,7 @@ const getNamesFromNode = (node) => {
case 'TSInterfaceDeclaration':
case 'TSTypeAliasDeclaration':
return getNamesFromNode(
/** @type {import('@typescript-eslint/types').TSESTree.ClassDeclaration} */
/** @type {import('@typescript-eslint/types/dist').TSESTree.ClassDeclaration} */
(node).id,
);
case 'Identifier':
Expand All @@ -59,22 +59,22 @@ const getNamesFromNode = (node) => {
];
case 'Property':
return getNamesFromNode(
/** @type {import('@typescript-eslint/types').TSESTree.Node} */
/** @type {import('@typescript-eslint/types/dist').TSESTree.Node} */
(node.key),
);
case 'VariableDeclaration':
return getNamesFromNode(
/** @type {import('@typescript-eslint/types').TSESTree.Node} */
/** @type {import('@typescript-eslint/types/dist').TSESTree.Node} */
(node.declarations[0]),
);
case 'VariableDeclarator':
return [
...getNamesFromNode(
/** @type {import('@typescript-eslint/types').TSESTree.Node} */
/** @type {import('@typescript-eslint/types/dist').TSESTree.Node} */
(node.id),
),
...getNamesFromNode(
/** @type {import('@typescript-eslint/types').TSESTree.Node} */
/** @type {import('@typescript-eslint/types/dist').TSESTree.Node} */
(node.init),
),
].filter(Boolean);
Expand Down
10 changes: 5 additions & 5 deletions src/rules/requireJsdoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ export default {
const fix = /** @type {import('eslint').Rule.ReportFixer} */ (fixer) => {
// Default to one line break if the `minLines`/`maxLines` settings allow
const lines = settings.minLines === 0 && settings.maxLines >= 1 ? 1 : settings.minLines;
/** @type {import('eslint').Rule.Node|import('@typescript-eslint/types').TSESTree.Decorator} */
/** @type {import('eslint').Rule.Node|import('@typescript-eslint/types/dist').TSESTree.Decorator} */
let baseNode = getReducedASTNode(node, sourceCode);

const decorator = getDecorator(baseNode);
Expand Down Expand Up @@ -529,8 +529,8 @@ export default {
].includes(node.parent.type) &&
node ===
/**
* @type {import('@typescript-eslint/types').TSESTree.Property|
* import('@typescript-eslint/types').TSESTree.PropertyDefinition
* @type {import('@typescript-eslint/types/dist').TSESTree.Property|
* import('@typescript-eslint/types/dist').TSESTree.PropertyDefinition
* }
*/
(node.parent).value
Expand Down Expand Up @@ -585,8 +585,8 @@ export default {
].includes(node.parent.type) &&
node ===
/**
* @type {import('@typescript-eslint/types').TSESTree.Property|
* import('@typescript-eslint/types').TSESTree.PropertyDefinition
* @type {import('@typescript-eslint/types/dist').TSESTree.Property|
* import('@typescript-eslint/types/dist').TSESTree.PropertyDefinition
* }
*/
(node.parent).value
Expand Down
Loading