@vkontakte/eslint-plugin
Version:
eslint config from VK
124 lines (118 loc) • 4.52 kB
JavaScript
const { namingConventionOptions } = require('./naming-convention');
module.exports = {
parser: '@typescript-eslint/parser', // Specifies the ESLint parser
extends: ['plugin:@vkontakte/eslint-plugin/default'],
plugins: ['@typescript-eslint'],
rules: {
'@typescript-eslint/adjacent-overload-signatures': 'error',
'@typescript-eslint/array-type': ['error', { default: 'array-simple' }],
'@typescript-eslint/await-thenable': 'error',
'@typescript-eslint/ban-types': [
'error',
{
types: {
Function: 'Use exact typing of callables instead of generic Function',
Object: 'Use {} instead or exact typing',
String: {
message: 'Use string instead',
fixWith: 'string',
},
Number: {
message: 'Use number instead',
fixWith: 'number',
},
},
},
],
'brace-style': 'off',
'@typescript-eslint/brace-style': [
'error',
'1tbs',
{ allowSingleLine: true },
],
'@typescript-eslint/consistent-type-assertions': [
'error',
{ assertionStyle: 'as', objectLiteralTypeAssertions: 'never' },
],
'@typescript-eslint/explicit-member-accessibility': 'error',
'func-call-spacing': 'off',
'@typescript-eslint/func-call-spacing': ['error', 'never'],
'indent': 'off',
'@typescript-eslint/indent': ['error', 2],
'@typescript-eslint/member-delimiter-style': 'error',
'no-array-constructor': 'off',
'@typescript-eslint/no-array-constructor': 'error',
'no-empty-function': 'off',
'@typescript-eslint/no-empty-function': 'error',
'@typescript-eslint/no-empty-interface': 'error',
'no-extra-parens': 'off',
'@typescript-eslint/no-extra-parens': [
'error',
'all',
{
ignoreJSX: 'all',
},
],
'@typescript-eslint/no-extraneous-class': 'error',
'@typescript-eslint/no-floating-promises': 'error',
'@typescript-eslint/no-for-in-array': 'error',
'@typescript-eslint/no-inferrable-types': 'error',
'no-magic-numbers': 'off',
'@typescript-eslint/no-magic-numbers': [
'error',
{ ignoreNumericLiteralTypes: true, ignoreEnums: true },
],
'@typescript-eslint/no-misused-new': 'error',
'@typescript-eslint/no-misused-promises': 'error',
'@typescript-eslint/no-non-null-assertion': 'error',
'@typescript-eslint/no-this-alias': 'error',
'@typescript-eslint/no-unnecessary-condition': 'error',
'@typescript-eslint/no-unnecessary-qualifier': 'error',
'@typescript-eslint/no-unnecessary-type-arguments': 'error',
'@typescript-eslint/no-unnecessary-type-assertion': 'error',
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{
ignoreRestSiblings: true,
},
],
'no-use-before-define': 'off',
'@typescript-eslint/no-use-before-define': ['error', { functions: false }],
'no-useless-constructor': 'off',
'@typescript-eslint/no-useless-constructor': 'error',
'@typescript-eslint/prefer-function-type': 'error',
'@typescript-eslint/prefer-includes': 'error',
'@typescript-eslint/prefer-namespace-keyword': 'error',
'@typescript-eslint/prefer-readonly': 'error',
'@typescript-eslint/prefer-string-starts-ends-with': 'error',
'quotes': 'off',
'@typescript-eslint/quotes': ['error', 'single'],
'@typescript-eslint/require-array-sort-compare': 'error',
'@typescript-eslint/restrict-plus-operands': 'error',
'semi': 'off',
'@typescript-eslint/semi': ['error', 'always'],
'@typescript-eslint/type-annotation-spacing': 'error',
'@typescript-eslint/unbound-method': 'error',
'@typescript-eslint/unified-signatures': 'error',
'@typescript-eslint/prefer-reduce-type-parameter': 'error',
'@typescript-eslint/prefer-ts-expect-error': 'error',
'valid-jsdoc': 'off',
// Disallow unnecessary semicolons
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-extra-semi.md
'no-extra-semi': 'off',
'@typescript-eslint/no-extra-semi': 'error',
// TypeScript controls this better
'no-undef': 'off',
'camelcase': 'off',
'@typescript-eslint/naming-convention': namingConventionOptions,
'@typescript-eslint/ban-ts-comment': [
'error',
{
'ts-ignore': true,
'ts-nocheck': false,
'ts-expect-error': { descriptionFormat: '^ TS\\d+: .+$' },
},
],
},
};