Skip to content

Repo: enable more core ESLint rules internally #9523

@abrahamguo

Description

@abrahamguo

Suggestion

I was looking through the core ESLint rules that we do not have turned on internally, and I found these rules that might be beneficial to enable. Thoughts?

array-callback-return (2 occurrences)

docs

Array.prototype.filter() expects a value to be returned at the end of arrow function.
eslint-plugin/tests/configs.test.ts:60
typescript-eslint/tests/configs.test.ts:64

arrow-body-style (41 occurrences)

docs

Unexpected block statement surrounding arrow body; move the returned value immediately after the =>.
eslint-plugin/src/rules/class-literal-property-style.ts:173
eslint-plugin/src/rules/max-params.ts:81
eslint-plugin/src/rules/naming-convention.ts:714
eslint-plugin/src/rules/no-array-delete.ts:92
eslint-plugin/src/rules/no-duplicate-type-constituents.ts:189
eslint-plugin/src/rules/no-extraneous-class.ts:72
eslint-plugin/src/rules/no-meaningless-void-operator.ts:52
eslint-plugin/src/rules/no-type-alias.ts:229
eslint-plugin/src/rules/no-unnecessary-template-expression.ts:41
eslint-plugin/src/rules/no-useless-template-literals.ts:42
eslint-plugin/src/rules/non-nullable-type-assertion-style.ts:94
eslint-plugin/src/rules/prefer-enum-initializers.ts:42
eslint-plugin/src/rules/prefer-enum-initializers.ts:49
eslint-plugin/src/rules/prefer-enum-initializers.ts:56
eslint-plugin/src/rules/prefer-find.ts:258
eslint-plugin/src/rules/prefer-find.ts:298
eslint-plugin/src/rules/prefer-function-type.ts:145
eslint-plugin/tests/rules/block-spacing.test.ts:78
type-utils/src/builtinSymbolLikes.ts:81
website/plugins/blog-footer.ts:6
website/plugins/generated-rule-docs/index.ts:17
website/src/components/ErrorsViewer.tsx:136
website/src/components/config/ConfigEditor.tsx:99
website/src/components/config/ConfigTypeScript.tsx:33
website/src/components/editor/LoadedEditor.tsx:270
website/src/components/hooks/useResizeObserver.ts:7
website/src/components/inputs/Text.tsx:17
website/src/components/linter/createParser.ts:27
website/src/pages/play.tsx:16

Unexpected block statement surrounding arrow body; parenthesize the returned value and move it immediately after the =>.
eslint-plugin/src/rules/ban-tslint-comment.ts:33
eslint-plugin/tests/rules/prefer-readonly-parameter-types.test.ts:530
rule-tester/src/RuleTester.ts:327
rule-tester/tests/RuleTester.test.ts:95
rule-tester/tests/RuleTester.test.ts:138
typescript-estree/tests/lib/semanticInfo-singleRun.test.ts:23
typescript-estree/tests/lib/semanticInfo-singleRun.test.ts:35
typescript-estree/tests/lib/semanticInfo-singleRun.test.ts:51
typescript-estree/tests/lib/semanticInfo-singleRun.test.ts:56
typescript-estree/tests/lib/semanticInfo-singleRun.test.ts:66
website/sidebars/sidebar.rules.js:3
website/sidebars/sidebar.rules.js:13

class-methods-use-this (13 occurrences)

docs

Expected this to be used by class method BreakStatement.
scope-manager/src/referencer/Referencer.ts:386

Expected this to be used by class method ContinueStatement.
scope-manager/src/referencer/Referencer.ts:425

Expected this to be used by class method Decorator.
scope-manager/src/referencer/PatternVisitor.ts:90

Expected this to be used by class method ExportAllDeclaration.
scope-manager/src/referencer/Referencer.ts:429

Expected this to be used by class method ImportAttribute.
scope-manager/src/referencer/Referencer.ts:813

Expected this to be used by class method isES6.
scope-manager/src/ScopeManager.ts:87

Expected this to be used by class method isStrictModeSupported.
scope-manager/src/ScopeManager.ts:83

Expected this to be used by class method isValidResolution.
scope-manager/src/scope/ScopeBase.ts:374

Expected this to be used by class method JSXClosingElement.
scope-manager/src/referencer/Referencer.ts:517

Expected this to be used by class method MetaProperty.
scope-manager/src/referencer/Referencer.ts:575

Expected this to be used by class method PrivateIdentifier.
scope-manager/src/referencer/ClassVisitor.ts:319
scope-manager/src/referencer/Referencer.ts:584

Expected this to be used by class method TSTypeAnnotation.
scope-manager/src/referencer/PatternVisitor.ts:136

default-param-last (1 occurrence)

docs

Default parameters should be last.
scope-manager/src/scope/ScopeBase.ts:444

no-await-in-loop (2 occurrences)

docs

Unexpected await inside a loop.
repo-tools/src/generate-contributors.mts:59
repo-tools/src/generate-lib.mts:250

no-lonely-if (9 occurrences)

docs

Unexpected if as the only statement in an else block.
eslint-plugin/src/rules/consistent-type-imports.ts:181
eslint-plugin/src/rules/consistent-type-imports.ts:735
eslint-plugin/src/rules/func-call-spacing.ts:155
eslint-plugin/src/rules/member-delimiter-style.ts:276
eslint-plugin/src/rules/no-non-null-assertion.ts:83
eslint-plugin/src/rules/no-unused-vars.ts:272
eslint-plugin/src/rules/prefer-optional-chain-utils/analyzeChain.ts:228
scope-manager/src/referencer/Referencer.ts:535
typescript-estree/src/convert.ts:986

no-negated-condition (44 occurrences)

docs

Unexpected negated condition.
ast-spec/tests/fixtures.test.ts:210
ast-spec/tests/fixtures.test.ts:314
eslint-plugin/src/rules/consistent-type-assertions.ts:119
eslint-plugin/src/rules/consistent-type-exports.ts:363
eslint-plugin/src/rules/key-spacing.ts:122
eslint-plugin/src/rules/member-ordering.ts:1056
eslint-plugin/src/rules/naming-convention-utils/parse-options.ts:43
eslint-plugin/src/rules/naming-convention-utils/parse-options.ts:47
eslint-plugin/src/rules/naming-convention-utils/parse-options.ts:55
eslint-plugin/src/rules/no-empty-interface.ts:98
eslint-plugin/src/rules/no-non-null-assertion.ts:57
eslint-plugin/src/rules/no-non-null-assertion.ts:101
eslint-plugin/src/rules/no-unnecessary-condition.ts:283
eslint-plugin/src/rules/no-unnecessary-condition.ts:285
eslint-plugin/src/rules/prefer-function-type.ts:126
eslint-plugin/src/rules/prefer-function-type.ts:164
eslint-plugin/src/rules/type-annotation-spacing.ts:44
eslint-plugin/src/rules/type-annotation-spacing.ts:45
eslint-plugin/src/rules/unified-signatures.ts:214
eslint-plugin/src/rules/unified-signatures.ts:216
eslint-plugin/src/rules/unified-signatures.ts:534
eslint-plugin/src/util/getFunctionHeadLoc.ts:40
eslint-plugin/src/util/getMemberHeadLoc.ts:52
eslint-plugin/tests/rules/prefer-optional-chain/base-cases.ts:274
rule-schema-to-typescript-types/src/generateArrayType.ts:47
scope-manager/src/referencer/ExportVisitor.ts:61
scope-manager/src/referencer/Referencer.ts:180
scope-manager/src/referencer/Referencer.ts:343
scope-manager/src/referencer/Referencer.ts:532
scope-manager/src/scope/ScopeBase.ts:356
scope-manager/tests/test-utils/serializers/baseSerializer.ts:34
typescript-estree/src/convert.ts:998
typescript-estree/src/convert.ts:1326
typescript-estree/src/convert.ts:1427
typescript-estree/src/convert.ts:2335
typescript-estree/src/convert.ts:2995
typescript-estree/src/create-program/getWatchProgramsForProjects.ts:336
typescript-estree/src/create-program/shared.ts:59
typescript-estree/tests/lib/parse.test.ts:206
website/src/components/ast/PropertyValue.tsx:70
website/src/components/ast/PropertyValue.tsx:79
website/src/components/inputs/CopyButton.tsx:41
website/src/components/inputs/Dropdown.tsx:24
website/src/components/layout/EditorTabs.tsx:25

no-undef-init (3 occurrences)

docs

Its not necessary to initialize previousRank: number | undefined` to undefined.
eslint-plugin/src/rules/member-ordering.ts:656

Its not necessary to initialize prevNode: TSESTree.Node | undefined` to undefined.
eslint-plugin/src/rules/key-spacing.ts:392

