@airhelp/ts-utils-lint v0.2.1
@airhelp/ts-utils-lint
ts-utils-lint wraps ESLint/Prettier-related packages and exposes a single command to lint TypeScript files under src directory of your application respecting its .eslintrc and .prettierrc files.
Setup
./a-lib ➜ yarn add --dev @airhelp/ts-utils-lint// a-lib/package.json
{
"scripts": {
"lint": "ts-utils-lint"
}
}How it works
ts-utils-lint is a simple wrapper around CLIEngine API exposed by ESLint. Given lib-a directory, executing ts-utils-lint inside means going through the following steps:
- Read
.eslintrcconfiguration inlib-a - Set
ts-utils-lintas a current working directory for ESLint in order to resolve the dependencies (namely, ESLint plugins) correctly. - Lint all TypeScript files under
lib-a/srcdirectory. - Fix errors automatically and print the report.
Roadmap
ts-utils-lint is meant to always be a single command to lint TypeScript files respecting .eslintrc and .prettierrc files of your application. It means that in terms of features not much is going to change. What we would like to improve in the upcoming releases though, is its configurability. For instance:
- a
--ciflag to skip automatic fixes and return with a non-zero code in case of errors #3 - custom pattern for files to be linted
Code editors integration
Please, make sure to setup your code editor so that you get instant feedback and auto fixes when you code. Too long line or unused variable errors making you CI pipeline red and being the very last thing preventing you from an important release suck. Don't go that way!
VSCode
- Install ESLint (
dbaeumer.vscode-eslint) extension. View > Command Pallette...(⇧ + ⌘ + P)- Go to
> Preferences: Open Settings (JSON) Append the following configuration:
{ "files.autoSave": "onFocusChange", // not required, although highly recommended "eslint.autoFixOnSave": true, "eslint.validate": [ {"language": "typescript", "autoFix": true }, {"language": "typescriptreact", "autoFix": true } ] }
WebStorm
To do
Sublime Text
To do
Contributing
To do