Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code Quality Update #2033

Open
wants to merge 167 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
167 commits
Select commit Hold shift + click to select a range
5bffdcd
Basic Husky + ESLint + Prettier configuration
Mil4n0r Apr 9, 2024
30b4fcf
Fixed incorrect values in eslint config
Mil4n0r Apr 9, 2024
8a04180
Fixed TS problems within ESLint
Mil4n0r Apr 9, 2024
5ce33b2
Fixed some of the errors detected by eslint
Mil4n0r Apr 9, 2024
c9b0e19
Converted configuration files to TS
Mil4n0r Apr 9, 2024
d32c8e9
Added security plugin to ESLint
Mil4n0r Apr 11, 2024
2c0a962
Removed unwanted comment
Mil4n0r Apr 11, 2024
e424fbc
Fixing ESLint detected problems
Mil4n0r Apr 11, 2024
9bc889f
Fixing ESLint detected problems
Mil4n0r Apr 12, 2024
4552df1
Fixing ESLint detected problems
Mil4n0r Apr 12, 2024
db358cf
Fixing ESLint detected problems
Mil4n0r Apr 12, 2024
ffbb1d7
Run prettier in the whole src/
Mil4n0r Apr 12, 2024
4a16152
Fixing ESLint detected problems
Mil4n0r Apr 12, 2024
260206f
Moved accessibility files
Mil4n0r Apr 12, 2024
f24aa79
Changed tsconfig rootDir
Mil4n0r Apr 12, 2024
5137f2a
Modified TS config to allow jest configs
Mil4n0r Apr 15, 2024
f591059
Fixed minor bugs after refactoring
Mil4n0r Apr 15, 2024
a470dbe
Relocated accessibility config files
Mil4n0r Apr 15, 2024
966289c
Removed rootDir from tsconfig
Mil4n0r Apr 15, 2024
9c77af7
Changed mocks from js to ts
Mil4n0r Apr 15, 2024
4e03fce
Modified certain incorrect default blocks
Mil4n0r Apr 15, 2024
26763e3
Fixed checkbox color
Mil4n0r Apr 15, 2024
e23ffbe
Minor fixes
Mil4n0r Apr 15, 2024
361e606
Removed ESLint rule comment
Mil4n0r Apr 16, 2024
8a6e16c
Removed unexpected end of line
Mil4n0r Apr 16, 2024
e5bf87c
Fixed key code typo
Mil4n0r Apr 16, 2024
7c795f1
Removed unnecessary 'break'
Mil4n0r Apr 16, 2024
1ff6f24
Refactored some if/else blocks
Mil4n0r Apr 16, 2024
d2bc8f5
Refactored certain exports/imports
Mil4n0r Apr 16, 2024
f05db8f
Added pending disabledRule
Mil4n0r Apr 16, 2024
eceb4ff
Removed unneeded .eslintrc rules
Mil4n0r Apr 16, 2024
1076feb
Changed .prettierrc config
Mil4n0r Apr 16, 2024
9648aa9
Changed .prettierrc config
Mil4n0r Apr 16, 2024
a8bfd61
Removed unwanted change in website
Mil4n0r Apr 16, 2024
fbc36f7
Changed .prettierrc config
Mil4n0r Apr 16, 2024
f87233c
Changed if/else structure
Mil4n0r Apr 16, 2024
c69417a
Merge branch 'master' of github.com:dxc-technology/halstack-react int…
Mil4n0r Apr 16, 2024
88fe54c
Changed default export name
Mil4n0r Apr 16, 2024
0f5dd74
Fixed default export disabledRules
Mil4n0r Apr 16, 2024
0400789
Fix problem in container style
Mil4n0r Apr 16, 2024
dac50f5
Merge branch 'master' of github.com:dxc-technology/halstack-react int…
Mil4n0r Apr 18, 2024
96a367c
Modified webpack config to match ES6 and TS
Mil4n0r Apr 18, 2024
e6e7ebd
Changed babel configuration format to match prettier
Mil4n0r Apr 18, 2024
50ce94e
Reverted Chip changes to types
Mil4n0r Apr 18, 2024
acf6f7d
Moved webpack to devDependencies
Mil4n0r Apr 22, 2024
03280ff
Merge branch 'master' into Mil4n0r/code_quality
Mil4n0r Apr 22, 2024
8f50082
Fixed radix bug
Mil4n0r Apr 22, 2024
1525c77
Rollback useEffect dependencies
Mil4n0r Apr 22, 2024
71a999e
Removed unneeded console.log
Mil4n0r Apr 22, 2024
000ee47
Removed font import in storybook preview
Mil4n0r Apr 22, 2024
e912d89
Added generated IDs for keys over indexes
Mil4n0r Apr 23, 2024
4e654e8
Fixed problem with v4 typing
Mil4n0r Apr 23, 2024
6678b93
Solved conflicts
Mil4n0r Apr 30, 2024
99fa7cf
Restored changes to key ids that were causing errors in the tests
Mil4n0r Apr 30, 2024
823d8e6
Updated package-lock
Mil4n0r May 2, 2024
7bfced3
Merge branch 'master' into Mil4n0r/code_quality
Mil4n0r May 3, 2024
4a81138
Merge branch 'master' of github.com:dxc-technology/halstack-react int…
Mil4n0r May 6, 2024
3cf4e29
Merge branch 'Mil4n0r/code_quality' of github.com:dxc-technology/hals…
Mil4n0r May 6, 2024
b1fca48
Merge branch 'master' into Mil4n0r/code_quality
Mil4n0r May 13, 2024
7760e0e
Fixed error in conflicts
Mil4n0r May 13, 2024
a9f112e
Restored keys
Mil4n0r May 13, 2024
88d2755
Removed unneeded dev dependency
Mil4n0r May 13, 2024
8508d78
Fixed problem with dependencies
Mil4n0r May 13, 2024
d511437
Removed build storybook log
Mil4n0r May 14, 2024
ce30cea
Merge branch 'master' of github.com:dxc-technology/halstack-react int…
Mil4n0r May 20, 2024
4d6048d
Merge branch 'master' of github.com:dxc-technology/halstack-react int…
Mil4n0r Jul 3, 2024
bfe2073
Chromatic flow improvement
Mil4n0r Jul 3, 2024
ecf1799
Updated storybook
Mil4n0r Jul 3, 2024
1c33de8
Merged changes from monorepo update
Mil4n0r Jul 4, 2024
42f352e
Removed repeated import
Mil4n0r Jul 4, 2024
5ee7850
Fixed import in Icon accessibility test
Mil4n0r Jul 4, 2024
7eb0369
Fixed chromatic settings and Breadcrumbs import
Mil4n0r Jul 4, 2024
b6f685e
Fixed problem with DXC Icon
Mil4n0r Jul 4, 2024
3051bcc
Refactoring configuration files
Mil4n0r Jul 4, 2024
f5ab5a5
Added Eslint recommendations
Mil4n0r Jul 5, 2024
6afb630
Updated package.json
Mil4n0r Jul 5, 2024
5fb4784
Merge changes and solve remaining conflicts
Mil4n0r Jul 5, 2024
3df3af1
Update package-lock
Mil4n0r Jul 5, 2024
ba5296e
Fixed problem resolving css from BarChart
Mil4n0r Jul 5, 2024
bc42a72
Added husky
Mil4n0r Jul 5, 2024
b9d64d2
Added lint-staged
Mil4n0r Jul 5, 2024
03b87a8
Fixed problem with lint-staged
Mil4n0r Jul 5, 2024
a03fa67
Testing husky
Mil4n0r Jul 5, 2024
b133c2c
Installed husky correctly
Mil4n0r Jul 5, 2024
e3c39d4
Fixed tables in website documentation
Mil4n0r Jul 8, 2024
37907b6
Updated package-lock
Mil4n0r Jul 8, 2024
7d79cf4
Merge branch 'master' of github.com:dxc-technology/halstack-react int…
Mil4n0r Jul 8, 2024
56a8eb3
Merge branch 'master' of github.com:dxc-technology/halstack-react int…
Mil4n0r Jul 8, 2024
24833ad
Removed duplicate
Mil4n0r Jul 8, 2024
5436b2c
Merge with master
Mil4n0r Jul 8, 2024
343663c
Removed duplicate babel config
Mil4n0r Jul 8, 2024
3659e8a
Merge branch 'master' into Mil4n0r/code_quality_monorepo
Mil4n0r Jul 9, 2024
41fabc6
Fixed eslint configuration
Mil4n0r Jul 9, 2024
1ccaf08
Reactivated husky
Mil4n0r Jul 9, 2024
9f1de1f
Removed duplicate file
Mil4n0r Jul 9, 2024
31ea535
Fixed typo
Mil4n0r Jul 9, 2024
60758ec
Removed prettier from lint-staged flow to make review easier
Mil4n0r Jul 9, 2024
cf14339
Merge branch 'master' into Mil4n0r/code_quality_monorepo
Mil4n0r Jul 9, 2024
5e7b4bb
Merge branch 'master' of github.com:dxc-technology/halstack-react int…
Mil4n0r Jul 24, 2024
8a67d40
Merge branch 'Mil4n0r/code_quality_monorepo' of github.com:dxc-techno…
Mil4n0r Jul 24, 2024
bcda53d
Merge branch 'master' into Mil4n0r/code_quality_monorepo
Mil4n0r Jul 25, 2024
faf4e5b
Merge branch 'master' into Mil4n0r/code_quality_monorepo
Mil4n0r Aug 2, 2024
6a61e76
Removed unneeded lines in tests
Mil4n0r Aug 2, 2024
fb2f22f
Added additional rule for .storybook eslint
Mil4n0r Aug 2, 2024
6c99e45
Added additional rule for .storybook eslint
Mil4n0r Aug 2, 2024
71bde24
Updated TS configuration
Mil4n0r Aug 2, 2024
17f3e63
Test
Mil4n0r Aug 2, 2024
3135dee
Test husky
Mil4n0r Aug 2, 2024
8096ba0
Test include
Mil4n0r Aug 2, 2024
807fa29
Restore husky settings
Mil4n0r Aug 2, 2024
c9caa64
Fixed most of DTS build errors
Mil4n0r Aug 6, 2024
83d6ef9
Fixed more DTS build errors
Mil4n0r Aug 7, 2024
6b79326
Solved conflicts and added most of the remaining types
Mil4n0r Aug 8, 2024
b4ecbd5
Removed deprecated lines from husky config
Mil4n0r Aug 8, 2024
c9dca5f
Fixed package-lock
Mil4n0r Aug 8, 2024
b75b359
Fixed remaining types from lib
Mil4n0r Aug 8, 2024
c6f83bf
Removed old TODO's
Mil4n0r Aug 8, 2024
3d1e8bb
Finished fixing the types of the project
Mil4n0r Aug 8, 2024
da9a889
Fixed visual bug for Slider
Mil4n0r Aug 8, 2024
3271892
Merge branch 'master' of github.com:dxc-technology/halstack-react int…
Mil4n0r Aug 19, 2024
d0ea1b8
Fixed eslint for scripts
Mil4n0r Aug 19, 2024
977cbb0
Fixed warning in accordion
Mil4n0r Aug 19, 2024
4dd6f98
Added missing parenthesis in accordion
Mil4n0r Aug 20, 2024
b76afb2
Merge branch 'master' of github.com:dxc-technology/halstack-react int…
Mil4n0r Sep 18, 2024
4c99aff
Fixed typings
Mil4n0r Sep 18, 2024
127ab0a
Merge branch 'master' into Mil4n0r/code_quality_monorepo
Mil4n0r Sep 18, 2024
ec86ec1
Added tsc to check typescript errors
Mil4n0r Sep 18, 2024
8a5038e
Merge branch 'Mil4n0r/code_quality_monorepo' of github.com:dxc-techno…
Mil4n0r Sep 18, 2024
b4bd635
Fixed typings problems for new tabs structure
Mil4n0r Sep 18, 2024
0b2198c
Fixed tests not passing for new tabs structure
Mil4n0r Sep 18, 2024
ce8a1f5
Fixed minor problems in tabs display
Mil4n0r Sep 18, 2024
e8a308f
Merge branches 'Mil4n0r/code_quality_monorepo' and 'master' of github…
Mil4n0r Sep 19, 2024
c745a02
Merge branch 'master' of github.com:dxc-technology/halstack-react int…
Mil4n0r Sep 20, 2024
f720ae2
Fixed some minor problems in Toast behavior
Mil4n0r Sep 20, 2024
12b4c59
Fixed extension of test helper
Mil4n0r Sep 20, 2024
8949350
Merge branch 'master' of github.com:dxc-technology/halstack-react int…
Mil4n0r Sep 25, 2024
c9118fd
Resolved conflicts
Mil4n0r Oct 29, 2024
a37ca53
Fixed build problems
Mil4n0r Oct 29, 2024
aee09b3
Fixed typos
Mil4n0r Oct 29, 2024
4cb3a9b
Merge branch 'master' of github.com:dxc-technology/halstack-react int…
Mil4n0r Oct 29, 2024
72092a0
Merge branch 'master' of github.com:dxc-technology/halstack-react int…
Mil4n0r Nov 13, 2024
2e89de0
Merge branch 'master' into Mil4n0r/code_quality_monorepo
Mil4n0r Nov 28, 2024
7ef6ff7
Merge branch 'master' of github.com:dxc-technology/halstack-react int…
Dec 3, 2024
4f19395
Fixed problems for build
Dec 3, 2024
d59da8d
Restored package-lock
Dec 3, 2024
0ba3607
Merge branch 'master' of github.com:dxc-technology/halstack-react int…
Mil4n0r Dec 16, 2024
8fbe712
Removed unused import
Mil4n0r Dec 16, 2024
1f6201c
Fixed build problems
Mil4n0r Dec 16, 2024
4089918
Fixed FocusLock bug
Mil4n0r Dec 16, 2024
dbe0c14
Merge branch 'Mil4n0r/strict-mode-true' of github.com:dxc-technology/…
Mil4n0r Dec 19, 2024
618156e
Fixed build problems and most of the remaining types
Mil4n0r Dec 19, 2024
48c579b
Removed some dangerous type assertions to use type guards instead
Mil4n0r Dec 20, 2024
6b98af6
Fixed package-lock
Mil4n0r Dec 20, 2024
29d90c7
Merge branch 'Mil4n0r/strict-mode-true' of github.com:dxc-technology/…
Mil4n0r Dec 23, 2024
f09637c
Merge branch 'Mil4n0r/strict-mode-true' of github.com:dxc-technology/…
Mil4n0r Dec 24, 2024
ee87b51
Merge branch 'master' into Mil4n0r/code_quality_monorepo
Mil4n0r Dec 24, 2024
5f6092c
Removed more type assertions
Mil4n0r Dec 24, 2024
8fc1b12
Merge branch 'Mil4n0r/code_quality_monorepo' of github.com:dxc-techno…
Mil4n0r Dec 24, 2024
8002907
Solved build problem
Mil4n0r Dec 24, 2024
22b4ae4
Restored popover import
Mil4n0r Dec 24, 2024
bcb9f90
Restored types for select
Mil4n0r Dec 24, 2024
9a2d297
Removed redundant return undefined
Dec 30, 2024
55b4b36
Updated FocusLock with latest changes
Dec 30, 2024
e7d00ec
Fixed minor issues
Dec 30, 2024
6d375a1
Removed unwanted TODO
Dec 30, 2024
278941c
Added removed return
Dec 30, 2024
108d8e2
Merge branch 'master' of github.com:dxc-technology/halstack-react int…
Jan 7, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added .eslintrc.js
Empty file.
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx lint-staged
8 changes: 8 additions & 0 deletions .lintstagedrc.js
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The prettier part will be uncommented on a separate PR to prevent increasing the review size (even further)

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module.exports = {
"(apps|packages)/**/*.(ts|tsx|js)": (filenames) => {
return [
`npx eslint --fix --max-warnings 0 ${filenames.map((file) => `"${file}"`).join(" ")}`,
// `npx prettier --write ${filenames.map((file) => `"${file}"`).join(" ")}`
];
},
};
3 changes: 1 addition & 2 deletions .lycheeignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
http://localhost
%25PUBLIC_URL%25
http://localhost
18 changes: 17 additions & 1 deletion apps/website/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
{
"extends": "next/core-web-vitals"
"extends": [
"next/core-web-vitals",
"@dxc-technology/eslint-config/react-internal.js",
"@dxc-technology/eslint-config/next.js"
],
"rules": {
"no-unused-vars": [
"warn",
{
"argsIgnorePattern": "^_"
}
],
// TODO: Remove rules
"react/no-unescaped-entities": "off",
"import/no-anonymous-default-export": "off",
"react-hooks/exhaustive-deps": "off"
}
}
2 changes: 1 addition & 1 deletion apps/website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
"lint": "eslint . --max-warnings 0"
},
"dependencies": {
"@cloudscape-design/components": "^3.0.706",
Expand Down
2 changes: 2 additions & 0 deletions apps/website/screens/common/HalstackMarkdownParser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ const HalstackMarkdownParser = ({ markdown }: { markdown: string }) => (
h3: ({ children }) => (
<DxcHeading
level={4}
// TODO: Find an alternative to the eslint-disable
// eslint-disable-next-line no-control-regex
text={Children?.map(children, (child) => (child as string).replace(/[^\x00-\x7F]/g, ""))?.join("") ?? ""}
/>
),
Expand Down
2 changes: 1 addition & 1 deletion apps/website/screens/common/Section.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ReactNode } from "react";
import { DxcFlex } from "@dxc-technology/halstack-react";
import HeadingLink from "./HeadingLink";
import { ReactNode } from "react";

type LevelEnum = 1 | 2 | 3 | 4 | 5;

Expand Down
18 changes: 10 additions & 8 deletions apps/website/screens/common/example/Example.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,16 @@ const Example = ({ actionsVisible = true, defaultIsVisible = false, example }: E
};

const handleCopy = () => {
navigator.clipboard
.writeText(example.code)
.then(() => {
toast.success({ message: "Code copied to the clipboard." });
})
.catch(() => {
toast.warning({ message: "Failed to copy the text to the clipboard." });
});
if (example.code) {
navigator.clipboard
.writeText(example.code)
.then(() => {
toast.success({ message: "Code copied to the clipboard." });
})
.catch(() => {
toast.warning({ message: "Failed to copy the text to the clipboard." });
});
}
};

return (
Expand Down
170 changes: 87 additions & 83 deletions apps/website/screens/components/badge/code/BadgeCodePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,89 +13,93 @@ const sections = [
title: "Props",
content: (
<DxcTable>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
<th>Default</th>
</tr>
<tr>
<td>label</td>
<td>
<TableCode>string | number</TableCode>
</td>
<td>Text to be placed in the badge.</td>
<td>-</td>
</tr>
<tr>
<td>mode</td>
<td>
<TableCode>'contextual' | 'notification'</TableCode>
</td>
<td>The available badge modes.</td>
<td>
<TableCode>'contextual'</TableCode>
</td>
</tr>
<tr>
<td>notificationLimit</td>
<td>
<TableCode>number</TableCode>
</td>
<td>
In notification mode, if the number entered as label is greater that this notification limit,{" "}
<TableCode>+notificationLimit</TableCode> will be shown. If not, the entered text will be shown as label.
</td>
<td>
<TableCode>99</TableCode>
</td>
</tr>
<tr>
<td>title</td>
<td>
<TableCode>string</TableCode>
</td>
<td>
Text representing advisory information related to the badge. Under the hood, this prop also serves as an
accessible label for the component.
</td>
<td>-</td>
</tr>
<tr>
<td>color</td>
<td>
<TableCode>'grey' | 'blue' | 'green' | 'orange' | 'red' | 'yellow' | 'purple'</TableCode>
</td>
<td>Affects the visual style of the badge. It can be used following semantic purposes or not.</td>
<td>
<TableCode>'grey'</TableCode>
</td>
</tr>
<tr>
<td>icon</td>
<td>
<TableCode>string | {"(React.ReactNode & React.SVGProps <SVGSVGElement>)"}</TableCode>
</td>
<td>
<DxcLink newWindow href="https://fonts.google.com/icons">
Material Symbol
</DxcLink>{" "}
name or SVG element as the icon that will be placed next to the badge label. When using Material Symbols,
replace spaces with underscores. By default they are outlined, if you want it to be filled prefix the symbol
name with <TableCode>"filled_"</TableCode>.
</td>
<td>-</td>
</tr>
<tr>
<td>size</td>
<td>
<TableCode>'small' | 'medium' | 'large'</TableCode>
</td>
<td>Size of the component.</td>
<td>
<TableCode>'medium'</TableCode>
</td>
</tr>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
<th>Default</th>
</tr>
</thead>
<tbody>
<tr>
<td>label</td>
<td>
<TableCode>string | number</TableCode>
</td>
<td>Text to be placed in the badge.</td>
<td>-</td>
</tr>
<tr>
<td>mode</td>
<td>
<TableCode>'contextual' | 'notification'</TableCode>
</td>
<td>The available badge modes.</td>
<td>
<TableCode>'contextual'</TableCode>
</td>
</tr>
<tr>
<td>notificationLimit</td>
<td>
<TableCode>number</TableCode>
</td>
<td>
In notification mode, if the number entered as label is greater that this notification limit,{" "}
<TableCode>+notificationLimit</TableCode> will be shown. If not, the entered text will be shown as label.
</td>
<td>
<TableCode>99</TableCode>
</td>
</tr>
<tr>
<td>title</td>
<td>
<TableCode>string</TableCode>
</td>
<td>
Text representing advisory information related to the badge. Under the hood, this prop also serves as an
accessible label for the component.
</td>
<td>-</td>
</tr>
<tr>
<td>color</td>
<td>
<TableCode>'grey' | 'blue' | 'green' | 'orange' | 'red' | 'yellow' | 'purple'</TableCode>
</td>
<td>Affects the visual style of the badge. It can be used following semantic purposes or not.</td>
<td>
<TableCode>'grey'</TableCode>
</td>
</tr>
<tr>
<td>icon</td>
<td>
<TableCode>string | {"(React.ReactNode & React.SVGProps <SVGSVGElement>)"}</TableCode>
</td>
<td>
<DxcLink newWindow href="https://fonts.google.com/icons">
Material Symbol
</DxcLink>{" "}
name or SVG element as the icon that will be placed next to the badge label. When using Material Symbols,
replace spaces with underscores. By default they are outlined, if you want it to be filled prefix the
symbol name with <TableCode>"filled_"</TableCode>.
</td>
<td>-</td>
</tr>
<tr>
<td>size</td>
<td>
<TableCode>'small' | 'medium' | 'large'</TableCode>
</td>
<td>Size of the component.</td>
<td>
<TableCode>'medium'</TableCode>
</td>
</tr>
</tbody>
</DxcTable>
),
},
Expand Down
Loading
Loading