Its not necessary to initialize primitive: number | undefined` to undefined.
eslint-plugin/src/rules/no-redundant-type-constituents.ts:345

no-unreachable-loop (2 occurrences)

docs

Invalid loop. Its body allows only one iteration.
eslint-plugin/src/rules/no-mixed-enums.ts:174
eslint-plugin/src/rules/no-unsafe-return.ts:169

no-unused-expressions (7 occurrences)

docs

Expected an assignment or function call and instead saw an expression.
eslint-plugin/src/rules/strict-boolean-expressions.ts:851
eslint-plugin/src/rules/unified-signatures.ts:502
typescript-estree/tests/lib/convert.test.ts:309
typescript-estree/tests/lib/convert.test.ts:326
typescript-estree/tests/lib/convert.test.ts:327
typescript-estree/tests/lib/convert.test.ts:342
typescript-estree/tests/lib/persistentParse.test.ts:68

no-useless-call (1 occurrence)

docs

Unnecessary .call().
website/src/components/lib/debounce.ts:12

no-useless-computed-key (1 occurrence)

docs

Unnecessarily computed property [MemberExpression[computed=true]] found.
eslint-plugin/src/rules/prefer-find.ts:285

no-useless-concat (4 occurrences)

docs

Unexpected string concatenation of literals.
eslint-plugin/tests/rules/dot-notation.test.ts:242
eslint-plugin/tests/rules/dot-notation.test.ts:243
eslint-plugin/tests/rules/dot-notation.test.ts:282
eslint-plugin/tests/rules/dot-notation.test.ts:283

no-useless-return (12 occurrences)

docs

Unnecessary return statement.
eslint-plugin/src/rules/explicit-module-boundary-types.ts:240
eslint-plugin/src/rules/no-misused-promises.ts:346
eslint-plugin/src/rules/no-unnecessary-condition.ts:403
eslint-plugin/src/rules/prefer-reduce-type-parameter.ts:116
eslint-plugin/src/rules/prefer-return-this-type.ts:115
eslint-plugin/src/rules/prefer-return-this-type.ts:118
eslint-plugin/src/rules/return-await.ts:359
eslint-plugin/src/util/getThisExpression.ts:21
rule-schema-to-typescript-types/src/optimizeAST.ts:51
typescript-estree/tests/lib/semanticInfo-singleRun.test.ts:13
typescript-estree/tests/lib/semanticInfo-singleRun.test.ts:16
website/src/components/lib/scroll-into.ts:32

no-var (1 occurrence)

docs

Unexpected var, use let or const instead.
website-eslint/src/mock/path.js:150

no-void (1 occurrence)

docs

Expected undefined and instead saw void.
rule-tester/src/RuleTester.ts:974

object-shorthand (41 occurrences)

docs

Expected method shorthand.
eslint-plugin/src/rules/no-unnecessary-boolean-literal-compare.ts:219
eslint-plugin/src/rules/no-unnecessary-qualifier.ts:179

Expected property shorthand.
eslint-plugin/src/rules/indent.ts:282
eslint-plugin/src/rules/index.ts:177
eslint-plugin/src/rules/index.ts:281
eslint-plugin/src/rules/index.ts:287
eslint-plugin/src/rules/index.ts:296
eslint-plugin/src/rules/no-unsafe-assignment.ts:404
eslint-plugin/src/rules/no-unsafe-call.ts:72
eslint-plugin/src/rules/type-annotation-spacing.ts:60
eslint-plugin/src/rules/type-annotation-spacing.ts:61
eslint-plugin/tests/rules/naming-convention/cases/createTestCases.ts:288
rule-tester/src/utils/validationHelpers.ts:114
typescript-estree/src/convert.ts:2339
typescript-estree/src/convert.ts:2907
typescript-estree/src/convert.ts:3047
typescript-estree/src/parseSettings/createParseSettings.ts:167
website-eslint/src/mock/assert.js:70
website-eslint/src/mock/assert.js:71
website-eslint/src/mock/assert.js:72
website-eslint/src/mock/assert.js:73
website-eslint/src/mock/assert.js:74
website-eslint/src/mock/path.js:220
website-eslint/src/mock/path.js:221
website-eslint/src/mock/path.js:222
website-eslint/src/mock/path.js:223
website-eslint/src/mock/path.js:224
website-eslint/src/mock/path.js:225
website-eslint/src/mock/path.js:226
website-eslint/src/mock/path.js:227
website-eslint/src/mock/path.js:228
website-eslint/src/mock/path.js:229
website/sidebars/sidebar.rules.js:5
website/src/components/ast/DataRenderer.tsx:146
website/src/components/lib/jsonSchema.ts:128
website/src/components/lib/jsonSchema.ts:209
website/src/components/linter/createLinter.ts:69
website/src/components/linter/createLinter.ts:107
website/src/components/linter/createParser.ts:60
website/src/components/linter/createParser.ts:62
website/src/components/linter/utils.ts:98

operator-assignment (1 occurrence)

docs

Assignment (=) can be replaced with operator assignment (+=).
rule-schema-to-typescript-types/src/index.ts:53

prefer-arrow-callback (3 occurrences)

docs

Unexpected function expression.
website-eslint/src/mock/path.js:85
website-eslint/src/mock/path.js:102
website-eslint/src/mock/path.js:127

prefer-const (2 occurrences)

docs

isPathAbsolute is never reassigned. Use const instead.
website-eslint/src/mock/path.js:97

trailingSlash is never reassigned. Use const instead.
website-eslint/src/mock/path.js:98

prefer-object-has-own (11 occurrences)

docs

Use Object.hasOwn() instead of Object.prototype.hasOwnProperty.call().
eslint-plugin-internal/src/rules/prefer-ast-types-enum.ts:58
eslint-plugin-internal/src/rules/prefer-ast-types-enum.ts:62
eslint-plugin-internal/src/rules/prefer-ast-types-enum.ts:66
eslint-plugin/src/rules/no-duplicate-type-constituents.ts:48
eslint-plugin/src/rules/no-restricted-imports.ts:175
eslint-plugin/src/rules/no-restricted-imports.ts:181
rule-tester/src/utils/cloneDeeplyExcludesParent.ts:14
rule-tester/src/utils/freezeDeeply.ts:10
rule-tester/src/utils/serialization.ts:29
type-utils/src/isTypeReadonly.ts:47
typescript-estree/tests/test-utils/test-utils.ts:127

prefer-object-spread (9 occurrences)

docs

Use an object spread instead of Object.assign eg: { ...foo }.
eslint-plugin/src/rules/ban-types.ts:210
eslint-plugin/src/rules/indent.ts:184
eslint-plugin/src/rules/no-extra-parens.ts:306
eslint-plugin/src/util/getFunctionHeadLoc.ts:200
eslint-plugin/src/util/getFunctionHeadLoc.ts:201
parser/tests/test-utils/test-utils.ts:43
parser/tests/test-utils/test-utils.ts:75
rule-tester/src/RuleTester.ts:404
utils/tests/eslint-utils/deepMerge.test.ts:41

prefer-rest-params (2 occurrences)

docs

Use the rest parameters instead of arguments.
website-eslint/src/mock/path.js:67
website-eslint/src/mock/path.js:125

prefer-template (36 occurrences)

docs

Unexpected string concatenation.
ast-spec/tests/util/serialize-error.ts:17
ast-spec/tests/util/snapshot-diff.ts:60
eslint-plugin-internal/src/rules/plugin-test-formatting.ts:66
eslint-plugin/src/rules/consistent-generic-constructors.ts:106
eslint-plugin/src/rules/no-floating-promises.ts:70
eslint-plugin/src/rules/no-floating-promises.ts:72
eslint-plugin/src/rules/no-unsafe-assignment.ts:327
eslint-plugin/src/rules/no-unsafe-assignment.ts:328
eslint-plugin/src/rules/prefer-function-type.ts:147
eslint-plugin/src/rules/prefer-optional-chain-utils/analyzeChain.ts:348
eslint-plugin/src/rules/prefer-optional-chain-utils/analyzeChain.ts:358
eslint-plugin/src/rules/unbound-method.ts:107
eslint-plugin/src/rules/use-unknown-in-catch-callback-variable.ts:45
eslint-plugin/src/rules/use-unknown-in-catch-callback-variable.ts:47
eslint-plugin/src/rules/use-unknown-in-catch-callback-variable.ts:50
eslint-plugin/tests/docs.test.ts:86
eslint-plugin/tests/docs.test.ts:90
eslint-plugin/tests/docs.test.ts:100
eslint-plugin/tests/docs.test.ts:455
eslint-plugin/tests/docs.test.ts:461
eslint-plugin/tests/docs.test.ts:469
eslint-plugin/tests/docs.test.ts:475
eslint-plugin/tests/docs.test.ts:485
eslint-plugin/tools/generate-breaking-changes.mts:42
parser/tests/test-utils/test-utils.ts:90
rule-schema-to-typescript-types/src/index.ts:53
typescript-estree/tests/test-utils/test-utils.ts:61
utils/tests/eslint-utils/getParserServices.test.ts:36
website-eslint/build.ts:26
website-eslint/build.ts:33
website-eslint/src/mock/assert.js:54
website-eslint/src/mock/path.js:76
website/src/components/editor/createProvideTwoslashInlay.ts:71
website/src/components/editor/createProvideTwoslashInlay.ts:83
website/src/components/editor/useSandboxServices.ts:88
website/tools/generate-website-dts.ts:56

radix (2 occurrences)

docs

Missing radix parameter.
eslint-plugin/src/util/misc.ts:163
eslint-plugin/tests/schemas.test.ts:172

Metadata

Metadata

Assignees

No one assigned

    Labels

    accepting prsGo ahead, send a pull request that resolves this issuerepo maintenancethings to do with maintenance of the repo, and not with code/docs

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy