Skip to content

Commit

Permalink
Merge pull request #523 from IQSS/feat/373-prettier-check
Browse files Browse the repository at this point in the history
Check/Format correct files with Prettier
  • Loading branch information
ofahimIQSS authored Oct 21, 2024
2 parents 59579ca + 3d040a6 commit 31c2d49
Show file tree
Hide file tree
Showing 59 changed files with 306 additions and 238 deletions.
33 changes: 33 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Ignore Cypress autogenerated files
.nyc_output
coverage
cypress
merged-coverage

# Ignore dev environment files
dev-env

# Ignore deployment files
deployment

# Ignore both dist folders from SPA and Design System
dist
/packages/design-system/dist

# Ignore mdx files due to different conflicts between prettier and mdx files
*.mdx

# Ignore config files
.babelrc
.eslintrc.json
.nycrc.json
.prettierrc
.stylelintrc.json
cypress.config.ts
dev.Dockerfile
lerna.json
LICENSE
package.json
package-lock.json
tsconfig.json
vite.config.ts
4 changes: 2 additions & 2 deletions .storybook/preview-head.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<script>
window.global = window;
</script>
window.global = window
</script>
8 changes: 8 additions & 0 deletions .stylelintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@
{
"ignoreSelectors": [":export"]
}
],
"at-rule-empty-line-before": [
"always",
{
"ignore": ["after-comment", "first-nested", "inside-block", "blockless-after-same-name-blockless"],
"severity": "warning",
"except": ["blockless-after-blockless"]
}
]
}
}
25 changes: 4 additions & 21 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,17 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href='/favicon.ico' />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Open source research data repository software"
/>
<link rel="apple-touch-icon" href='/logo192.png' />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href='/manifest.json' />
<meta name="description" content="Open source research data repository software" />
<link rel="apple-touch-icon" href="/logo192.png" />
<link rel="manifest" href="/manifest.json" />
<title>Dataverse</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
<script type="module" src="/src/index.tsx"></script>
</html>
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@
"build": "tsc && vite build",
"preview": "vite preview",
"lint": "npm run lint:eslint && npm run lint:stylelint && npm run lint:prettier",
"lint:fix": "eslint --fix --ext .ts,.tsx ./src --ignore-path .gitignore . && stylelint --fix **/*.scss && prettier --write '**/*.(yml|json|md|css)'",
"lint:fix": "eslint --fix --ext .ts,.tsx ./src --ignore-path .gitignore . && stylelint --fix **/*.scss && prettier . --write",
"lint:eslint": "eslint --ignore-path .gitignore .",
"lint:stylelint": "stylelint **/*.scss ",
"lint:prettier": "prettier --check '**/*.(yml|json|md|css)' --ignore-path packages/design-system/.gitignore",
"lint:prettier": "prettier . --check",
"format": "prettier --write './**/*.{js,jsx,ts,tsx,css,md,json,yml,md}' --config ./.prettierrc",
"cy:open-e2e": "cypress open --e2e --browser chrome",
"cy:open-unit": "cypress open --component --browser chrome",
Expand Down
4 changes: 2 additions & 2 deletions packages/design-system/.storybook/preview-head.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<script>
window.global = window;
</script>
window.global = window
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ $dv-font-size: 16px;
$dv-font-size-sm: 12px;
$dv-brand-font-size: 24px;

$dv-font-family: ("Helvetica Neue",helvetica,arial,sans-serif);
$dv-font-family: ('Helvetica Neue', helvetica, arial, sans-serif);

$dv-font-weight: 400;
$dv-font-weight-light: 300;
Expand All @@ -19,4 +19,4 @@ $dv-line-height: 1.5;
fontWeightLight: $dv-font-weight-light;
fontWeightBold: $dv-font-weight-bold;
lineHeight: $dv-line-height;
}
}
88 changes: 67 additions & 21 deletions packages/design-system/src/lib/assets/styles/fontcustom.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,22 @@
font-weight: normal;
font-family: fontcustom;
font-style: normal;
src: url("fontcustom/fontcustom_8c9f858763dbca8e064e7fd59d1aa2b7.woff2") format("woff2"),
url("fontcustom/fontcustom_8c9f858763dbca8e064e7fd59d1aa2b7.woff") format("woff"),
url("fontcustom/fontcustom_8c9f858763dbca8e064e7fd59d1aa2b7.ttf") format("truetype"),
url("fontcustom/fontcustom_8c9f858763dbca8e064e7fd59d1aa2b7.svg#fontcustom") format("svg");
src: url('fontcustom/fontcustom_8c9f858763dbca8e064e7fd59d1aa2b7.woff2') format('woff2'),
url('fontcustom/fontcustom_8c9f858763dbca8e064e7fd59d1aa2b7.woff') format('woff'),
url('fontcustom/fontcustom_8c9f858763dbca8e064e7fd59d1aa2b7.ttf') format('truetype'),
url('fontcustom/fontcustom_8c9f858763dbca8e064e7fd59d1aa2b7.svg#fontcustom') format('svg');
}

