Skip to content

Conversation

just-boris
Copy link
Member

Description

Upgrade eslint to v9

Related links, issue #, if available: n/a

How has this been tested?

  • PR build
  • Made some rule violations locally, saw eslint errors
Review checklist

The following items are to be evaluated by the author(s) and the reviewer(s).

Correctness

  • Changes include appropriate documentation updates.
  • Changes are backward-compatible if not indicated, see CONTRIBUTING.md.
  • Changes do not include unsupported browser features, see CONTRIBUTING.md.
  • Changes were manually tested for accessibility, see accessibility guidelines.

Security

Testing

  • Changes are covered with new/existing unit tests?
  • Changes are covered with new/existing integration tests?

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@@ -15,7 +15,6 @@ const data1 = [...data, thresholdSeries];
// Position of the threshold series in a stacked chart must not affect chart's plot.
const data2 = [data[0], thresholdSeries, data[1], data[2]];

/* eslint-disable react/jsx-key */
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eslint now prints a warning if a disable directive does nothing. Removed all useless disables

@@ -130,7 +128,9 @@ export function DateForm({ filter, value, onChange }: PropertyFilterOperatorForm

// Parse value from filter text when it changes.
useEffect(() => {
filter && setState(parseDateTimeFilter(filter.trim()));
Copy link
Member Author

@just-boris just-boris May 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@typescript-eslint/no-unused-expressions is enabled now and it fails on this pattern

@@ -8,7 +8,7 @@ import AppLayoutToolbar, { AppLayoutToolbarProps } from '../../../lib/components
import createWrapper from '../../../lib/components/test-utils/dom';
import BreadcrumbGroup from '../../../lib/components/breadcrumb-group';

export function renderComponent(jsx: React.ReactElement) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

jest/no-export rule in action

const stickyNotificationsHeight = stickyNotifications ? notificationsHeight ?? 0 : 0;
const stickyNotificationsHeight = stickyNotifications ? (notificationsHeight ?? 0) : 0;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prettier dependency got upgraded in this PR: 3.2.5 -> 3.5.3

@@ -1,5 +1,7 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

/* eslint-disable jest/no-export */
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This rule fails to detect test helper files. We do not have too many, disabled manually for now

@@ -278,7 +278,6 @@ export default function CollapsibleFlashbar({ items, ...restProps }: FlashbarPro
>
{showInnerContent(item) && (
<Flash
// eslint-disable-next-line react/forbid-component-props
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do not have this rule enabled, react/forbid-component-props

@just-boris just-boris force-pushed the upgrade-eslint branch 3 times, most recently from 960ab78 to 965e863 Compare June 26, 2025 20:58
},
},
{
files: [
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copied this list from .eslintrc.js without changes. Related ticket: AWSUI-21112

filename: './src/button/index.tsx',
options: [ruleHardcodedPath],
errors: [{ message: "Disallowed import 'src/index.ts' in favor of having smaller bundle sizes." }],
},
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicated test. The new version detects and calls this out

@@ -1,13 +1,15 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated eslint captured all JS/TS files in our repo, not just src

@@ -65,6 +65,7 @@ function CornerMarker(props: {
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 10 10"
style={{ inlineSize: '50px', blockSize: '50px', position: 'absolute', ...props }}
focusable="false"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cloudscape-design/components/no-implicit-svg-focusable rule in action. Now across the whole project

@@ -18,7 +18,7 @@ describe('A11y checks for app layout toolbar', () => {
.forEach(inputUrl => {
const url = `#/light/${inputUrl}?${getUrlParams('refresh-toolbar')}`;
test(
url,
`${url}`,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixing jest/valid-title

@@ -2,6 +2,7 @@
"compilerOptions": {
"strict": true,
"incremental": true,
"types": [],
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default value is not an empty array but node_modules/@types/** which loads some unnecessary typings in the scope

@just-boris just-boris marked this pull request as ready for review June 27, 2025 15:16
@just-boris just-boris requested a review from a team as a code owner June 27, 2025 15:16
@just-boris just-boris requested review from Al-Dani and removed request for a team June 27, 2025 15:16
Al-Dani
Al-Dani previously approved these changes Jul 7, 2025
@@ -26,6 +26,7 @@ const defaultProps: DateRangePickerProps = {
const outsideId = 'outside';
function renderDateRangePicker(props: DateRangePickerProps = defaultProps) {
const ref = React.createRef<HTMLInputElement>();
console.log(props);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: small leftover

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Copy link

codecov bot commented Jul 7, 2025

Codecov Report

Attention: Patch coverage is 95.74468% with 2 lines in your changes missing coverage. Please review.

Project coverage is 96.61%. Comparing base (c3faf5c) to head (d5e0438).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/file-dropzone/use-files-dragging.ts 75.00% 1 Missing ⚠️
src/mixed-line-bar-chart/internal.tsx 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3509      +/-   ##
==========================================
- Coverage   96.62%   96.61%   -0.01%     
==========================================
  Files         813      813              
  Lines       23687    23700      +13     
  Branches     8312     8305       -7     
==========================================
+ Hits        22887    22898      +11     
- Misses        746      795      +49     
+ Partials       54        7      -47     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@just-boris just-boris enabled auto-merge July 7, 2025 11:45
@just-boris just-boris requested a review from Al-Dani July 7, 2025 11:48
@just-boris just-boris added this pull request to the merge queue Jul 7, 2025
Merged via the queue into main with commit 37247fb Jul 7, 2025
38 checks passed
@just-boris just-boris deleted the upgrade-eslint branch July 7, 2025 12:13
abdhalees pushed a commit that referenced this pull request Jul 8, 2025
pranshuteotia pushed a commit to pranshuteotia/components that referenced this pull request Sep 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants