Skip to content
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

ignoreComments issue with some comments in Typescript #9933

Closed
ghost opened this issue Feb 4, 2018 · 8 comments
Closed

ignoreComments issue with some comments in Typescript #9933

ghost opened this issue Feb 4, 2018 · 8 comments
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion auto closed The bot closed this issue blocked This change can't be completed until another issue is resolved bug ESLint is working incorrectly

Comments

@ghost
Copy link

ghost commented Feb 4, 2018

#9018
#9752

ignoreComments not working with some comments
* @type {express.Application}
* @returns {void}

rules: indent: ["warn", 4, { "ignoreComments": true }] no-trailing-spaces: ["warn", { "ignoreComments": true }]

image
image

If I use the --fix the code brakes.

image
image

Bellow more issues after using --fix.

image

image

image

image

image

image

@eslint-deprecated eslint-deprecated bot added the triage An ESLint team member will look at this issue soon label Feb 4, 2018
@not-an-aardvark not-an-aardvark added the needs info Not enough information has been provided to triage this issue label Feb 4, 2018
@eslint-deprecated
Copy link

Hi @ssannttoss, thanks for the issue. It looks like there's not enough information for us to know how to help you.

If you're reporting a bug, please be sure to include:

  1. The version of ESLint you are using (run eslint -v)
  2. What you did (the source code and ESLint configuration)
  3. The actual ESLint output complete with numbers
  4. What you expected to happen instead

Requesting a new rule? Please see Proposing a New Rule for instructions.

Requesting a rule change? Please see Proposing a Rule Change for instructions.

If it's something else, please just provide as much additional information as possible. Thanks!

@ghost
Copy link
Author

ghost commented Feb 4, 2018

The version of ESLint you are using (run eslint -v)
v4.17.0

What you did (the source code and ESLint configuration)
Check the code here
Issue9933.ts
Issue9933_with_fix.ts

The actual ESLint output complete with numbers
Check the code here
lint.txt

What you expected to happen instead
This type of comment * @type {String} should be ignored. Using the --fix option breaks the code to {String} without the * and the @type

@stanbluijs
Copy link

Is there any more information needed to solve this issue?
I have the same issue on multi line comments where using @ sign.

ESLint version:

eslint -v
v4.19.1

Example with ESLint errors (source code):

/**
 * Create a Node with a value and with the path of it's parent.
 *
 * @param {string} label
 * @param {Node} parent
 * @returns {Node}
 */

Messages are:
4:1 error Expected indentation of 0 spaces but found 3 indent
5:1 error Expected indentation of 0 spaces but found 3 indent
6:1 error Expected indentation of 0 spaces but found 3 indent

Example without ESLint errors:

/**
 * Create a Node with a value and with the path of it's parent.
 *
 * {string} label
 * {Node} parent
 * {Node}
 */

Expectation:
That a comment where using @param or @returns will not break ESLint with message error Expected indentation of 0 spaces but found 3 indent.

ESLint configuration:

{
  "parser": "typescript-eslint-parser",
  "plugins": [
    "typescript"
  ],
  "parserOptions": {
    "sourceType": "module"
  },
  "rules": {
    "semi": ["error", "always"],
    "quotes": ["error", "double"],
    "indent": ["error", 4, {
      "ignoreComments": true
    }],
    "max-len": ["error", { "code": 120 }],
    "typescript/no-unused-vars": "error"
  }
}

Dependencies

{
    "@types/auth0": "^2.7.2",
    "@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",
    "@types/request-promise": "^4.1.41",
    "chai": "^4.1.2",
    "eslint": "^4.19.1",
    "eslint-plugin-typescript": "^0.8.1",
    "mocha": "^5.1.1",
    "request": "^2.83.0",
    "request-promise": "^4.2.2",
    "ts-node": "^4.1.0",
    "tslint": "^5.9.1",
    "typescript": "^2.8.3",
    "typescript-eslint-parser": "^12.0.0"
  }

@platinumazure
Copy link
Member

Can this be reproduced outside of using typescript-eslint-parser? If not, I think it makes sense to open up an issue on the typescript-eslint-parser repository.

My guess is that parser is creating an AST with either extra nodes or incorrect range/location information, resulting in indent autofix getting confused.

@stanbluijs
Copy link

@platinumazure thank you for your quick reply. I left out typescript-eslint-parser and this will indeed ignore the comment as expected.

I will post the issue on the typescript-eslint-parser repository.

@not-an-aardvark
Copy link
Member

This might be the same issue as eslint/typescript-eslint-parser#422.

@kaicataldo kaicataldo added bug ESLint is working incorrectly blocked This change can't be completed until another issue is resolved and removed needs info Not enough information has been provided to triage this issue triage An ESLint team member will look at this issue soon labels Jul 23, 2018
@kaicataldo
Copy link
Member

Is this worth keeping open to track this? Or should we go ahead and close now that there's a corresponding issue in typescript-eslint-parser.

@eslint-deprecated eslint-deprecated bot added the auto closed The bot closed this issue label Dec 11, 2018
@eslint-deprecated
Copy link

Unfortunately, it looks like there wasn't enough interest from the team
or community to implement this change. While we wish we'd be able to
accommodate everyone's requests, we do need to prioritize. We've found
that issues failing to reach accepted status after 21 days tend to
never be accepted, and as such, we close those issues.
This doesn't mean the idea isn't interesting or useful, just that it's
not something the team can commit to.

Thanks for contributing to ESLint and we appreciate your understanding.

@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Jun 10, 2019
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Jun 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion auto closed The bot closed this issue blocked This change can't be completed until another issue is resolved bug ESLint is working incorrectly
Projects
None yet
Development

No branches or pull requests

4 participants