xojs/xo

Proposal: enable strict-boolean-expressions

Opened this issue · 0 comments

Rule: https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/strict-boolean-expressions.md

Current:

		// TODO: Reconsider enabling it again in 2023.
		// NOTE: The rule was complete redone in typescript-eslint v3, so this config needs to be changed before this is enabled.
		// Disabled for now as it's too strict.
		// Relevant discussion: https://github.com/sindresorhus/refined-github/pull/2521#discussion_r343013852
		// '@typescript-eslint/strict-boolean-expressions': [
		// 	'error',
		// 	{
		// 		allowNullable: true,
		// 		allowSafe: true
		// 	}
		// ],

It has been redone.

Maybe it's time to enable it. Open for suggestions and discussion.

// Number is safe, string is safe, object is safe
    '@typescript-eslint/strict-boolean-expressions': [
      'error',
      {
        allowString: true,
        allowNumber: true,
        allowNullableObject: true,
      },
    ],