1.0.45 • Published 2 years ago
@onidivo/eslint-config-typescript
Licence
Apache-2.0
Version
1.0.45
Deps
2
Size
19 kB
Vulns
0
Weekly
0
onidivo/eslint-config-typescript
Installation
Install our configuration and its peer dependencies.
yarn add --dev @onidivo/eslint-config-typescript
OR
npm install --save-dev eslint @onidivo/eslint-config-typescript
npx install-peerdeps --dev @onidivo/eslint-config-typescript
Create a .eslintrc.json file in your root with the following content:
{
"extends": [
"@onidivo/eslint-config-typescript",
]
}
Add a linter script to your package.json. In the following example, all files in the src and test folder (and
their subfolders) are checked:
{
"scripts": {
"lint": "eslint '{src,test}/**/*.{js,ts,tsx}'",
"lint:fix": "eslint '{src,test}/**/*.{js,ts,tsx}' --fix"
}
}
Watcher task
You can use chokidar-cli to add a task that lints your files on
save. First install it:
yarn add --dev chokidar-cli
OR
npm install --save-dev chokidar-cli
Then add a watch script to your package.json. In the following example, chokidar will look for changes in any files in
the src and test folder (and their subfolders):
{
"scripts": {
"lint": "eslint '{src,test}/**/*.{js,ts,tsx}' --fix",
"lint:watch": "npm run watch:js -- -c 'npm run lint'",
"watch:js": "chokidar '{src,test}/**/*.{js,ts,tsx}' --initial"
}
}
Usage with WebStorm
- Import webstorm-code-style.xml in preferences
Editor › Code Style › JavaScript. - Deactivate
Unterminated statementinspection in preferencesEditor › Inspections