2016-01-03 9 views

ответ

44

ОБНОВЛЕНИЕ С ИСПОЛЬЗОВАНИЕМ TSLINT v5.8.0

Как было упомянуто Saugat Acharya теперь вы можете обновить tslint.json Параметры CLI:

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

Дополнительная информация here


Эта функция была введена с TSLINT 3.6

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

Теперь вы можете добавить --exclude (или -e) см. Здесь PR.

CLI

enter code here 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 

вы смотрите на использовании

-e, --exclude   exclude globs from path expansion 
+0

Полезно знать, однако, я не использовал его какое-то время. – user3330840

+0

Вы знаете, как исключить несколько путей? –

+3

повторите аргумент exclude несколько раз –

8

areothers, столкнувшийся с проблемой. К сожалению, существует только открытый вопрос для исключения файлов: https://github.com/palantir/tslint/issues/73

Так что я боюсь, что ответ отрицательный.

4

Я использую Visual Studio код и это

/* tslint:disable */

работал для меня. Проверьте эту страницу, примерно на 3/4 пути вниз есть некоторые отключить команды https://c9.io/lijunle/tslint

7

В дополнение к ответу Майкла, рассмотрим второй способ: добавление linterOptions.exclude к tslint.json

Например, вы можете иметь tslint.json со следующими линиями:

{ 
    "linterOptions": { 
    "exclude": [ 
     "someDirectory/*.d.ts" 
    ] 
    } 
} 
+0

@Maraboc ok, я добавил объяснение. – arkhwise

+1

Это зависит от версии 5.8.0, https://github.com/palantir/tslint/releases. – hlovdal

4

Начиная с tslint v5.8.0 вы можете установить exclude свойство под cliOptions ключ в файле tslint.json:

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

Дополнительная информация об этом here.

+1

Это должно быть отмечено как правильный (и обновленный ноябрь-2017) ответ. –

 Смежные вопросы

  • Нет связанных вопросов^_^