jaredpalmer / tsdx

Zero-config CLI for TypeScript package development
https://tsdx.io
MIT License
11.2k stars 505 forks source link

eslint-disable-next-line does not work in tsdx project #1109

Open plaa opened 2 years ago

plaa commented 2 years ago

Current Behavior

When I create a new project using npx tsdx create mylib and add the following two lines to src/index.ts:

  // eslint-disable-next-line @typescript-eslint/no-unused-vars
  const unused = 'foo';

the npm run lint command still complains about it:

$ npm run lint

> mylib@0.1.0 lint
> tsdx lint

Defaulting to "tsdx lint src test"
You can override this in the package.json scripts, like "lint": "tsdx lint src otherDir"

/Users/sampo/workspace/mylib/src/index.ts
  3:9  warning  'unused' is assigned a value but never used  @typescript-eslint/no-unused-vars

✖ 1 problem (0 errors, 1 warning)

I've also tested eslint-disable, eslint-disable-line and eslint-disable-next-line with no rule definition, and in all cases eslint still complains. I can only assume this is a tsdx bug as it works on normal eslint installations.

Reproduction repo: https://github.com/plaa/tsdx-eslint-disable-next-line-bug

Expected behavior

eslint-disable-next-line works normally.

Your environment

  System:
    OS: macOS 12.1
    CPU: (12) x64 Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
    Memory: 498.20 MB / 32.00 GB
    Shell: 5.1.16 - /usr/local/bin/bash
  Binaries:
    Node: 17.3.0 - /usr/local/bin/node
    Yarn: 1.22.17 - /usr/local/bin/yarn
    npm: 8.3.0 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Browsers:
    Chrome: 97.0.4692.99
    Firefox: 69.0
    Safari: 15.2
  npmPackages:
    tsdx: ^0.14.1 => 0.14.1
    typescript: ^4.5.5 => 4.5.5
eimerreis commented 2 years ago

Facing the same issue with a _unusedVariable

  //eslint-disable-next-line @typescript-eslint/no-unused-vars
  const [_iDontCare, indexAsString, remainder] = key.match(matcher)!;
(typescript) Error: semantic error TS6133: '_iDontCare' is declared but its value is never read.