diff --git a/src/rules.ts b/src/rules.ts index 501fa77..dae0510 100644 --- a/src/rules.ts +++ b/src/rules.ts @@ -18,12 +18,6 @@ export { TypescriptEslintNamingConventionSelector, TypescriptEslintNamingConventionUnderscore, } from './rules/typescript-eslint/rules/typescript-eslint-naming-convention'; -export { - TsLintRule, - TsLintRules, - TypescriptEslintTslintConfig, - typescriptEslintTslintConfig, -} from './rules/typescript-eslint/rules/typescript-eslint-tslint-config'; export { UnicornPreventAbbreviationReplacements, UnicornPreventAbbreviations, diff --git a/src/rules/typescript-eslint/rules/typescript-eslint-tslint-config.spec.ts b/src/rules/typescript-eslint/rules/typescript-eslint-tslint-config.spec.ts deleted file mode 100644 index a8888cf..0000000 --- a/src/rules/typescript-eslint/rules/typescript-eslint-tslint-config.spec.ts +++ /dev/null @@ -1,56 +0,0 @@ -import { describe, expect, it } from '@jest/globals'; - -import { TypescriptEslintTslintConfig, typescriptEslintTslintConfig } from './typescript-eslint-tslint-config'; - -describe(typescriptEslintTslintConfig, () => { - it('creates default configuration for the @typescript-eslint/tslint/config rule', () => { - expect(typescriptEslintTslintConfig()) - .toStrictEqual({ - rules: { - 'encoding': true, - 'import-spacing': true, - 'no-default-import': true, - 'no-inferred-empty-object-type': true, - 'no-mergeable-namespace': true, - 'no-tautology-expression': true, - 'no-unnecessary-callback-wrapper': true, - 'prefer-conditional-expression': [true, 'check-else-if'], - 'prefer-switch': [true, { 'min-cases': 2 }], - 'prefer-while': true, - 'return-undefined': true, - 'static-this': true, - 'strict-comparisons': [true, { - 'allow-object-equal-comparison': true, - 'allow-string-order-comparison': true, - }], - 'switch-final-break': [true, 'always'], - }, - rulesDirectory: [], - } as TypescriptEslintTslintConfig); - }); - - it('overrides and extends default rules', () => { - expect(typescriptEslintTslintConfig({ - 'strict-comparisons': false, - }, ['tslint'])) - .toStrictEqual({ - rules: { - 'encoding': true, - 'import-spacing': true, - 'no-default-import': true, - 'no-inferred-empty-object-type': true, - 'no-mergeable-namespace': true, - 'no-tautology-expression': true, - 'no-unnecessary-callback-wrapper': true, - 'prefer-conditional-expression': [true, 'check-else-if'], - 'prefer-switch': [true, { 'min-cases': 2 }], - 'prefer-while': true, - 'return-undefined': true, - 'static-this': true, - 'strict-comparisons': false, - 'switch-final-break': [true, 'always'], - }, - rulesDirectory: ['tslint'], - } as TypescriptEslintTslintConfig); - }); -}); diff --git a/src/rules/typescript-eslint/rules/typescript-eslint-tslint-config.ts b/src/rules/typescript-eslint/rules/typescript-eslint-tslint-config.ts deleted file mode 100644 index c95e37a..0000000 --- a/src/rules/typescript-eslint/rules/typescript-eslint-tslint-config.ts +++ /dev/null @@ -1,56 +0,0 @@ -export type TsLintRule = boolean | [boolean, unknown]; -export type TsLintRules = Record; - -export interface TypescriptEslintTslintConfig { - rules: TsLintRules; - rulesDirectory?: string[]; -} - -const format: TsLintRules = { - 'import-spacing': true, -}; - -const functionality: TsLintRules = { - 'no-inferred-empty-object-type': true, - 'no-tautology-expression': true, - 'prefer-conditional-expression': [true, 'check-else-if'], - 'static-this': true, - 'strict-comparisons': [true, { - 'allow-object-equal-comparison': true, - 'allow-string-order-comparison': true, - }], - // Relies on deprecated API - // DeprecationWarning: 'originalKeywordKind' has been deprecated since v5.0.0 - // and will no longer be usable after v5.2.0. Use 'identifierToKeywordKind(identifier)' instead. - // 'strict-type-predicates': true, -}; - -const maintainability: TsLintRules = { - 'no-default-import': true, - 'no-mergeable-namespace': true, -}; - -const style: TsLintRules = { - 'encoding': true, - 'no-unnecessary-callback-wrapper': true, - 'prefer-switch': [true, { 'min-cases': 2 }], - 'prefer-while': true, - 'return-undefined': true, - 'switch-final-break': [true, 'always'], -}; - -export function typescriptEslintTslintConfig( - rules: TsLintRules = {}, - directories: string[] = [], -): TypescriptEslintTslintConfig { - return { - rules: { - ...format, - ...functionality, - ...maintainability, - ...style, - ...rules, - }, - rulesDirectory: directories, - }; -} diff --git a/src/rules/typescript-eslint/tslint.ts b/src/rules/typescript-eslint/tslint.ts index c4dea19..1440c3c 100644 --- a/src/rules/typescript-eslint/tslint.ts +++ b/src/rules/typescript-eslint/tslint.ts @@ -1,10 +1,8 @@ -import { typescriptEslintTslintConfig } from './rules/typescript-eslint-tslint-config'; - export = { plugins: [ '@typescript-eslint/tslint', ], rules: { - '@typescript-eslint/tslint/config': ['warn', typescriptEslintTslintConfig()], + '@typescript-eslint/tslint/config': 'off', }, }; diff --git a/src/rules/unicorn/index.adoc b/src/rules/unicorn/index.adoc index d383c36..0fa17a4 100644 --- a/src/rules/unicorn/index.adoc +++ b/src/rules/unicorn/index.adoc @@ -579,6 +579,7 @@ The `link:https://github.com/sindresorhus/eslint-plugin-unicorn[eslint-plugin-un | Yes | Yes | Off +4+| Reduces readability for `yield`, `await`, `throw` statements. | `link:{eslint-unicorn-rules}/prefer-ternary.md[unicorn/prefer-top-level-await]` |