Skip to content

Commit

Permalink
add max len
Browse files Browse the repository at this point in the history
  • Loading branch information
Artem Manushenkov committed Feb 21, 2025
1 parent 42a85fd commit 5f83305
Show file tree
Hide file tree
Showing 14 changed files with 68 additions and 33 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,12 @@ module.exports = {
'strict': 'off',
'max-len': ['error', {
'code': 120,
'comments': 120,
'comments': 130,
'tabWidth': 4,
'ignoreUrls': true,
'ignoreTrailingComments': false,
'ignoreComments': false,
'ignoreTemplateLiterals': true,
}],
'indent': [
'error',
Expand Down
1 change: 0 additions & 1 deletion Extension/src/pages/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ module.exports = {
],

'import/prefer-default-export': 'off',
'max-len': 'off',
'no-use-before-define': 'off',
'indent': 'off',
'arrow-body-style': 'off',
Expand Down
2 changes: 1 addition & 1 deletion Extension/src/pages/common/components/ui/Icons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
*/

/* eslint-disable max-len */
import React from 'react';

import '../../styles/icons.pcss';
Expand Down
10 changes: 8 additions & 2 deletions Extension/src/pages/devtools-elements-sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,9 @@ export const devtoolsElementsSidebar = (() => {
};

const updatePanelElements = function () {
const checkboxes = document.querySelectorAll('#one-domain-checkbox, #create-full-css-path, .attribute-check-box');
const checkboxes = document.querySelectorAll(
'#one-domain-checkbox, #create-full-css-path, .attribute-check-box',
);

// All checkboxes should be disabled if block by url is checked
if (document.querySelector('#block-by-url-checkbox').checked) {
Expand Down Expand Up @@ -220,7 +222,11 @@ export const devtoolsElementsSidebar = (() => {
}
}
} else {
placeholder.appendChild(createAttributeElement(attribute.name, attribute.value, attribute.name === 'id'));
placeholder.appendChild(createAttributeElement(
attribute.name,
attribute.value,
attribute.name === 'id',
));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,11 +286,17 @@ const RequestInfo = observer(() => {

const appliedRulesData = __IS_MV3__
? {
title: translator.getPlural('filtering_modal_applied_rules', selectedEvent.declarativeRuleInfo?.sourceRules.length || 0),
title: translator.getPlural(
'filtering_modal_applied_rules',
selectedEvent.declarativeRuleInfo?.sourceRules.length || 0,
),
data: selectedEvent.declarativeRuleInfo?.sourceRules.map((r) => r.sourceRule),
}
: {
title: translator.getPlural('filtering_modal_applied_rules', Math.max(rulesData.appliedRuleTexts.length, 1)),
title: translator.getPlural(
'filtering_modal_applied_rules',
Math.max(rulesData.appliedRuleTexts.length, 1),
),
data: rulesData.appliedRuleTexts.length > 0
? rulesData.appliedRuleTexts.join('\n')
: null,
Expand Down Expand Up @@ -351,7 +357,10 @@ const RequestInfo = observer(() => {
// Original rule texts contains elements only if the rule was converted
if (rulesData.originalRuleTexts.length > 0) {
eventPartsMap[PARTS.ORIGINAL_RULE] = {
title: translator.getPlural('filtering_modal_original_rules', Math.max(rulesData.originalRuleTexts.length, 1)),
title: translator.getPlural(
'filtering_modal_original_rules',
Math.max(rulesData.originalRuleTexts.length, 1),
),
data: rulesData.originalRuleTexts.join('\n'),
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,10 @@ export const Status = (props) => {
<div className={itemClassNames}>
<Popover text={statusTooltipText}>
<div className="status__icon--wrapper">
<Icon id={statusCode ? '#transfer-status' : '#arrow-status'} classname="status__icon" />
<Icon
id={statusCode ? '#transfer-status' : '#arrow-status'}
classname="status__icon"
/>
</div>
</Popover>
</div>
Expand Down
2 changes: 1 addition & 1 deletion Extension/src/pages/filtering-log/components/ui/Icons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
*/

/* eslint-disable max-len */
import React from 'react';

export const Icons = () => {
Expand Down
3 changes: 2 additions & 1 deletion Extension/src/pages/filtering-log/stores/LogStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,8 @@ class LogStore {
// blocked CSP reports should be filtered as blocked requests in the filtering log. AG-24613
const filteringEventType = getStatusMode(filteringEvent);

const isAllowlisted = filteringEventType === StatusMode.ALLOWED || filteringEventType === StatusMode.ALLOWED_STEALTH;
const isAllowlisted = filteringEventType === StatusMode.ALLOWED
|| filteringEventType === StatusMode.ALLOWED_STEALTH;
const isBlocked = filteringEventType === StatusMode.BLOCKED;
const isModified = filteringEventType === StatusMode.MODIFIED;
const isRegular = !isAllowlisted && !isBlocked && !isModified;
Expand Down
4 changes: 3 additions & 1 deletion Extension/src/pages/options/components/Filters/Filters.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ const Filters = observer(() => {
const query = useMemo(() => new URLSearchParams(location.search), [location.search]);

const [modalIsOpen, setModalIsOpen] = useState(false);
const [urlToSubscribe, setUrlToSubscribe] = useState(decodeURIComponent(query.get(QUERY_PARAM_NAMES.SUBSCRIBE) || ''));
const [urlToSubscribe, setUrlToSubscribe] = useState(decodeURIComponent(
query.get(QUERY_PARAM_NAMES.SUBSCRIBE) || '',
));
const [customFilterTitle, setCustomFilterTitle] = useState(query.get(QUERY_PARAM_NAMES.TITLE));

// This state used to remove blinking while filters to render were not selected
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,15 +223,15 @@ export const Miscellaneous = observer(() => {

{
isOpenResetStatsModal
&& (
<ConfirmModal
title={translator.getMessage('options_clear_stats_confirm_modal_title')}
isOpen={isOpenResetStatsModal}
setIsOpen={setIsOpenResetStatsModal}
onConfirm={handleResetStatisticsConfirm}
customConfirmTitle={translator.getMessage('options_clear_stats_confirm_modal_clear_button')}
/>
)
&& (
<ConfirmModal
title={translator.getMessage('options_clear_stats_confirm_modal_title')}
isOpen={isOpenResetStatsModal}
setIsOpen={setIsOpenResetStatsModal}
onConfirm={handleResetStatisticsConfirm}
customConfirmTitle={translator.getMessage('options_clear_stats_confirm_modal_clear_button')}
/>
)
}

<button
Expand All @@ -244,15 +244,17 @@ export const Miscellaneous = observer(() => {

{
isOpenResetSettingsModal
&& (
<ConfirmModal
title={translator.getMessage('options_reset_settings_confirm_modal_title')}
isOpen={isOpenResetSettingsModal}
setIsOpen={setIsOpenResetSettingsModal}
onConfirm={handleResetSettingsConfirmWrapper}
customConfirmTitle={translator.getMessage('options_reset_settings_confirm_modal_clear_button')}
/>
)
&& (
<ConfirmModal
title={translator.getMessage('options_reset_settings_confirm_modal_title')}
isOpen={isOpenResetSettingsModal}
setIsOpen={setIsOpenResetSettingsModal}
onConfirm={handleResetSettingsConfirmWrapper}
customConfirmTitle={
translator.getMessage('options_reset_settings_confirm_modal_clear_button')
}
/>
)
}
<button
type="button"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ const SettingsSet = (props) => {
<div className="setting__title">{title}</div>
{description && <div className="setting__desc">{description}</div>}
</div>
{inlineControl && <div className="setting__container setting__container--inline setting__inline-control">{inlineControl}</div>}
{inlineControl && (
<div className="setting__container setting__container--inline setting__inline-control">
{inlineControl}
</div>
)}
</div>
{children}
</div>
Expand Down
1 change: 1 addition & 0 deletions Extension/src/pages/options/components/ui/Icons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
*/
/* eslint-disable max-len */

import React from 'react';

Expand Down
2 changes: 2 additions & 0 deletions Extension/src/pages/popup/components/ui/Icons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
* along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
*/

/* eslint-disable max-len */

import React from 'react';

import './icons.pcss';
Expand Down
9 changes: 7 additions & 2 deletions Extension/src/pages/services/messenger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,10 @@ class Messenger {

port.onMessage.addListener((message) => {
if (!messageHasTypeField(message)) {
logger.error('Received message in Messenger.createLongLivedConnection has no type field: ', message);
logger.error(
'Received message in Messenger.createLongLivedConnection has no type field: ',
message,
);
return;
}

Expand Down Expand Up @@ -940,7 +943,9 @@ class Messenger {
*
* @returns Promise that resolves after the message is sent.
*/
async addUrlToTrusted(url: AddUrlToTrustedMessage['data']['url']): Promise<ExtractMessageResponse<MessageType.AddUrlToTrusted>> {
async addUrlToTrusted(
url: AddUrlToTrustedMessage['data']['url'],
): Promise<ExtractMessageResponse<MessageType.AddUrlToTrusted>> {
return this.sendMessage(MessageType.AddUrlToTrusted, { url });
}

Expand Down

0 comments on commit 5f83305

Please sign in to comment.