Skip to content

Commit

Permalink
[dev] fix linting
Browse files Browse the repository at this point in the history
  • Loading branch information
electrovir committed Dec 10, 2024
1 parent 925a5d1 commit 9bf43cc
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 12 deletions.
2 changes: 2 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ export default [
* Turn off or on specific rules. See {@link defineEslintConfig} for which plugins are
* already enabled.
*/
'sonarjs/no-unused-vars': 'off',
'sonarjs/prefer-regexp-exec': 'off',
},
},
];
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ export type AsyncProp<Value, Params> = Omit<
*
* @category Internal
*/
// eslint-disable-next-line sonarjs/no-redeclare
export const AsyncProp: Constructor<
AsyncProp<unknown, unknown>,
ConstructorParameters<typeof InternalAsyncPropClass<unknown, unknown>>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ export function createElementPropertyProxy<PropertyInitGeneric extends PropertyI
const elementAsProps = element as DeclarativeElement & PropertyInitGeneric;

function verifyProperty(propertyKey: PropertyKey) {
// eslint-disable-next-line sonarjs/no-selector-parameter
if (shouldAlreadyExist) {
assertValidPropertyName(propertyKey, element, element.tagName);
} else {
Expand Down
1 change: 0 additions & 1 deletion packages/vira/src/elements/dropdown/dropdown-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ export function createNewSelection(
currentSelection: ReadonlyArray<PropertyKey>,
isMultiSelect: boolean,
): PropertyKey[] {
// eslint-disable-next-line sonarjs/no-selector-parameter
if (isMultiSelect) {
return currentSelection.includes(id)
? currentSelection.filter((entry) => entry !== id)
Expand Down
4 changes: 2 additions & 2 deletions packages/vira/src/elements/vira-input.element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ export const ViraInput = defineViraElement<
'vira-input-clear-button-hover-color': '#ff0000',
'vira-input-clear-button-active-color': '#b30000',

// eslint-disable-next-line sonarjs/no-hardcoded-credentials
// eslint-disable-next-line sonarjs/no-hardcoded-passwords
'vira-input-show-password-button-hover-color': '#0a89ff',
// eslint-disable-next-line sonarjs/no-hardcoded-credentials
// eslint-disable-next-line sonarjs/no-hardcoded-passwords
'vira-input-show-password-button-active-color': '#0261ba',

'vira-input-padding-horizontal': '10px',
Expand Down
1 change: 0 additions & 1 deletion packages/vira/src/re-exports/colorjs-io.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,4 @@ export type Color = typeof ColorImport;
*
* @category Internal
*/
// eslint-disable-next-line sonarjs/no-redeclare
export const Color: Color = ColorImport;
8 changes: 2 additions & 6 deletions packages/vira/src/styles/color.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {wrapInTry} from '@augment-vir/common';
import {stringify} from '@augment-vir/common';
import {Format} from 'colorjs.io/types/src/space';
import {Color, ColorTypes} from '../re-exports/colorjs-io.js';

Expand All @@ -14,11 +14,7 @@ export function getAssertedValidColor(input: ColorTypes | undefined) {
}
return new Color(input);
} catch {
const stringInput = String(input);
const inputForMessage: string = stringInput.toLowerCase().match(/\[\s*object\s+object\s*\]/)
? wrapInTry(() => JSON.stringify(input), {fallbackValue: stringInput})
: stringInput;
throw new Error(`Invalid color: ${inputForMessage}`);
throw new Error(`Invalid color: ${stringify(input)}`);
}
}

Expand Down

0 comments on commit 9bf43cc

Please sign in to comment.