I have a custom rule written for TSlint in TypeScript that I can run using ts-node
in a script I'm using on my Linux VM:
#!/bin/bash
set -e
ROOT_DIR=$(dirname $(dirname $0))
cd $ROOT_DIR
find "$ROOT_DIR/src" -name "*.ts" -o -name "*.tsx" | xargs $(yarn bin)/ts-node $(yarn bin)/tslint
This enables tslint
to run the TS rule directly without compiling first, and it does work.
The problem is that ms-vscode.vscode-typescript-tslint-plugin
isn't picking up that rule even though it's explicitly enabled in the tsconfig.json
rules. I am running VSCode on a separate machine with a Windows host, mounting the filesystem via Samba served from the Linux VM. Other rules in the file are being respected and shown for installed and built-in rules, like no-console
, etc.
How can I get information about why the rule isn't being applied? Is there something I need to configure in the plugin to make this work?
tslint
instance get configuration, and this is howtslint
load rules – Cirrorequire
. And since the plugin loadstslint
as a dependency, the node instance where thattslint
app runs in is the same as where vscode plugin runs, which is a child process spinned up by vscode/electron. – Cirrorequire
method to understand.ts
files. – Cirrorequire('ts-node/register')
at the beginning of your custom rule.ts
file could solve the problem. – Cirro