@alza54/eslint-config-typescript
Version:
Strict shareable config for ESLint and TypeScript that I use for my projects
68 lines (54 loc) • 2.18 kB
JavaScript
/*
* This configuration does not require your code to compile,
* only uses AST that is fast and cheap.
*/
module.exports = {
'extends': './base.js',
'rules': {
// naming
'@typescript-eslint/no-this-alias': [
'error', { 'allowDestructuring': true },
],
'@typescript-eslint/generic-type-naming': ['error', '^[A-Z][a-zA-Z]+$'],
/*
* TODO: Consider
* 'import/no-extraneous-dependencies': ['error', { devDependencies: true }]
*/
// indentation and spacing
'@typescript-eslint/indent': ['error', 2],
'func-call-spacing': 'off',
'@typescript-eslint/func-call-spacing': ['error', 'never'],
// parens and semicolons
'no-extra-parens': 'off',
'@typescript-eslint/no-extra-parens': ['error', 'all', { 'nestedBinaryExpressions': false }],
'semi': 'off',
'@typescript-eslint/semi': ['error', 'always'],
'@typescript-eslint/member-delimiter-style': ['error', {
'multiline': { 'delimiter': 'semi', 'requireLast': true },
'singleline': { 'delimiter': 'comma', 'requireLast': false },
}],
// design
'@typescript-eslint/no-extraneous-class': 'error',
'@typescript-eslint/no-for-in-array': 'error',
'@typescript-eslint/prefer-for-of': 'error',
'@typescript-eslint/no-useless-constructor': 'error',
'@typescript-eslint/unified-signatures': 'error',
'@typescript-eslint/adjacent-overload-signatures': 'error',
'@typescript-eslint/array-type': ['error', { 'default': 'array', 'readonly': 'array' }],
'@typescript-eslint/ban-types': 'error',
'brace-style': 'off',
'@typescript-eslint/brace-style': ['error', '1tbs', { 'allowSingleLine': true }],
'@typescript-eslint/consistent-type-assertions': ['error', {
'assertionStyle': 'as',
'objectLiteralTypeAssertions': 'allow-as-parameter',
}],
// so developer can see all existing arguments
'@typescript-eslint/no-unused-vars': ['error', { 'args': 'none' }],
// overrides of recommended config
'@typescript-eslint/explicit-function-return-type': ['error', {
'allowExpressions': true,
'allowTypedFunctionExpressions': true,
}],
},
};
;