Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

completed-docs errors #4399

Closed
buu700 opened this issue Dec 19, 2018 · 1 comment
Closed

completed-docs errors #4399

buu700 opened this issue Dec 19, 2018 · 1 comment

Comments

@buu700
Copy link
Contributor

buu700 commented Dec 19, 2018

Bug Report

  • TSLint version: 5.12.0
  • TypeScript version: 3.1.6
  • Running TSLint via: CLI

TypeScript code being linted

import {potassiumUtil} from '../../crypto/potassium/potassium-util';
import {IProto} from '../../iproto';

export * from './json';


/** Deserializes bytes to data. */
export const deserialize	= async <T> (
	proto: IProto<T>,
	bytes: Uint8Array|string
) : Promise<T> => {
	return proto.decode(potassiumUtil.fromBase64(bytes));
};

/** Serializes data value to binary byte array. */
export const serialize	= async <T> (proto: IProto<T>, data: T) : Promise<Uint8Array> => {
	const err	= await proto.verify(data);
	if (err) {
		throw new Error(err);
	}
	const o	= await proto.encode(data);
	return o instanceof Uint8Array ? o : o.finish();
};

/** Parses query string (no nested URI component decoding for now). */
export const fromQueryString	= (search: string = locationData.search.slice(1)) : any =>
	!search ? {} : search.split('&').map(p => p.split('=')).reduce<any>(
		(o, [key, value]) => ({...o, [decodeURIComponent(key)]: decodeURIComponent(value)}),
		{}
	)
;

/**
 * Serializes o to a query string (cf. jQuery.param).
 * @param parent Ignore this (internal use).
 */
export const toQueryString	= (o: any, parent?: string) : string =>
	Object.keys(o).
		map((k: string) => {
			const key: string	= parent ? `${parent}[${k}]` : k;

			return typeof o[k] === 'object' ?
				toQueryString(o[k], key) :
				`${encodeURIComponent(key)}=${encodeURIComponent(o[k])}`
			;
		}).
		join('&').
		replace(/%20/g, '+')
;

with tslint.json configuration:

{
	"rules": {
		"completed-docs": [true, {
			"classes": {
				"tags": {"existence": ["inheritDoc", "see"]},
				"visibilities": ["exported"]
			},
			"enums": {
				"tags": {"existence": ["inheritDoc", "see"]},
				"visibilities": ["exported"]
			},
			"functions": {
				"tags": {"existence": ["inheritDoc", "see"]},
				"visibilities": ["exported"]
			},
			"interfaces": {
				"tags": {"existence": ["inheritDoc", "see"]},
				"visibilities": ["exported"]
			},
			"methods": {
				"locations": "all",
				"privacies": ["protected", "public"],
				"tags": {"existence": ["inheritDoc", "see"]}
			},
			"namespaces": {
				"tags": {"existence": ["inheritDoc", "see"]},
				"visibilities": ["exported"]
			},
			"properties": {
				"locations": "all",
				"privacies": ["protected", "public"],
				"tags": {"existence": ["inheritDoc", "see"]}
			},
			"types": {
				"tags": {"existence": ["inheritDoc", "see"]},
				"visibilities": ["exported"]
			},
			"variables": {
				"tags": {"existence": ["inheritDoc", "see"]},
				"visibilities": ["exported"]
			}
		}]
	}
}

Actual behavior

I'm getting a bunch of these, but for the example file copied above:

The 'completed-docs' rule threw an error in '/tmp/tmp.9pTkzHfsN7/shared/js/cyph/util/serialization/index.ts':
TypeError: Cannot read property 'param' of undefined
    at TagExclusion.excludes (/node_modules/tslint/lib/rules/completed-docs/tagExclusion.js:40:47)
    at checkNode (/node_modules/tslint/lib/rules/completedDocsRule.js:294:27)
    at cb (/node_modules/tslint/lib/rules/completedDocsRule.js:270:29)
    at visitNodes (/node_modules/tslint/node_modules/typescript/lib/typescript.js:15788:30)
    at Object.forEachChild (/node_modules/tslint/node_modules/typescript/lib/typescript.js:16016:24)
    at walk (/node_modules/tslint/lib/rules/completedDocsRule.js:220:15)
    at Rule.AbstractRule.applyWithFunction (/node_modules/tslint/lib/language/rule/abstractRule.js:39:9)
    at Rule.applyWithProgram (/node_modules/tslint/lib/rules/completedDocsRule.js:59:21)
    at Linter.applyRule (/node_modules/tslint/lib/linter.js:203:29)
    at /node_modules/tslint/lib/linter.js:147:85

Other variants of the error:

The 'completed-docs' rule threw an error in '/tmp/tmp.5b3SGy1CU2/shared/js/cyph/util/compare.ts':
TypeError: Cannot read property 'returns' of undefined
    at TagExclusion.excludes (/node_modules/tslint/lib/rules/completed-docs/tagExclusion.js:40:47)
    at checkNode (/node_modules/tslint/lib/rules/completedDocsRule.js:294:27)
    at cb (/node_modules/tslint/lib/rules/completedDocsRule.js:270:29)
    at visitNodes (/node_modules/tslint/node_modules/typescript/lib/typescript.js:15788:30)
    at Object.forEachChild (/node_modules/tslint/node_modules/typescript/lib/typescript.js:16016:24)
    at walk (/node_modules/tslint/lib/rules/completedDocsRule.js:220:15)
    at Rule.AbstractRule.applyWithFunction (/node_modules/tslint/lib/language/rule/abstractRule.js:39:9)
    at Rule.applyWithProgram (/node_modules/tslint/lib/rules/completedDocsRule.js:59:21)
    at Linter.applyRule (/node_modules/tslint/lib/linter.js:203:29)
    at /node_modules/tslint/lib/linter.js:147:85
TypeError: Cannot read property 'ignore' of undefined
    at TagExclusion.excludes (/node_modules/tslint/lib/rules/completed-docs/tagExclusion.js:40:47)
    at checkNode (/node_modules/tslint/lib/rules/completedDocsRule.js:294:27)
    at cb (/node_modules/tslint/lib/rules/completedDocsRule.js:270:29)
    at visitNodes (/node_modules/tslint/node_modules/typescript/lib/typescript.js:15788:30)
    at Object.forEachChild (/node_modules/tslint/node_modules/typescript/lib/typescript.js:16016:24)
    at walk (/node_modules/tslint/lib/rules/completedDocsRule.js:220:15)
    at Rule.AbstractRule.applyWithFunction (/node_modules/tslint/lib/language/rule/abstractRule.js:39:9)
    at Rule.applyWithProgram (/node_modules/tslint/lib/rules/completedDocsRule.js:59:21)
    at Linter.applyRule (/node_modules/tslint/lib/linter.js:203:29)
    at /node_modules/tslint/lib/linter.js:147:85

Expected behavior

No errors.

@JoshuaKGoldberg
Copy link
Contributor

JoshuaKGoldberg commented Dec 26, 2018

Duplicate of #4326. Thanks for the extra stack traces @buu700!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants