У меня есть два проекта nodejs с одинаковыми файлами package.json, tsconfig.json и tslint.json (только копии).Когда я звоню в tslint по обоим проектам, у меня разные результаты.В первом проекте все работает нормально, но во втором у меня есть Должна существовать документация для свойств Ошибка lint.
tsconfig.json:
{
"compilerOptions": {
"module": "commonjs",
"noImplicitAny": false,
"noUnusedLocals": true,
"noUnusedParameters": true,
"suppressImplicitAnyIndexErrors": true,
"target": "ES6",
"moduleResolution": "node",
"removeComments": false,
"sourceMap": false,
"noLib": false,
"declaration": true,
"lib": ["es5", "es6", "scripthost"],
"outDir": "dist",
"rootDir": "./"
},
"include": [
"src/**/*",
"test.ts"
// "test/**/*",
// "bdd/**/*.ts"
]
}
tslint.json:
{
"defaultSeverity": "error",
"extends": [
"tslint:recommended"
],
"jsRules": {},
"rules": {
"completed-docs": [
true,
{
"properties": {
"privacies": [
"public",
"protected"
]
},
"methods": {
"privacies": [
"public",
"protected"
]
},
"classes": true,
"functions": true,
"interfaces": true,
"namespaces": true,
"types": true
}
],
"max-line-length": false,
"no-trailing-whitespace": false,
"max-classes-per-file": false,
"array-type": false,
"file-header": true,
"only-arrow-functions": false,
"object-literal-sort-keys": false
},
"rulesDirectory": []
}
package.json:
{
"name": "testProj",
"version": "18.9.0",
"description": "",
"author": {
"name": "Me"
},
"license": "MIT",
"engines": {
"node": ">=4.8"
},
"scripts": {
"lint": "tslint test.ts --project ./tsconfig.json"
},
"dependencies": {
"@types/request": "^2.47.0",
"request": "^2.87.0",
"request-debug": "^0.2.0"
},
"devDependencies": {
"@types/chai": "^4.0.10",
"@types/mocha": "^2.2.44",
"asposestoragecloud": "^1.0.5",
"chai": "^4.1.2",
"cross-env": "^5.1.4",
"cucumber": "^3.0.0",
"del": "^3.0.0",
"gulp": "^4.0.0",
"gulp-cucumber": "0.0.23",
"gulp-typescript": "^4.0.1",
"gulp-util": "^3.0.8",
"mocha": "^4.0.1",
"mocha-cases": "^0.2.1",
"mocha-jenkins-reporter": "^0.4.0",
"mocha-sinon": "^2.0.0",
"sinon": "^4.1.3",
"ts-node": "^4.0.2",
"tslint": "^5.8.0",
"typescript": "^2.7.1"
}
}
test.ts:
/**
* Some awesome class
*/
export class MyCheckClass {
/**
* Very usefull method
* @param checkParameter Some unused parameter
*/
public myCheckMethod(checkParameter: string): Promise<{ code: number, data: string }> {
return new Promise((resolve, reject) => {
resolve({code : 200, data: "My Success Data"});
});
}
}
Пытался добавить @ ts-ignore - не помогло, попытался добавитьдокументация для типа возврата с использованием @typedef - бесполезна.Как правильно заставить Линтера не проверять документацию для таких случаев или, по крайней мере, как создать надлежащую документацию для типа возвращаемого значения?
PS.В первом проекте, где такие случаи не приводят к появлению ошибки linter - все то же самое.Но то, что я обнаружил - если я использую глобально установленный tslint (просто удаленная папка node_modules) - появляются те же ошибки, но после npm install - работает нормально.