UNPKG

eslint-config-zillow-typescript

Version:

Zillow's ESLint config for TypeScript, following our code conventions

149 lines (127 loc) 6.13 kB
/** * @typescript-eslint/recommended * @see https://github.com/typescript-eslint/typescript-eslint/blob/39c45f3/packages/eslint-plugin/src/configs/recommended.ts#L8-L32 */ module.exports = { rules: { // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/adjacent-overload-signatures.md '@typescript-eslint/adjacent-overload-signatures': 'error', // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/ban-ts-comment.md '@typescript-eslint/ban-ts-comment': [ 'error', { 'ts-expect-error': 'allow-with-description', 'ts-ignore': true, 'ts-nocheck': true, 'ts-check': false, }, ], // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/ban-types.md '@typescript-eslint/ban-types': [ 'error', { extendDefaults: true, types: { // make default 'object' rule fixable object: { fixWith: 'Record<string, unknown>', message: [ 'The `object` type is currently hard to use ([see this issue](https://github.com/microsoft/TypeScript/issues/21732)).', 'Consider using `Record<string, unknown>` instead, as it allows you to more easily inspect and use the keys.', ].join('\n'), }, }, }, ], // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/explicit-module-boundary-types.md '@typescript-eslint/explicit-module-boundary-types': [ // TODO: move to "strict" variant, enable? 'off', { allowArgumentsExplicitlyTypedAsAny: false, allowDirectConstAssertionInArrowFunctions: true, allowedNames: [], allowHigherOrderFunctions: true, allowTypedFunctionExpressions: true, }, ], // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-array-constructor.md 'no-array-constructor': 'off', '@typescript-eslint/no-array-constructor': 'error', // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-empty-function.md 'no-empty-function': 'off', '@typescript-eslint/no-empty-function': [ 'error', { allow: [ // built-in: https://eslint.org/docs/rules/no-empty-function 'arrowFunctions', 'functions', 'methods', // this plugin /* 'private-constructors', 'protected-constructors', 'decoratedFunctions', */ ], }, ], // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-empty-interface.md '@typescript-eslint/no-empty-interface': 'error', // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-explicit-any.md '@typescript-eslint/no-explicit-any': 'warn', // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-extra-non-null-assertion.md '@typescript-eslint/no-extra-non-null-assertion': 'error', // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-inferrable-types.md '@typescript-eslint/no-inferrable-types': 'error', // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-misused-new.md '@typescript-eslint/no-misused-new': 'error', // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-namespace.md '@typescript-eslint/no-namespace': 'error', // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-non-null-asserted-optional-chain.md '@typescript-eslint/no-non-null-asserted-optional-chain': 'error', // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-non-null-assertion.md '@typescript-eslint/no-non-null-assertion': 'warn', // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-this-alias.md '@typescript-eslint/no-this-alias': 'error', // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unused-vars.md 'no-unused-vars': 'off', '@typescript-eslint/no-unused-vars': [ 'error', { argsIgnorePattern: '^_', varsIgnorePattern: '^ignored', args: 'after-used', ignoreRestSiblings: true, }, ], // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-use-before-define.md 'no-use-before-define': 'off', '@typescript-eslint/no-use-before-define': [ 'error', { // function declarations are hoisted functions: false, // type definitions are hoisted typedefs: false, }, ], // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-var-requires.md '@typescript-eslint/no-var-requires': 'error', // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-as-const.md '@typescript-eslint/prefer-as-const': 'error', // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-namespace-keyword.md '@typescript-eslint/prefer-namespace-keyword': 'error', // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/triple-slash-reference.md '@typescript-eslint/triple-slash-reference': [ 'error', { // TODO: get an informed opinion about this config lib: 'never', path: 'never', types: 'prefer-import', }, ], }, };