¿Cómo ignorar un directorio o archivo en particular para tslint?


El IDE que se está utilizando es WebStorm 11.0.3, el tslint está configurado y funciona, pero, se cuelga porque intenta analizar grandes *.archivos de la biblioteca d. ts.

¿Hay alguna manera de ignorar un archivo o directorio en particular?

Author: user3330840, 2016-01-03

5 answers

ACTUALIZAR USANDO TSLINT v5.8.0

Como fue mencionado por Saugat Acharya ahora puede actualizar tslint.json Opciones de CLI:

{
  "extends": "tslint:latest",
  "linterOptions": {
      "exclude": [
          "bin",
          "lib/*generated.js"
      ]
  }
}

Más información aquí


Esta característica se ha introducido con TSLINT 3.6

tslint \"src/**/*.ts\" -e \"**/__test__/**\"

Ahora puede agregar exclude exclude (o-e) ver PR aquí.

CLI

usage: tslint [options] file ...

Options:

-c, --config          configuration file
--force               return status code 0 even if there are lint errors
-h, --help            display detailed help
-i, --init            generate a tslint.json config file in the current working directory
-o, --out             output file
-r, --rules-dir       rules directory
-s, --formatters-dir  formatters directory
-e, --exclude         exclude globs from path expansion
-t, --format          output format (prose, json, verbose, pmd, msbuild, checkstyle)  [default: "prose"]
--test                test that tslint produces the correct output for the specified directory
-v, --version         current version

Usted está mirando el uso de

-e, --exclude         exclude globs from path expansion
 85
Author: Michael,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-07-28 05:23:22

Además de la respuesta de Miguel, considere una segunda manera: agregar opciones de Línter.excluir a tslint.json

Por ejemplo, puede tener tslint.json con las siguientes líneas:

{
  "linterOptions": {
    "exclude": [
      "someDirectory/*.d.ts"
    ]
  }
}
 18
Author: arkhwise,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-11-01 07:49:15

Hay otros que encontraron el problema. Desafortunadamente, solo hay un problema abierto para excluir archivos: https://github.com/palantir/tslint/issues/73

Así que me temo que la respuesta es no.

 9
Author: Martin Vseticka,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-01-03 18:11:36

Estoy usando Visual Studio Code y este

/* tslint:disable */

Funcionó para mí. Echa un vistazo a esta página, alrededor de 3/4 del camino hacia abajo hay algunos comandos desactivar https://c9.io/lijunle/tslint

 9
Author: DeadlyChambers,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-09-27 13:28:17

A partir de tslint v5.8.0 puede establecer una propiedad exclude bajo su clave cliOptions en su archivo tslint.json:

{
  "extends": "tslint:latest",
  "cliOptions": {
      "exclude": [
          "bin",
          "**/__test__",
          "lib/*generated.js"
      ]
  }
}

Más información sobre esto aquí .

 5
Author: Saugat Acharya,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-10-31 16:08:33