Skip to content

Commit

Permalink
add ESLint to CI
Browse files Browse the repository at this point in the history
  • Loading branch information
oallain committed Jan 6, 2024
1 parent 8381e58 commit e26df29
Show file tree
Hide file tree
Showing 9 changed files with 709 additions and 7 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/code_quality.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,17 @@ jobs:
- name: Composer - Update dependencies
run: composer update --no-progress

- name: Yarn install
uses: borales/actions-yarn@v4
with:
cmd: install
dir: dev

- name: Yarn ESLint
uses: borales/actions-yarn@v4
with:
cmd: lint
dir: dev

- name: TwigCS - Check
run: vendor/bin/twigcs templates/ --severity error --display blocking --reporter githubAction
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/vendor/
/node_modules
/composer.lock

/etc/build/*
Expand All @@ -10,8 +8,6 @@

/.phpunit.result.cache
/behat.yml
/phpspec.yml
/phpunit.xml

###> symfony/webpack-encore-bundle ###
/node_modules/
Expand Down
2 changes: 1 addition & 1 deletion assets/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ axios.defaults.headers.post['X-Requested-With'] = 'XMLHttpRequest';

document.addEventListener('DOMContentLoaded', () => {
// Lightbox
const glightbox = GLightbox({ selector: '.glightbox' });
GLightbox({ selector: '.glightbox' });

// Add to cart
document.querySelectorAll('[data-js-add-to-cart="form"]')
Expand Down
1 change: 1 addition & 0 deletions assets/js/sylius-api-toggle.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const SyliusApiToggle = (el) => {
const toggleableElement = document.querySelector('[data-js-login="form"]');

const debounce = (callback, duration) => {
// eslint-disable-next-line
let timeout = null;

return (...args) => {
Expand Down
4 changes: 2 additions & 2 deletions assets/js/sylius-variants-prices.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ const handleProductOptionsChange = function handleProductOptionsChange() {

const handleProductVariantsChange = function handleProductVariantsChange() {
document.querySelectorAll('[name="sylius_add_to_cart[cartItem][variant]"]').forEach((item) => {
item.addEventListener('change', (e) => {
item.addEventListener('change', () => {
const priceElement = item.closest('tr').querySelector('[data-js-product-variant-price]');
const price = priceElement.innerHTML;

document.querySelector('[data-js-product-price]').innerHTML = price;

if (priceElement.hasAttribute('data-original-price')) {
Expand Down
16 changes: 16 additions & 0 deletions dev/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module.exports = {
root: true,
env: {
browser: true,
es2021: true,
},
extends: [
"eslint:recommended",
],
parserOptions: {
sourceType: "module"
},
globals: {
Translator: 'readonly',
},
};
2 changes: 2 additions & 0 deletions dev/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules/
yarn-error.log
10 changes: 10 additions & 0 deletions dev/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "sylius-bootstrap-theme",
"license": "MIT",
"scripts": {
"lint": "eslint -c .eslintrc.cjs ../assets"
},
"devDependencies": {
"eslint": "^8.56.0"
}
}
Loading

0 comments on commit e26df29

Please sign in to comment.