indent rule ["error", 4] reports false positives in doc blocks #474
Description
What version of TypeScript are you using?
Version 2.8.3
What version of typescript-eslint-parser
are you using?
Version 15.0.0
What version of eslint
are you using?
Version 4.19.1
What code were you trying to parse?
/**
* @param {string} name
* @param {number} age
* @returns {string}
*/
function foo(name: string, age: number): string {}
What did you expect to happen?
No indent error. This only occurs with the typescript-eslint-parser in combination with the eslint rule
'"indent": ["error", 4]'
What happened?
2:1 error Expected indentation of 0 spaces but found 3 indent
3:1 error Expected indentation of 0 spaces but found 3 indent
4:1 error Expected indentation of 0 spaces but found 3 indent
The error is shown by eslint, but after some research and checking existing issues #422.
The problem only occurs with "parser": "typescript-eslint-parser",
in .eslint
and in combination with "indent": ["error", 4]
.
Disabling the indent rule 'solves' the issue
Configuration with errors
.eslint
{
"parser": "typescript-eslint-parser",
"plugins": [
"typescript"
],
"parserOptions": {
"sourceType": "module"
},
"rules": {
"semi": ["error", "always"],
"quotes": ["error", "double"],
"indent": ["error", 4],
"max-len": ["error", { "code": 120 }],
"typescript/no-unused-vars": "error"
}
}
tslint.json
{
"defaultSeverity": "error",
"extends": [
"tslint:recommended"
],
"jsRules": {},
"rules": {
"trailing-comma": [
true,
{
"multiline": "never",
"singleline": "never"
}
],
"object-literal-sort-keys": false,
"variable-name": [
true,
"ban-keywords",
"check-format",
"allow-leading-underscore"
],
"no-console": [true, "log"],
},
"rulesDirectory": []
}
packages
"dependencies": {
"dotenv": "^5.0.1",
"express": "^4.16.2",
"express-graphql": "^0.6.12",
"graphql": "^0.13.1",
"mongodb": "^3.0.7"
},
"devDependencies": {
"@types/bson": "^1.0.8",
"@types/chai": "^4.1.3",
"@types/express": "^4.11.0",
"@types/graphql": "^0.12.7",
"@types/mocha": "^2.2.46",
"@types/mongodb": "^3.0.15",
"@types/node": "^9.6.6",
"chai": "^4.1.2",
"eslint": "^4.19.1",
"eslint-plugin-typescript": "^0.8.1",
"mocha": "^5.1.1",
"ts-node": "^4.1.0",
"tslint": "^5.9.1",
"typescript": "^2.8.3",
"typescript-eslint-parser": "^15.0.0"
}