Skip to content
This repository has been archived by the owner on Aug 31, 2023. It is now read-only.

feat(rome_analyze): add a warning for unused suppression comments #3718

Merged
merged 1 commit into from
Nov 14, 2022

Conversation

leops
Copy link
Contributor

@leops leops commented Nov 14, 2022

Summary

Fixes #3655

This PR tracks whether any signal was suppressed by a suppression comment. Once all analyzer passes have completed, a warning is emitted for all line suppressions that never actually recorder any hit. While the change is mostly straightforward, it still requires some special handling in pull_diagnostics to ensure we don't report unused suppression diagnostics in syntax-only passes of the analyzer (were all lint rules are disabled, and thus suppression comments are never hit)

Test Plan

I updated the existing suppression tests to ensure the new diagnostic is correctly emitted, as well as the SuppressionComments snapshot test for the noUnreachable rule that was also impacted by this change (since it has a negative case to check that certain comment positions do not suppress the rule)

@leops leops requested a review from a team November 14, 2022 11:05
@netlify
Copy link

netlify bot commented Nov 14, 2022

Deploy Preview for docs-rometools canceled.

Name Link
🔨 Latest commit 798c4c0
🔍 Latest deploy log https://app.netlify.com/sites/docs-rometools/deploys/63722115626125000877e115

@MichaReiser
Copy link
Contributor

!bench_analyzer

@github-actions
Copy link

Analyzer Benchmark Results

group                     main                                   pr
-----                     ----                                   --
analyzer/css.js           1.03      2.1±0.02ms     5.6 MB/sec    1.00      2.0±0.02ms     5.7 MB/sec
analyzer/index.js         1.02      6.0±0.06ms     5.5 MB/sec    1.00      5.9±0.03ms     5.6 MB/sec
analyzer/lint.ts          1.02      2.6±0.02ms    16.0 MB/sec    1.00      2.5±0.03ms    16.3 MB/sec
analyzer/parser.ts        1.01      7.2±0.06ms     6.8 MB/sec    1.00      7.1±0.11ms     6.9 MB/sec
analyzer/router.ts        1.03      5.1±0.06ms    12.0 MB/sec    1.00      4.9±0.03ms    12.3 MB/sec
analyzer/statement.ts     1.02      6.9±0.02ms     5.2 MB/sec    1.00      6.7±0.02ms     5.3 MB/sec
analyzer/typescript.ts    1.02     10.5±0.09ms     5.2 MB/sec    1.00     10.3±0.07ms     5.3 MB/sec

@leops leops merged commit de7b7a0 into main Nov 14, 2022
@leops leops deleted the feature/useless-suppression-warning branch November 14, 2022 13:39
@leops leops added the A-Linter Area: linter label Nov 14, 2022
jeysal added a commit to jeysal/rometools that referenced this pull request Nov 14, 2022
* upstream/main: (45 commits)
  website(docs): set `color-scheme` on the root element (rome#3721)
  feat(rome_analyze): add a warning for unused suppression comments (rome#3718)
  feat(rome_js_analyze): Implement prefer-numeric-literals lint (rome#3558)
  feat(rome_js_formatter): jestEach template literals rome#3308 (rome#3582)
  doc(website): Add context about Romes philosophy (rome#3714)
  fix(rome_js_formatter): Single-line comment below a JSX prop triggers… (rome#3641)
  test(rome_js_formatter): update prettier tests (rome#3684)
  fix(rome_js_parser): improve await handling in non-async context (rome#3573)
  fix(rome_js_parser): improve yield parsing in non generator function (rome#3622)
  More playground polish
  Fix backgrounds
  Fix height
  Align docs.rome.tools with rome.tools
  Reenable compression
  Add missing width
  website(docs): More playground IDE features (rome#3711)
  fix(rome_js_formatter): new expression attribute (rome#3686)
  docs(website): added checkbox to toggle linter in playground (rome#3699)
  website(docs): More website tweaks (rome#3707)
  website(docs): Add default layout property (rome#3705)
  ...
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-Linter Area: linter
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🐛 Unused rome-ignore suppression comments should be flagged
2 participants