Skip to content

Commit

Permalink
chore: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
splincode committed Sep 3, 2024
1 parent c4760ea commit 4fdca3a
Show file tree
Hide file tree
Showing 8 changed files with 1,520 additions and 1,140 deletions.
4 changes: 2 additions & 2 deletions jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ const config: JestConfigWithTsJest = {
'jest-preset-angular',
{
tsconfig: resolve(__dirname, 'tsconfig.spec.json'),
stringifyContentPathRegex: '\\.html$',
stringifyContentPathRegex: String.raw`\.html$`,
isolatedModules: true,
diagnostics: true,
},
],
},
transformIgnorePatterns: [
'node_modules/(?!@angular|rxjs|ngx-highlightjs|@maskito|@ng-web-apis|@taiga-ui\\/event-plugins|@taiga-ui\\/polymorpheus)',
String.raw`node_modules/(?!@angular|rxjs|ngx-highlightjs|@maskito|@ng-web-apis|@taiga-ui\/event-plugins|@taiga-ui\/polymorpheus)`,
],
testMatch: ['<rootDir>/projects/**/*.spec.ts'],
testPathIgnorePatterns: ['/demo-cypress/', '/demo-playwright/', '/node_modules/'],
Expand Down
2,618 changes: 1,500 additions & 1,118 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,8 @@
"sonarjs/single-char-in-character-classes": "off",
"sonarjs/single-character-alternation": "off",
"sonarjs/sonar-max-params": "off",
"sonarjs/void-use": "off",
"unicorn/consistent-destructuring": "off",
"unicorn/no-typeof-undefined": "off",
"unicorn/prefer-string-raw": "off",
"@taiga-ui/experience/standalone-imports-sort": "off"
},
"root": true
Expand Down Expand Up @@ -143,7 +141,7 @@
"@taiga-ui/commitlint-config": "0.113.3",
"@taiga-ui/cspell-config": "0.113.3",
"@taiga-ui/design-tokens": "0.132.0",
"@taiga-ui/eslint-plugin-experience": "0.147.10",
"@taiga-ui/eslint-plugin-experience": "0.147.15",
"@taiga-ui/event-plugins": "4.0.1",
"@taiga-ui/prettier-config": "0.113.3",
"@taiga-ui/stylelint-config": "0.147.0",
Expand Down
2 changes: 1 addition & 1 deletion projects/addon-doc/components/example/example.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ export class TuiDocExample {

protected edit(files: Record<string, string>): void {
this.loading$.next(true);
void this.codeEditor
this.codeEditor
?.edit(this.componentName, this.id || '', files)
.finally(() => this.loading$.next(false));
}
Expand Down
14 changes: 7 additions & 7 deletions projects/cdk/utils/color/parse-gradient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ export type TuiGradientDirection =
// https://stackoverflow.com/a/20238168/2706426
//
// SETUP CODE
const COMMA = '\\s*,\\s*'; // Allow space around comma.
const COMMA = String.raw`\s*,\s*`; // Allow space around comma.
const HEX = '#(?:[a-f0-9]{6}|[a-f0-9]{3})'; // 3 or 6 character form
const RGB = '\\(\\s*(?:\\d{1,3}\\s*,\\s*){2}\\d{1,3}\\s*\\)'; // "(1, 2, 3)"
const RGBA = '\\(\\s*(?:\\d{1,3}\\s*,\\s*){2}\\d{1,3}\\s*,\\s*\\d*\\.?\\d+\\)'; // "(1, 2, 3, 4)"
const VALUE = '(?:[+-]?\\d*\\.?\\d+)(?:%|[a-z]+)?'; // ".9", "-5px", "100%".
const RGB = String.raw`\(\s*(?:\d{1,3}\s*,\s*){2}\d{1,3}\s*\)`; // "(1, 2, 3)"
const RGBA = String.raw`\(\s*(?:\d{1,3}\s*,\s*){2}\d{1,3}\s*,\s*\d*\.?\d+\)`; // "(1, 2, 3, 4)"
const VALUE = String.raw`(?:[+-]?\d*\.?\d+)(?:%|[a-z]+)?`; // ".9", "-5px", "100%".
const KEYWORD = '[_a-z-][_a-z0-9-]*'; // "red", "transparent", "border-collapse".
const COLOR = [
'(?:',
Expand All @@ -43,16 +43,16 @@ const COLOR = [
')',
];
const REGEXP_ARRAY = [
'\\s*(',
String.raw`\s*(`,
...COLOR,
')',
'(?:\\s+',
String.raw`(?:\s+`,
'(',
VALUE,
'))?',
'(?:',
COMMA,
'\\s*)?',
String.raw`\s*)?`,
];

function getPosition(match: string, stops: number): string {
Expand Down
4 changes: 2 additions & 2 deletions projects/cdk/utils/color/rgba-to-hex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ export function tuiRgbaToHex(color: string): string {
}

export function tuiIsValidRgba(rgba: string): boolean {
const range = '(\\d|[1-9]\\d|1\\d{2}|2[0-4]\\d|2[0-5]{2})';
const alpha = '([01]|0?\\.\\d+)';
const range = String.raw`(\d|[1-9]\d|1\d{2}|2[0-4]\d|2[0-5]{2})`;
const alpha = String.raw`([01]|0?\.\d+)`;

return new RegExp(
`^(?:rgb\\(\\s*${range}\\s*,\\s*${range}\\s*,\\s*${range}\\s*\\)|rgba\\(\\s*${range}\\s*,\\s*${range}\\s*,\\s*${range}\\s*,\\s*${alpha}\\s*\\))$`,
Expand Down
12 changes: 6 additions & 6 deletions projects/cdk/utils/miscellaneous/is-valid-url.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
export function tuiIsValidUrl(url: string): boolean {
const pattern = new RegExp(
'^([a-zA-Z]+:\\/\\/)?' + // protocol
'((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|localhost|' + // domain name
'((\\d{1,3}\\.){3}\\d{1,3}))' + // OR IP (v4) address
'(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*' + // port and path
'(\\?[;&a-z\\d%_.~+=-]*)?' + // query string
'(\\#[-a-z\\d_]*)?$', // fragment locator
String.raw`^([a-zA-Z]+:\/\/)?` + // protocol
String.raw`((([a-z\d]([a-z\d-]*[a-z\d])*)\.)+[a-z]{2,}|localhost|` + // domain name
String.raw`((\d{1,3}\.){3}\d{1,3}))` + // OR IP (v4) address
String.raw`(\:\d+)?(\/[-a-z\d%_.~+]*)*` + // port and path
String.raw`(\?[;&a-z\d%_.~+=-]*)?` + // query string
String.raw`(\#[-a-z\d_]*)?$`, // fragment locator
'i',
);

Expand Down
2 changes: 1 addition & 1 deletion projects/demo/src/modules/app/home/home.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export class Home {
'../../../../../styles/taiga-ui-global.less?raw'
).then(({default: content}) => ({
default: content
.replaceAll("@import '", `@import '@taiga-ui/styles/`)
.replaceAll("@import '", "@import '@taiga-ui/styles/")
.replace('@taiga-ui/styles/@taiga-ui/core', '@taiga-ui/core'),
}));
}

0 comments on commit 4fdca3a

Please sign in to comment.