@media screen and (min-resolution) {
@font-face {
font-family: fontcustom;
src: url("fontcustom/fontcustom_8c9f858763dbca8e064e7fd59d1aa2b7.svg#fontcustom") format("svg");
src: url('fontcustom/fontcustom_8c9f858763dbca8e064e7fd59d1aa2b7.svg#fontcustom') format('svg');
}
}

[data-icon]::before { content: attr(data-icon); }
[data-icon]::before {
content: attr(data-icon);
}

[data-icon]::before,
.icon-astro::before,
Expand Down Expand Up @@ -50,18 +52,62 @@
-webkit-font-smoothing: antialiased;
}

.icon-astro::before { content: "\f100"; }
.icon-audio::before { content: "\f101"; }
.icon-code::before { content: "\f102"; }
.icon-collection::before { content: "\f103"; }
.icon-dataset::before { content: "\f104"; }
.icon-document::before { content: "\f105"; }
.icon-file::before { content: "\f106"; }
.icon-geodata::before { content: "\f107"; }
.icon-image::before { content: "\f108"; }
.icon-network::before { content: "\f109"; }
.icon-other::before { content: "\f10a"; }
.icon-package::before { content: "\f10b"; }
.icon-tabular::before { content: "\f10c"; }
.icon-unlock::before { content: "\f10d"; }
.icon-video::before { content: "\f10e"; }
.icon-astro::before {
content: '\f100';
}

.icon-audio::before {
content: '\f101';
}

.icon-code::before {
content: '\f102';
}

.icon-collection::before {
content: '\f103';
}

.icon-dataset::before {
content: '\f104';
}

.icon-document::before {
content: '\f105';
}

.icon-file::before {
content: '\f106';
}

.icon-geodata::before {
content: '\f107';
}

.icon-image::before {
content: '\f108';
}

.icon-network::before {
content: '\f109';
}

.icon-other::before {
content: '\f10a';
}

.icon-package::before {
content: '\f10b';
}

.icon-tabular::before {
content: '\f10c';
}

.icon-unlock::before {
content: '\f10d';
}

.icon-video::before {
content: '\f10e';
}
5 changes: 2 additions & 3 deletions packages/design-system/src/lib/assets/styles/index.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
@import "fontcustom";
@import "bootstrap-customized";

@import 'fontcustom';
@import 'bootstrap-customized';
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,25 @@
@import 'src/lib/assets/styles/design-tokens/colors.module';

.primary:not(#\#) {
color: color-contrast($dv-primary-color);
color: color-contrast($dv-primary-color);
}

.secondary:not(#\#) {
color: color-contrast($dv-secondary-color);
color: color-contrast($dv-secondary-color);
}

.info:not(#\#) {
color: color-contrast($dv-info-color);
color: color-contrast($dv-info-color);
}

.success:not(#\#) {
color: color-contrast($dv-success-color);
color: color-contrast($dv-success-color);
}

.warning:not(#\#) {
color: color-contrast($dv-warning-color);
color: color-contrast($dv-warning-color);
}

.danger:not(#\#) {
color: color-contrast($dv-danger-color);
}
color: color-contrast($dv-danger-color);
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
@import "src/lib/assets/styles/design-tokens/colors.module";
@import 'src/lib/assets/styles/design-tokens/colors.module';

.border > button, .border > [role="group"] > button {
.border > button,
.border > [role='group'] > button {
border: 1px solid $dv-button-border-color;
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
.spacing {
margin: 0 7px;
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
.spacing {
margin: 0 7px
margin: 0 7px;
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@import "src/lib/assets/styles/design-tokens/typography.module";
@import 'src/lib/assets/styles/design-tokens/typography.module';

.title {
padding-top: calc(0.375rem + 1px);
padding-bottom: calc(0.375rem + 1px);
font-weight: $dv-font-weight-bold;
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@import "src/lib/assets/styles/design-tokens/colors.module";
@import 'src/lib/assets/styles/design-tokens/colors.module';

.asterisk {
color: $dv-danger-color;
}
color: $dv-danger-color;
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
.icon {
margin-right: .3em;
}
margin-right: 0.3em;
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
.table > thead {
text-align: center;
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
@import "src/lib/assets/styles/design-tokens/colors.module";
@import 'src/lib/assets/styles/design-tokens/colors.module';

.question-tooltip {
color: $dv-tooltip-color;
}

.question-tooltip:hover {
color: $dv-tooltip-hover-color;
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.tooltip {
display: inline-block;
vertical-align: 0.125em;
}
}
18 changes: 9 additions & 9 deletions packages/design-system/tests/support/component-index.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
<title>Components App</title>
</head>
<body>
<div data-cy-root></div>
</body>
</html>
</head>
<body>
<div data-cy-root></div>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import "node_modules/@iqss/dataverse-design-system/src/lib/assets/styles/design-tokens/colors.module";
@import 'node_modules/@iqss/dataverse-design-system/src/lib/assets/styles/design-tokens/colors.module';

.errorText {
color: $dv-danger-color;
Expand All @@ -7,4 +7,4 @@
.warningText {
margin-bottom: 0;
color: $dv-warning-color;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@
@media (min-width: 768px) {
padding-left: 1rem;
}
}
}
Loading

0 comments on commit 31c2d49

Please sign in to comment.