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

Bump eslint from 3.19.0 to 6.8.0 #17

Open
wants to merge 9 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
11 changes: 11 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
root = true

[*]
end_of_line = lf
trim_trailing_whitespace = true
insert_final_newline = true
charset = utf-8

[**.{js,json}]
indent_style = tab
indent_size = 2
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
#Catberry Debugger
# Catberry Debugger

![Catberry](https://raw.githubusercontent.com/catberry/catberry/master/docs/images/logo.png)

##What is it?
## What is it?
Catberry Debugger extends Chrome Developer Tools,
* adding a sidebar that displays information about [Catberry](https://github.com/catberry/catberry/)-component associated with the selected DOM element;
* adding a panel that displays components, routes, stores data, state and statistics.

##Download
## Download
Packaged version `./bin/catberry-debugger.crx`

##Example
## Example

Sidebar pane

Expand All @@ -32,7 +32,7 @@ Panel with routes

![Catberry Debugger Panel with routes](https://raw.githubusercontent.com/catberry/catberry-debugger/master/example/screenshots/panel-routes.png)

##Pack from source code
## Pack from source code
```
make package
```
Binary file modified bin/catberry-debugger.crx
Binary file not shown.
Binary file modified example/screenshots/panel-routes.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified example/screenshots/panel-state.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified example/screenshots/panel-stores.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified example/screenshots/panel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified example/screenshots/sidebar-pane.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "catberry-debugger",
"version": "0.6.1",
"version": "1.0.0",
"author": {
"name": "Julia Rechkunova",
"email": "[email protected]"
Expand All @@ -19,7 +19,7 @@
"url": "git://github.com/catberry/catberry-debugger.git"
},
"devDependencies": {
"eslint": "^3.18.0"
"eslint": "^6.8.0"
},
"engines": {
"node": "^6.10"
Expand Down
2 changes: 1 addition & 1 deletion src/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "__MSG_extName__",
"version": "0.6.1",
"version": "1.0.0",
"description": "__MSG_extDescription__",
"devtools_page": "sidebar/index.html",
"icons": {
Expand Down
14 changes: 7 additions & 7 deletions src/panel/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@
<body class="document">
<header class="header">
<div class="header__item">
<a class="logo" href="http://catberry.org" title="Catberry" target="_blank"></a>
<a class="logo" href="https://catberry.github.io/" title="Catberry" target="_blank"></a>
</div>
<div class="header__item">
<a class="header__link" href="http://catberry.org" target="_blank">Catberry</a>
<a class="header__link" href="https://catberry.github.io/" target="_blank">Catberry</a>
</div>
<div class="header__item">
<a class="header__link" href="http://catberry.org/documentation" target="_blank">Docs</a>
<a class="header__link" href="https://github.com/catberry/catberry/blob/master/docs/index.md" target="_blank">Docs</a>
</div>
<div class="header__item header__item--right">
<span id="js-catberry-version"></span>
</div>
</header>
<nav class="navigation">
<div class="navigation__item">
<a class="logo" href="http://catberry.org" title="Catberry" target="_blank"></a>
<a class="logo" href="https://catberry.github.io/" title="Catberry" target="_blank"></a>
</div>
<a class="navigation__item js-nav" href="#" id="js-nav-components">
<i class="fa fa-cubes icon"></i>
Expand Down Expand Up @@ -93,21 +93,21 @@
<thead>
<tr>
<th>Route</th>
<th>Has map function</th>
<th>Map function</th>
</tr>
</thead>
<tbody id="js-table-routes">

</tbody>
</table>
</section>
<section class="tab js-tab" id="js-tab-ids">
<section class="tab js-tab" id="js-tab-ids">
<table>
<thead>
<tr>
<th>Component</th>
<th>Component id</th>
<th>Recommended id</th>
<th>Recommended id</th>
<th>Action</th>
</tr>
</thead>
Expand Down
9 changes: 8 additions & 1 deletion src/panel/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
}

table {
width: 80%;
width: 95%;
margin: 0 auto;
background: #fff;
border: 1px solid #d0d0d0;
Expand Down Expand Up @@ -126,7 +126,9 @@ table td {
line-height: 1.5;
border-top: 1px solid #d4d4d5;
border-left: 1px solid #d4d4d5;
word-break: break-all;
}

table td:first-child,
table th:first-child {
border-left: none;
Expand All @@ -135,3 +137,8 @@ table th:first-child {
table tr:first-child td {
border-top: none;
}
.component-item {
margin-bottom: .7em;
display: flex;
justify-content: space-between;
}
46 changes: 20 additions & 26 deletions src/sidebar/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ function getDebuggerInstance(selectedDomElement, domDocument) {
* @type {Object|null}
* @private
*/

this._locator = ('catberry' in window) ? window.catberry.locator : null;
}

Expand Down Expand Up @@ -103,7 +102,7 @@ function getDebuggerInstance(selectedDomElement, domDocument) {
* @returns {Object}
*/
getAttributes(element) {
const attributes = {};
const attributes = Object.create(null);
let attribute;
for (let i = 0; i < element.attributes.length; i++) {
attribute = element.attributes[i];
Expand All @@ -125,8 +124,7 @@ function getDebuggerInstance(selectedDomElement, domDocument) {
const data = {
component: this._element.tagName.toLowerCase(),
attributes: this._element.attributes.length ? this.getAttributes(this._element) : null,
store: this._element.getAttribute('cat-store') ?
{
store: this._element.getAttribute('cat-store') ? {
name: this._element.getAttribute('cat-store'),
state: null,
data: null
Expand All @@ -153,30 +151,31 @@ function getDebuggerInstance(selectedDomElement, domDocument) {
return [];
}

const allComponents = this._locator.resolveAll('component')
.map(component => `cat-${component.name}`);
let allComponents;
try {
allComponents = this._locator.resolveAll('component')
.map(component => `cat-${component.name}`);
} catch (e) {
allComponents = [];
}

let activeComponents = [];
const self = this;
const activeComponents = [];

allComponents.forEach(component => {
const elements = domDocument.getElementsByTagName(component);
const components = [];

for (let i = 0; i < elements.length; i++) {
components.push({
id: self.getElementInnerId(elements[i]),
activeComponents.push({
id: this.getElementInnerId(elements[i]),
element: elements[i],
store: elements[i].getAttribute('cat-store'),
name: component,
attributes: elements[i].attributes.length ? self.getAttributes(elements[i]) : null
attributes: elements[i].attributes.length ? this.getAttributes(elements[i]) : null
});
}
activeComponents = activeComponents.concat(components);
});

activeComponents = activeComponents.sort((first, second) => (first.name > second.name) ? 1 : -1);

return activeComponents;
return activeComponents.sort((first, second) => (first.name > second.name) ? 1 : -1);
}

/**
Expand All @@ -188,16 +187,16 @@ function getDebuggerInstance(selectedDomElement, domDocument) {
return [];
}

let activeStores = [];
const activeStoresMap = {};
const activeStores = [];
const activeStoresMap = Object.create(null);
const activeComponents = this.getActiveComponents();

activeComponents.forEach(component => {
if (!component.store) {
return;
}

if (activeStoresMap.hasOwnProperty(component.store)) {
if (component.store in activeStoresMap) {
activeStoresMap[component.store].push(component);
return;
}
Expand All @@ -212,9 +211,7 @@ function getDebuggerInstance(selectedDomElement, domDocument) {
});
});

activeStores = activeStores.sort((first, second) => (first.name > second.name) ? 1 : -1);

return activeStores;
return activeStores.sort((first, second) => (first.name > second.name) ? 1 : -1);
}

/**
Expand Down Expand Up @@ -273,10 +270,7 @@ function getDebuggerInstance(selectedDomElement, domDocument) {
* @returns {string}
*/
getVersion() {
if (!this._catberry) {
return '';
}
return this._catberry.version || '';
return !this._catberry ? '' : (this._catberry.version || '');
}
}

Expand Down
Loading