eslint теперь сфокусировался на работе и с typescript
Лично я пришел к такой настройки eslint под typescript:
.eslintrc.json
{
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint", "prettier"],
"extends": [
"plugin:@typescript-eslint/recommended",
"prettier/@typescript-eslint",
"plugin:prettier/recommended"
],
"parserOptions": {
"sourceType": "module",
"useJSXTextNode": true,
"project": "./tsconfig.json"
}
}
.prettierrc
{
"singleQuote": true,
"arrowParens": "always",
"tabWidth": 2,
"useTabs": false
}
.babelrc - важно, без него не заработает.
{
"plugins": ["babel-plugin-rewire"],
"presets": [
"@babel/preset-typescript",
[
"@babel/preset-env",
{
"targets": {
"node": "current"
}
}
]
]
}
tsconfig.json
{
"compilerOptions": {
"diagnostics": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"forceConsistentCasingInFileNames": true,
"lib": ["es7"],
"module": "commonjs",
"target": "esnext",
"moduleResolution": "node",
"noImplicitAny": false,
"noUnusedLocals": true,
"noUnusedParameters": true,
"outDir": "dist/",
"pretty": true,
"removeComments": true,
"strict": true,
"declaration": true
},
"exclude": [
"src/**/*.spec.*",
"node_modules",
"**/__tests__/*",
"**/__mocks__/*"
],
"include": ["src", "typings"]
}