Eslint & Tslint
Code linting เป็นเครื่องมือที่ช่วยการวิเคราะห์โครงสร้างของ Code ซึ่งมักใช้เพื่อค้นหารูปแบบของปัญหาที่อาจะเกิดขึ้น หรือ Code ที่เป็นปัญหาซึ่งไม่เป็นไปตาม Style Guidelines
Install
npm i -g tslint
# Generate a basic configuration file
tslint --init เรียกใช้งาน
#check
tslint -c tslint.json src/**/*.ts
#fix
tslint -c tslint.json src/**/*.ts --fixCLI Usage
-v, --version output the version number
-c, --config [config] configuration file
-e, --exclude <exclude> exclude globs from path expansion
--fix fixes linting errors for select rules (this may overwrite linted files)
--force return status code 0 even if there are lint errors
-i, --init generate a tslint.json config file in the current working directory
-o, --out [out] output file
--outputAbsolutePaths whether or not outputted file paths are absolute
--print-config print resolved configuration for a file
-r, --rules-dir [rules-dir] rules directory
-s, --formatters-dir [formatters-dir] formatters directory
-t, --format [format] output format (json, stylish, verbose, pmd, prose, msbuild, checkstyle, vso, fileslist, codeFrame)
-q, --quiet hide non "error" severity linting errors from output
--test test that tslint produces the correct output for the specified directory
-p, --project [project] tsconfig.json file
--type-check (deprecated) check for type errors before linting the project
-h, --help output usage informationExample


Last updated