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

[IMPROVEMENTS - PART 1] Global quality improvement #668

Open
wants to merge 23 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 17 commits
Commits
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
25 changes: 21 additions & 4 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: Lint
on: [ push, pull_request ]
jobs:
stylelint:
name: SCSS Lint
stylelint_prettier:
name: Stylelint & Prettier
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -11,9 +11,26 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: 20

# Install project dependencies
- name: Install dependencies
run: npm ci

- name: Lint scss
run: npm ci && npm run scss-lint
# Run Prettier check command
- name: Run Prettier check
run: |
npm run prettier || {
echo "::error::Prettier check failed. Run 'npm run prettier:fix' to format your code."
exit 1
}

# Run Stylelint check command
- name: Run Stylelint check
run: |
npm run stylelint || {
echo "::error::Stylelint check failed. Run 'npm run stylelint:fix' to autofix issues."
exit 1
}
eslint:
name: ESLint
runs-on: ubuntu-latest
Expand Down
15 changes: 15 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module.exports = {
overrides: [
{
files: "*.scss",
options: {
printWidth: 100,
tabWidth: 2,
useTabs: false,
singleQuote: false,
bracketSpacing: true,
parser: "scss",
},
},
],
};
16 changes: 10 additions & 6 deletions .stylelintrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,20 @@
],
"customSyntax": "postcss-scss",
"rules": {
"declaration-colon-newline-after": null,
"function-disallowed-list": null,
"property-disallowed-list": null,
"selector-class-pattern": null,
"selector-id-pattern": null,
"selector-max-id": null,
"selector-max-class": null,
"selector-max-type": null,
"selector-max-combinators": null,
"selector-max-compound-selectors": null,
"selector-max-id": null,
"selector-max-type": null,
"selector-no-qualifying-type": null,
"selector-max-combinators": null,
"selector-class-pattern": null,
"function-disallowed-list": null,
"value-list-comma-newline-after": null,
"value-list-comma-space-after": null,
"scss/dollar-variable-default": null,
"property-disallowed-list": null
"scss/operator-no-newline-after": null
}
}
5 changes: 3 additions & 2 deletions modules/ps_contactinfo/nav.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*}
<div id="_desktop_contact_link">
<div id="contact-link" class="contact-link">

<div id="_desktop_ps_contactinfo">
<div class="ps-contactinfo">
{if $contact_infos.phone}
{* [1][/1] is for a HTML tag. *}
{l
Expand Down
28 changes: 14 additions & 14 deletions modules/ps_contactinfo/ps_contactinfo-rich.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,38 @@
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*}
<div class="contact__details">
<p class="h2 contact__title">{l s='Store information' d='Shop.Theme.Global'}</p>
<div class="contact__item">
<i class="material-icons" aria-hidden="true">&#xE55F;</i>
<div class="contact__info">{$contact_infos.address.formatted nofilter}</div>
<div class="ps-contactinfo">
<p class="h2 ps-contactinfo__title">{l s='Store information' d='Shop.Theme.Global'}</p>
<div class="ps-contactinfo__item">
<i class="material-icons" aria-hidden="true">&#xF00F;</i>
Copy link
Collaborator

Choose a reason for hiding this comment

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

for part 2 it would be interesting to put all the ex code in text so that it remains more meaningful.

<div class="ps-contactinfo__info">{$contact_infos.address.formatted nofilter}</div>
</div>
{if $contact_infos.phone}
<hr/>
<div class="contact__item">
<div class="ps-contactinfo__item">
<i class="material-icons" aria-hidden="true">&#xE0CD;</i>
<div class="contact__info"><a href="tel:{$contact_infos.phone}">{$contact_infos.phone}</a></div>
<div class="ps-contactinfo__info"><a href="tel:{$contact_infos.phone|escape:'htmlall':'UTF-8'}">{$contact_infos.phone|escape:'htmlall':'UTF-8'}</a></div>
Copy link
Contributor

Choose a reason for hiding this comment

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

What's the point of adding |escape:'htmlall':'UTF-8'?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hello @kpodemski 👋
This recommendation comes from: https://docs.cloud.prestashop.com/10-validation-checklist/#security
However, I can remove these occurrences in this PR and start a discussion in a separate PR about whether or not to include them in the entire project. Wdyt?

Copy link
Contributor

Choose a reason for hiding this comment

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

As far as I know, those are still relevant for the back office but not the front office. They were removed on purpose in 1.7 quite a long time ago.

Let me also ping @jolelievre, so he is also aware of this recommendation and share his opinion :)

