-
Notifications
You must be signed in to change notification settings - Fork 889
strange behavior when installing via yarn@1.1.0, e.g. whitespace "check-separator" in JSDoc #3251
Comments
I tried to reproduce this with typescript@2.3.4 and 2.5.2 Can you reproduce this without any third party tool, i.e. running |
I have the same issue after purging my node_modules and reinstalling this afternoon. Removing tslint 5.6.0 Edit: As mentioned below, if I force yarn to be v1.0.2 and reinstall my node_modules then linting completes with no errors. |
#3244 (comment) indicates that there might be a problem when using yarn 1.1.0 |
Yes - I did use yarn to install tslint. I will try to reproduce using both npm and yarn, with no 3rd party tools. |
I had the same issue using yarn 1.1.0 but not with yarn 1.0.2 ... This seems to be a yarn issue. |
Given the following files: tslint.json{
"rules": {
"whitespace": [
true,
"check-separator"
]
}
} bug.tsclass TsLintBug {
/**
* Adds x and y.
*/
public add = (x: number, y: number): number => {
return x + y;
};
/**
* Subtracts y from x.
* @returns {number}
*/
public subtract = (x: number, y: number): number => {
return x + y;
};
} Then I can not reproduce with either npm 5.4.2 or yarn 1.1.0:
|
I was able to reproduce this issue with a slightly different file in my project.
One of the differences between yarn and npm is the version of tsutils that was installed. yarn 1.1.0 is currently installing 2.8.2, whereas npm installs 2.11.1 (both satisfy tslint's requirement of "^2.8.1"). When I upgraded to tsutils@2.11.1 I saw this false positive go away. Unfortunately I can't reproduce from a clean repo, only in my rather large project, but I hope this helps someone. |
In my case I was also able to get rid of the error by upgrading my deps. I tried to isolate which one made a difference but was unable to. If somebody want to get to the bottom of this, i could provide before/after yarn.lock files... |
If this is really related to the version of That's still very strange. I didn't make any changes in |
I tried forcing my project's version of typescript, tsutils and tslint in a clean project, but still didn't observe the bug. When the bug occurred in my project, |
I already thought that something like this would be the case. I'm puzzled why that could happen. The function excludes everything related to JSDoc. Anyways, thanks @nikklassen for digging into this. Let's hope this is fixed with the next release of tslint. |
related -> #3277 |
In my project I could make the following observations:
In all cases yarn gets tsutils 2.11.2. BUT the error seems only to occur if I've got a dependency that again has a dependency on typescript. In my case this was compodoc. |
Are there multiple different versions of typescript installed? I'd need to know which package uses which version of typescript. |
yarn list v1.1.0 But tsutils also installs its own typescript in version 2.5.2, though it is only a devDependency. |
I was unable to create a minimal repro. I only got the faulty install on the first attempt. After that |
* Removed `"check-seperator"` from the `whitespace` rule to work around palantir/tslint#3251 * Fixed float-typed object keys to use `[100.2]` instead of `"100.2"` * Project now lints without issue.
* Start of implementation of BitMEX Market Feed * Created the `BitmexMarketFeed` class * Created interface definitions for messages received over the websocket * Based if off of the Gemini exchange feed class * Created methods for handling messages, initializing the websocket connection, and subscribing to symbols * TODO: Fix type issues and finish integrating the rest of the event emitters * TODO: Write tests * TODO: Update the sample file with the changes to the class * Finish up handlers for orderbook updates * Properly map data from BitMEX's format into GTT's format * Remove left over logging statements * Handle one extra message type (welcome message) * Clean up some functions and code organization * Started work on creating test for BitMEX Market Feed * Based off of the test for the Gemini Market Feed; Given simulated WS messages, checks to see that the state of the produced orderbook matches what's expected. * Finished implementing tests * Fixed tests by changing ID scheme * It turns out for non-level-3 data, GTT represents IDs by the stringified price level rather than the native order ID. I changed the passed ID to reflect this. * Fixed issues as per code review * Removed Ramnda dependency * Properly handle unknown and error messages in the BitMEX Market Feed * Add required `type` fields to the various message types * Remove required `type` field on `UnknownMessage` * Fixed lint issues * Removed `"check-seperator"` from the `whitespace` rule to work around palantir/tslint#3251 * Fixed float-typed object keys to use `[100.2]` instead of `"100.2"` * Project now lints without issue.
Can someone on this thread verify that it works with yarn@1.2.1? |
I can confirm the issue I was seeing that was present with yarn@1.1.0 is no longer happening with yarn@1.2.1 |
Great. Let's close this. |
* Add TypeScript config * Add extract-messages script * Configure VS Code to use local TypeScript * Remove Babel; add awesome-typescript-loader * Allow at-loader to use cache, async error reporting * Run tests with ts-jest * Revert React imports (to fix PropTypes warning) and some other imports * Use eval-source-map for dev in webpack * Upgrade moment[-range] * Disable ESLint line limits for JSX * Disable ESLint for TS/TSX; add TSLint * Add lots of @types * Add TypeScript type comments to some JS files * Convert some JS/JSX to TS/TSX * Throw *new* Error for consistency * Add tuple.ts to help unify proptypes enums with union types * Use _ prefix for unused params * Upgrade yarn to fix palantir/tslint#3251 * Add timestamp to watch builds
Hi, I am getting this issue now.
and "devDependencies": {
"tslint": "^5.9.1",
"tslint-eslint-rules": "^4.1.1",
"typescript": "^2.6.1"
}, code where error shows:
One thing to note is that is was happening only in the exported functions. Other private functions in module (not exported) did not have it. Is there any deps I could force here. Error start to appear after I moved to yarn, with thanks in advance David |
This has just started to happen to us as well with yarn 1.3.2, in our case I am highly suspicious it might be related with the fact we have started to import a private package with tslint rules into the project. Downgrading to 1.0.1 fixes it, but not to 1.2.1. |
I upgraded to latest typescript today to 3.4, and this started happening to me as well. i'm on yarn 1.15.2 |
ok, resolved it. I did |
This happen to me. Tried to isolate my project from a monorepo (using lerna) and install via npm. Error still persist. import { FormGroup, ValidationErrors } from '@angular/forms';
/**
* @example
^... missing whitespace
* const formGroup = this.formBuilder.group({
* field1: '',
* field2: '',
* }, {
* validators: [testValue]
* })
*/
export function testValue(formGroup: FormGroup): ValidationErrors | null {
...
return null;
} Once I remove import statement, no error reported. Following is my current setup.
package.json
|
🤖 Beep boop! 👉 TSLint is deprecated 👈 and you should switch to typescript-eslint! 🤖 🔒 This issue is being locked to prevent further unnecessary discussions. Thank you! 👋 |
Bug Report
Using
ng lint
TypeScript code being linted
with
tslint.json
configuration:Actual behavior
The linter wants the jsdoc comment start to be modified from
/**
to/* *
. Which fixes the issue, but breaks the jsdoc.Other workaround which "fix" this tslint error:
;
on theadd
method.@returns
line in the second jsdoc.Note that if you put a
@returns
line on the first jsdoc, and remove it from the second jsdoc, the error goes away.Removing the
"check-separator"
line from tslint.json also makes the error go away (took me a while to figure that one out).Expected behavior
No tslint errors.
The text was updated successfully, but these errors were encountered: