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

Added JS files formatting with Prettier #2573

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
**/webpack.config.js
vendor
30 changes: 1 addition & 29 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,31 +1,3 @@
{
"plugins": ["prettier"],
"extends": ["prettier", "eslint:recommended"],
"env": {
"browser": true,
"commonjs": true,
"es6": true,
"node": true
},
"parser": "babel-eslint",
"parserOptions": {
"ecmaFeatures": {
"jsx": true,
"classes": true,
"experimentalObjectRestSpread": true
},
"sourceType": "module"
},
"rules": {
"no-const-assign": "warn",
"no-console": "off",
"no-this-before-super": "warn",
"no-undef": "warn",
"no-unreachable": "warn",
"no-unused-vars": "warn",
"constructor-super": "warn",
"valid-typeof": "warn",
"no-extra-semi": "error",
"no-extra-boolean-cast": "off"
}
"extends": "eslint-config-ibexa/eslint"
}
5 changes: 5 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ jobs:
- name: Run PHP CS Fixer
run: tools/php-cs-fixer/vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.php -v --show-progress=dots

- name: Run Prettier
run: |
yarn install
yarn prettier-test --write

- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ __pycache__/*
.php-cs-fixer.cache
composer.lock
tools/php-cs-fixer/vendor
node_modules/
.yarn
yarn.lock
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
**/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ ibexa.addConfig(
icon: ibexa.helpers.icon.getIconPath('radio-button'), // Path to an icon that will be displayed in the UI
identifier: IDENTIFIER, // The identifier must match the one from the configuration yaml file
},
true
true,
);
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,5 @@ ibexa.addConfig(
icon: ibexa.helpers.icon.getIconPath('radio-button'),
identifier: IDENTIFIER,
},
true
true,
);

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
const InsertDate = {
exec: function (editor) {
const now = new Date();
editor.insertHtml( now.toString() );
editor.insertHtml(now.toString());
},
};

global.CKEDITOR.plugins.add('date', {
init: (editor) => editor.addCommand('InsertDate', InsertDate),
});
Expand Down
3 changes: 1 addition & 2 deletions code_samples/back_office/search/append_to_webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@

const ibexaConfigManager = require('./ibexa.webpack.config.manager.js');

ibexaConfigManager.add({
ibexaConfig,
entryName: 'ibexa-admin-ui-layout-js',
newItems: [ path.resolve(__dirname, './assets/js/admin.search.autocomplete.product.js'), ],
newItems: [path.resolve(__dirname, './assets/js/admin.search.autocomplete.product.js')],
});
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
(function (global, doc, ibexa, Routing) {
const renderItem = (result, searchText) => {
const globalSearch = doc.querySelector('.ibexa-global-search');
const {highlightText} = ibexa.helpers.highlight;
const autocompleteHighlightTemplate = globalSearch.querySelector('.ibexa-global-search__autocomplete-list').dataset.templateHighlight;
const {getContentTypeIconUrl, getContentTypeName} = ibexa.helpers.contentType;
const { highlightText } = ibexa.helpers.highlight;
const autocompleteHighlightTemplate = globalSearch.querySelector('.ibexa-global-search__autocomplete-list').dataset
.templateHighlight;
const { getContentTypeIconUrl, getContentTypeName } = ibexa.helpers.contentType;

const autocompleteItemTemplate = globalSearch.querySelector('.ibexa-global-search__autocomplete-product-template').dataset.templateItem;
const autocompleteItemTemplate = globalSearch.querySelector('.ibexa-global-search__autocomplete-product-template').dataset
.templateItem;

return autocompleteItemTemplate
.replace('{{ productHref }}', Routing.generate('ibexa.product_catalog.product.view', {productCode: result.productCode}))
.replace('{{ productHref }}', Routing.generate('ibexa.product_catalog.product.view', { productCode: result.productCode }))
.replace('{{ productName }}', highlightText(searchText, result.name, autocompleteHighlightTemplate))
.replace('{{ productCode }}', result.productCode)
.replace('{{ productTypeIconHref }}', getContentTypeIconUrl(result.productTypeIdentifier))
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ ibexa.addConfig(
icon: '/bundles/ibexaadminui/img/ibexa-icons.svg#image',
},
],
true
true,
);

export default ImageTabModule;
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,15 @@
const richtext = new ibexa.BaseRichText();

// Enable editor in all ibexa-data-source divs
doc.querySelectorAll('.ibexa-data-source').forEach(
(ibexaDataSource) => {
const richtextContainer = ibexaDataSource.querySelector(
'.ibexa-data-source__richtext'
);
doc.querySelectorAll('.ibexa-data-source').forEach((ibexaDataSource) => {
const richtextContainer = ibexaDataSource.querySelector('.ibexa-data-source__richtext');

if (richtextContainer.classList.contains('ck')) {
return;
}

richtext.init(richtextContainer);
if (richtextContainer.classList.contains('ck')) {
return;
}
);

richtext.init(richtextContainer);
});
});

const openUdw = (config) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Calculator from "/assets/page-builder/components/Calculator";
import Calculator from '/assets/page-builder/components/Calculator';

export default {
Calculator: Calculator,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ To allow template override and ease HTML writing, the example is also loading a

Here is a complete `assets/js/admin.search.autocomplete.product.js` from the product suggestion example:

``` js hl_lines="8"
``` js hl_lines="9"
[[= include_file('code_samples/back_office/search/assets/js/admin.search.autocomplete.product.js') =]]
```

Expand Down
12 changes: 10 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,17 @@
"main": "index.js",
"repository": "[email protected]:ibexa/documentation-developer.git",
"scripts": {
"scss": "node-sass --watch scss -o docs/css"
"scss": "sass --watch scss:docs/css",
"test": "yarn prettier-test && yarn eslint-test",
"fix": "yarn prettier-test --write && yarn eslint-test --fix",
"eslint-test": "eslint \"./code_samples/**/*.js\"",
"prettier-test": "yarn prettier \"./code_samples/**/*.{js,scss}\" --check"
},
"prettier": "eslint-config-ibexa/prettier",
"devDependencies": {
"eslint-config-ibexa": "https://github.com/ibexa/eslint-config-ibexa.git#~v1.1.1"
},
"dependencies": {
"node-sass": "^9.0.0"
"sass": "^1.82.0"
}
}
Loading