</div>
{/if}
{if $contact_infos.fax}
<hr/>
<div class="contact__item">
<i class="material-icons" aria-hidden="true">&#xE0DF;</i>
<div class="contact__info">{$contact_infos.fax}</div>
<div class="ps-contactinfo__item">
<i class="material-icons" aria-hidden="true">&#xE8AD;</i>
<div class="ps-contactinfo__info">{$contact_infos.fax|escape:'htmlall':'UTF-8'}</div>
tblivet marked this conversation as resolved.
Show resolved Hide resolved
</div>
{/if}
{if $contact_infos.email && $display_email}
<hr/>
<div class="contact__item">
<div class="ps-contactinfo__item">
<i class="material-icons" aria-hidden="true">&#xE158;</i>
<div class="contact__info contact__info--email">{mailto address=$contact_infos.email encode="javascript"}</div>
<div class="ps-contactinfo__info ps-contactinfo__info--email">{mailto address=$contact_infos.email encode="javascript"}</div>
</div>
{/if}
{if !empty($contact_infos.details)}
<hr/>
<div class="contact__item">
<div class="ps-contactinfo__item">
<i class="material-icons" aria-hidden="true">&#xE88E;</i>
<div class="contact__info">{$contact_infos.details|nl2br nofilter}</div>
<div class="ps-contactinfo__info">{$contact_infos.details|nl2br nofilter}</div>
</div>
{/if}
</div>
19 changes: 9 additions & 10 deletions modules/ps_contactinfo/ps_contactinfo.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,36 @@
* file that was distributed with this source code.
*}

<div class="footer__block block-contact col-md-6 col-lg-3">

<div class="ps-contactinfo footer__block block-contact col-md-6 col-lg-3">
<p class="footer__block__title d-none d-md-flex">{l s='Store information' d='Shop.Theme.Global'}</p>

<div role="button" class="footer__block__toggle d-md-none collapsed" data-bs-target="#contact-infos" data-bs-toggle="collapse" aria-expanded="false">
<span class="footer__block__title">{l s='Store information' d='Shop.Theme.Global'}</span>
<i class="material-icons" aria-hidden="true">arrow_drop_down</i>
<i class="material-icons" aria-hidden="true">keyboard_arrow_down</i>
</div>

<div id="contact-infos" class="footer__block__content footer__block__content-contact collapse">

<div class="contact__infos">
<div class="ps-contactinfo__infos">
{$contact_infos.address.formatted nofilter}
</div>

{if $contact_infos.phone}
<div class="contact__phone">
<div class="ps-contactinfo__phone">
<i class="material-icons" aria-hidden="true">phone</i>
<a href="tel:{$contact_infos.phone}">{$contact_infos.phone}</a>
<a href="tel:{$contact_infos.phone|escape:'htmlall':'UTF-8'}">{$contact_infos.phone|escape:'htmlall':'UTF-8'}</a>
tblivet marked this conversation as resolved.
Show resolved Hide resolved
</div>
{/if}

{if $contact_infos.fax}
<div class="contact__fax">
<i class="material-icons" aria-hidden="true">fax</i>
<a href="fax:{$contact_infos.fax}">{$contact_infos.fax}</a>
<div class="ps-contactinfo__fax">
<i class="material-icons" aria-hidden="true">&#xE8AD;</i>
<a href="fax:{$contact_infos.fax|escape:'htmlall':'UTF-8'}">{$contact_infos.fax|escape:'htmlall':'UTF-8'}</a>
tblivet marked this conversation as resolved.
Show resolved Hide resolved
</div>
{/if}

{if $contact_infos.email && $display_email}
<div class="contact__email">
<div class="ps-contactinfo__email">
<i class="material-icons" aria-hidden="true">mail</i>
{mailto address=$contact_infos.email encode="javascript"}
</div>
Expand Down
6 changes: 3 additions & 3 deletions modules/ps_currencyselector/ps_currencyselector.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
* file that was distributed with this source code.
*}

<div id="_desktop_currency_selector">
<div class="currency-selector__wrapper">
<select id="currency-selector" class="form-select js-currency-selector" aria-label="{l s='Currency' d='Shop.Theme.Global'}">
<div id="_desktop_ps_currencyselector">
<div class="ps-currencyselector">
<select class="form-select js-currency-selector" aria-label="{l s='Currency' d='Shop.Theme.Global'}">
{foreach from=$currencies item=currency}
<option value="{$currency.url}"{if $currency.current} selected="selected"{/if}>{$currency.iso_code}{if $currency.sign !== $currency.iso_code} {$currency.sign}{/if}</option>
{/foreach}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<div role="button" class="footer__block__toggle d-md-none collapsed" data-bs-target="#footer_account_list" data-bs-toggle="collapse" aria-expanded="false">
<span class="footer__block__title">{l s='Your account' d='Shop.Theme.Customeraccount'}</span>
<i class="material-icons" aria-hidden="true">arrow_drop_down</i>
<i class="material-icons" aria-hidden="true">keyboard_arrow_down</i>
</div>
<ul class="footer__block__content footer__block__content-list collapse" id="footer_account_list">
{if $customer.is_logged}
Expand Down
9 changes: 5 additions & 4 deletions modules/ps_customersignin/ps_customersignin.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
* file that was distributed with this source code.
*}

<div id="_desktop_user_info">
<div class="user-info d-flex align-items-center">
<div id="_desktop_ps_customersignin">
<div class="ps-customersignin">
{if $customer.is_logged}
<div class="dropdown header-block">
<a
Expand All @@ -16,7 +16,8 @@
aria-haspopup="true"
aria-expanded="false"
aria-label="{l s='View my account (%s)' d='Shop.Theme.Customeraccount' sprintf=[$customerName]}">
<i class="material-icons header-block__icon" aria-hidden="true">&#xE7FD;</i>
<i class="material-icons header-block__icon" aria-hidden="true">account_circle</i>
<span class="header-block__title d-none d-md-block d-lg-none">{$customer.firstname|truncate:2:".":true}{$customer.lastname|truncate:2:".":true}</span>
<span class="header-block__title d-lg-inline d-none">{$customerName|truncate:22:"..":true}</span>
</a>

Expand Down Expand Up @@ -80,7 +81,7 @@
class="header-block__action-btn"
rel="nofollow"
role="button">
<i class="material-icons header-block__icon" aria-hidden="true">&#xE7FD;</i>
<i class="material-icons header-block__icon" aria-hidden="true">account_circle</i>
<span class="d-none d-md-inline header-block__title">{l s='Sign in' d='Shop.Theme.Actions'}</span>
</a>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

<div class="{$componentName}__content__right col-md-7">
<form action="{$urls.current_url}#blockEmailSubscription_{$hookName}" method="post">
<div class="{$componentName}__content__inputs inline-items">
tblivet marked this conversation as resolved.
Show resolved Hide resolved
<div class="{$componentName}__content__inputs">
<input
name="email"
type="email"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
{block name='facets_clearall_button'}
{if $activeFilters|count}
<div class="clear-all-wrapper w-100 order-2 order-md-1">
<button data-search-url="{$clear_all_link}" class="btn border rounded-pill text-gray py-1 my-2 js-search-filters-clear-all">
<button data-search-url="{$clear_all_link}" class="btn border rounded-pill py-1 my-2 js-search-filters-clear-all">
{l s='Clear all' d='Shop.Theme.Actions'}
</button>
</div>
Expand Down
9 changes: 5 additions & 4 deletions modules/ps_languageselector/ps_languageselector.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*}
<div id="_desktop_language_selector">
<div class="language-selector__wrapper">
<select id="language-selector" aria-label="{l s='Language' d='Shop.Theme.Global'}" class="form-select js-language-selector">

<div id="_desktop_ps_languageselector">
<div class="ps-languageselector">
<select class="form-select js-language-selector" aria-label="{l s='Language' d='Shop.Theme.Global'}">
{foreach from=$languages item=language}
<option value="{url entity='language' id=$language.id_lang}"{if $language.id_lang == $current_language.id_lang} selected="selected"{/if} data-iso-code="{$language.iso_code}">{$language.name_simple}</option>
<option value="{url entity='language' id=$language.id_lang}"{if $language.id_lang == $current_language.id_lang} selected="selected"{/if} data-iso-code="{$language.iso_code}">{$language.iso_code|upper}</option>
tblivet marked this conversation as resolved.
Show resolved Hide resolved
{/foreach}
</select>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<div role="button" class="footer__block__toggle d-md-none collapsed" data-target="#footer_eu_about_us_list" data-bs-toggle="collapse">
<span class="footer__block__title">{l s='Information' d='Modules.Legalcompliance.Shop'}</span>
<i class="material-icons" aria-hidden="true">arrow_drop_down</i>
<i class="material-icons" aria-hidden="true">keyboard_arrow_down</i>
</div>
<ul class="footer__block__content footer__block__content-list collapse" id="footer_eu_about_us_list">
{foreach from=$cms_links item=cms_link}
Expand Down
2 changes: 1 addition & 1 deletion modules/ps_linklist/views/templates/hook/linkblock.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<div role="button" class="footer__block__toggle d-md-none collapsed" aria-expanded="false" data-bs-target="#footer_sub_menu_{$linkBlock.id}" data-bs-toggle="collapse">
<span class="footer__block__title">{$linkBlock.title}</span>
<i class="material-icons" aria-hidden="true">arrow_drop_down</i>
<i class="material-icons" aria-hidden="true">keyboard_arrow_down</i>
</div>

<ul id="footer_sub_menu_{$linkBlock.id}" class="footer__block__content footer__block__content-list collapse">
Expand Down
Loading
Loading