Skip to content

tools: some eslint rules proposals #14253

@vsemozhetbyt

Description

@vsemozhetbyt

Recently some big PRs with churn was mostly rejected or gave sporadic -1, so these are some preliminarily proposals to check the opinions before investing time.

  1. Rule: http://eslint.org/docs/rules/no-unused-vars

    Proposal:

    no-unused-vars: ['error', {args: 'after-used'}]
    

    Hits:

    *.md:          190 (soundly disabled in doc/.eslintrc.yaml)
    
    *.js benchmark: 33
    *.js lib:       45
    *.js test:     300
    *.js tools:      1 (will be fixed in #14251)
    

    Refs: tools: delete an unused argument #14251

  2. Rule: http://eslint.org/docs/rules/prefer-arrow-callback

    Proposal:

    `prefer-arrow-callback: ['error', {allowNamedFunctions: false, allowUnboundThis: true}]`
    

    Hits:

    *.md:            15
    
    *.js benchmark: 108
    *.js lib:       114
    *.js test:     4002 (wow...)
    *.js tools:      51
    
  3. Rule: http://eslint.org/docs/rules/prefer-destructuring

    Proposal:

    prefer-destructuring: ['error',
                           {array: true, object: true},
                           {enforceForRenamedProperties: false}]
    

    Hits:

    array: *.md:           3
    
    array: *.js benchmark: 7
    array: *.js lib:      59
    array: *.js test:    124
    array: *.js tools:     9
    
    
    object: *.md:             1
    
    object: *.js benchmark: 141
    object: *.js lib:       268
    object: *.js test:      562
    object: *.js tools:      22
    

If there is some consensus for any proposal, it can be used as a starting point for code-and-learn or similar events.

If some or all approved proposals are not appropriate for code-and-learn, I can do any or all if there are volunteers to review.

Metadata

Metadata

Assignees

No one assigned

    Labels

    discussIssues opened for discussions and feedbacks.metaIssues and PRs related to the general management of the project.toolsIssues and PRs related to the tools directory.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions