-
-
Save vyorkin/33c227c1c541825158c24b4db0e1b45e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
extends: [ | |
// This profile enables lint rules intended for a | |
// web application, for example security rules that are relevant to web browser APIs such as DOM. | |
// Also use this profile if you are creating a library that can be consumed by both Node.js and web applications. | |
'@rushstack/eslint-config/profile/web-app', | |
'prettier/@typescript-eslint', // Uses eslint-config-prettier to disable ESLint rules from @typescript-eslint/eslint-plugin that would conflict with prettier | |
'plugin:prettier/recommended', // Enables eslint-plugin-prettier and eslint-config-prettier. This will display prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array. | |
], | |
parserOptions: { | |
// To include support for Dynamic Imports and BigInt | |
// https://eslint.org/blog/2019/08/eslint-v6.2.0-released#highlights-113 | |
ecmaVersion: 2020, | |
// We use ECMAScript modules everywhere | |
// (it is set by @rushstack/eslint-config/profile/_common but | |
// for some reason we have to set it here again) | |
sourceType: 'module', | |
}, | |
// Place to specify ESLint rules. Can be used to | |
// overwrite rules specified from the extended configs | |
rules: { | |
// Place to specify ESLint rules. Can be used to | |
// overwrite rules specified from the extended configs | |
'@typescript-eslint/explicit-module-boundary-types': 'off', | |
// Requiring type annotations unnecessarily can be cumbersome to | |
// maintain and generally reduces code readability | |
'@typescript-eslint/typedef': 'off', | |
// Don't require public accessibiliy modifier | |
'@typescript-eslint/explicit-member-accessibility': 'off', | |
// Disable the rule for all files | |
// (we enable it below for .ts and .tsx files only) | |
'@typescript-eslint/explicit-function-return-type': 'off', | |
// Allow explit any, lets be pragmatic and honest to ourselves | |
'@typescript-eslint/no-explicit-any': 'off', | |
}, | |
// Overrides for a mixed JS/TS codebase, | |
// see: https://github.com/typescript-eslint/typescript-eslint/blob/v3.4.0/packages/eslint-plugin/docs/rules/explicit-function-return-type.md#configuring-in-a-mixed-jsts-codebase | |
overrides: [ | |
{ | |
// Enable rules specifically for TypeScript files | |
files: ['*.ts', '*.tsx'], | |
rules: { | |
// Allow type function expressions and higher order functions to omit return type annotations. | |
// Don't require explicit return types in event handlers. | |
// https://github.com/typescript-eslint/typescript-eslint/blob/v3.4.0/packages/eslint-plugin/docs/rules/explicit-function-return-type.md | |
'@typescript-eslint/explicit-function-return-type': [ | |
'warn', | |
{ | |
// Type annokktations are also allowed on the | |
// variable of a function expression rather than on the function directly | |
allowTypedFunctionExpressions: true, | |
// Functions immediately returning another function expression will not be checked | |
allowHigherOrderFunctions: true, | |
// Only functions which are part of a declaration will be checked | |
allowExpressions: true, | |
}, | |
], | |
}, | |
}, | |
], | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment