Skip to content

Comments

fix(linter/no-unused-vars): do not delete function expressions when fixing#4848

Merged
graphite-app[bot] merged 1 commit intomainfrom
don/08-10-fix_linter/no-unused-vars_do_not_delete_function_expressions_when_fixing
Aug 13, 2024
Merged

fix(linter/no-unused-vars): do not delete function expressions when fixing#4848
graphite-app[bot] merged 1 commit intomainfrom
don/08-10-fix_linter/no-unused-vars_do_not_delete_function_expressions_when_fixing

Conversation

@DonIsaac
Copy link
Contributor

@DonIsaac DonIsaac commented Aug 12, 2024

VariableDeclarator fixer will no longer delete declarations that are initialized to function expressions.

// none of these get deleted
const unusedArrow = () => {}
const unusedAnon = function() {}
const unusedNamed = function foo() {}

// matches fixer behavior for function declarations
function unusedDecl() {}

Copy link
Contributor Author

DonIsaac commented Aug 12, 2024

@graphite-app
Copy link
Contributor

graphite-app bot commented Aug 12, 2024

Your org has enabled the Graphite merge queue for merging into main

Add the label “merge” to the PR and Graphite will automatically add it to the merge queue when it’s ready to merge. Or use the label “hotfix” to add to the merge queue as a hot fix.

You must have a Graphite account and log in to Graphite in order to use the merge queue. Sign up using this link.

@DonIsaac DonIsaac force-pushed the don/08-10-refactor_linter/no-unused-vars_split_fixer_logic branch from 0d48c22 to 415cf78 Compare August 12, 2024 14:49
@DonIsaac DonIsaac force-pushed the don/08-10-fix_linter/no-unused-vars_do_not_delete_function_expressions_when_fixing branch from 5fc4653 to 4dcf620 Compare August 12, 2024 14:49
@DonIsaac DonIsaac force-pushed the don/08-10-refactor_linter/no-unused-vars_split_fixer_logic branch from 415cf78 to ad3ddee Compare August 12, 2024 14:54
@DonIsaac DonIsaac force-pushed the don/08-10-fix_linter/no-unused-vars_do_not_delete_function_expressions_when_fixing branch from 4dcf620 to ed50d5b Compare August 12, 2024 14:54
@codspeed-hq
Copy link

codspeed-hq bot commented Aug 12, 2024

CodSpeed Performance Report

Merging #4848 will not alter performance

Comparing don/08-10-fix_linter/no-unused-vars_do_not_delete_function_expressions_when_fixing (a81ce3a) with main (c0b26f4)

Summary

✅ 29 untouched benchmarks

@Dunqing
Copy link
Member

Dunqing commented Aug 13, 2024

Looks like same as #4445 (comment) ?

@Boshen Boshen added the 0-merge Merge with Graphite Merge Queue label Aug 13, 2024
@graphite-app
Copy link
Contributor

graphite-app bot commented Aug 13, 2024

Merge activity

  • Aug 12, 10:31 PM EDT: The merge label 'merge' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Aug 12, 10:31 PM EDT: Boshen added this pull request to the Graphite merge queue.
  • Aug 12, 10:36 PM EDT: Boshen merged this pull request with the Graphite merge queue.

…ixing (#4848)

`VariableDeclarator` fixer will no longer delete declarations that are initialized to function expressions.

```ts
// none of these get deleted
const unusedArrow = () => {}
const unusedAnon = function() {}
const unusedNamed = function foo() {}

// matches fixer behavior for function declarations
function unusedDecl() {}
```
@Boshen Boshen force-pushed the don/08-10-refactor_linter/no-unused-vars_split_fixer_logic branch from ad3ddee to c53c210 Compare August 13, 2024 02:31
@Boshen Boshen force-pushed the don/08-10-fix_linter/no-unused-vars_do_not_delete_function_expressions_when_fixing branch from ed50d5b to a81ce3a Compare August 13, 2024 02:32
Base automatically changed from don/08-10-refactor_linter/no-unused-vars_split_fixer_logic to main August 13, 2024 02:33
@graphite-app graphite-app bot merged commit a81ce3a into main Aug 13, 2024
@graphite-app graphite-app bot deleted the don/08-10-fix_linter/no-unused-vars_do_not_delete_function_expressions_when_fixing branch August 13, 2024 02:36
@oxc-bot oxc-bot mentioned this pull request Aug 15, 2024
Boshen added a commit that referenced this pull request Aug 15, 2024
## [0.7.2] - 2024-08-15

### Features

- 97e38cd linter: Add fixer for unicorn/prefer-optional-catch-binding
(#4867) (heygsc)
- 93ae1c7 linter: Eslint-plugin-react jsx-props-no-spread-multi (#4866)
(keita hino)
- 0a23610 linter: Add fixer for unicorn/prefer-array-flat-map (#4844)
(heygsc)
- 13c7b1b linter/jsx-a11y: Add fixer for aria-unsupported-elements
(#4854) (DonIsaac)
- a6195a6 linter/jsx-a11y: Add fixer for anchor-has-content (#4852)
(DonIsaac)
- 4d28d03 task/website: Support render `subschemas.all_of` (#4800)
(mysteryven)

### Bug Fixes

- 21f5762 codegen: Minify large numbers (#4889) (Boshen)
- a08d7a7 linter/jsx-a11y: Reduce false negatives for html-has-lang
(#4855) (DonIsaac)
- a81ce3a linter/no-unused-vars: Do not delete function expressions when
fixing (#4848) (DonIsaac)

### Documentation

- 955a4b4 oxlint: Improve cli doc regarding fix and `-D all` (Boshen)

### Refactor

- 56f033c linter: Improve diagnostics for several jsx-a11y rules (#4853)
(DonIsaac)
- c53c210 linter/no-unused-vars: Split fixer logic into multiple files
(#4847) (DonIsaac)

Co-authored-by: Boshen <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

0-merge Merge with Graphite Merge Queue A-linter Area - Linter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants