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

refactor(xo): removed ignores #3761

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
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
4 changes: 1 addition & 3 deletions .xo-config.cjs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
module.exports = {
prettier: true,
ignores: [
'./showcases/nuxt-showcase/**',
'./packages/migration/**',
'./packages/foundations/**'
'./showcases/nuxt-showcase/**'
],
overrides: [
{
Expand Down
7 changes: 3 additions & 4 deletions packages/foundations/assets/fonts/generate-eu-fonts.ts
Original file line number Diff line number Diff line change
@@ -1,40 +1,39 @@
import { exec } from 'node:child_process';
import { promisify } from 'node:util';
import { dirname } from 'node:path';
import { fileURLToPath } from 'node:url';
import { glob } from 'glob';

import { dirname } from 'path';
import { fileURLToPath } from 'url';

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename).replaceAll('\\', '/');

Check failure on line 8 in packages/foundations/assets/fonts/generate-eu-fonts.ts

View workflow job for this annotation

GitHub Actions / lint / Lint

Unsafe assignment of an error typed value.

Check failure on line 8 in packages/foundations/assets/fonts/generate-eu-fonts.ts

View workflow job for this annotation

GitHub Actions / lint / Lint

Unsafe call of an `error` type typed value.

const execAsync = promisify(exec);

const generateFonts = async () => {
console.log('Generating EU fonts...');

Check failure on line 13 in packages/foundations/assets/fonts/generate-eu-fonts.ts

View workflow job for this annotation

GitHub Actions / lint / Lint

Unexpected console statement.
try {
await execAsync('pyftsubset --help');
} catch (e) {
} catch {
console.warn(
'You need to install pyftsubset. Check packages/foundations/assets/fonts/README.md for more information.'
);
}

try {
const files = await glob(`${__dirname}/*.ttf`);

Check failure on line 23 in packages/foundations/assets/fonts/generate-eu-fonts.ts

View workflow job for this annotation

GitHub Actions / lint / Lint

Unsafe assignment of an error typed value.

Check failure on line 23 in packages/foundations/assets/fonts/generate-eu-fonts.ts

View workflow job for this annotation

GitHub Actions / lint / Lint

Unsafe call of an `error` type typed value.
const commands = files.map((file) =>

Check failure on line 24 in packages/foundations/assets/fonts/generate-eu-fonts.ts

View workflow job for this annotation

GitHub Actions / lint / Lint

Unsafe assignment of an error typed value.

Check failure on line 24 in packages/foundations/assets/fonts/generate-eu-fonts.ts

View workflow job for this annotation

GitHub Actions / lint / Lint

Unsafe call of an `error` type typed value.
[
'pyftsubset',
file,
'--layout-features=*',
'--flavor=woff2',
`--unicodes-file=${__dirname}/unicode-eu.txt`,
`--output-file=${file.replace('.ttf', '-EU.woff2')}`

Check failure on line 31 in packages/foundations/assets/fonts/generate-eu-fonts.ts

View workflow job for this annotation

GitHub Actions / lint / Lint

Unsafe call of an `any` typed value.
].join(' ')
);

for (const command of commands) {
const { stdout, stderr } = await execAsync(command);

Check failure on line 36 in packages/foundations/assets/fonts/generate-eu-fonts.ts

View workflow job for this annotation

GitHub Actions / lint / Lint

Unexpected `await` inside a loop.

Check failure on line 36 in packages/foundations/assets/fonts/generate-eu-fonts.ts

View workflow job for this annotation

GitHub Actions / lint / Lint

Unsafe argument of type `any` assigned to a parameter of type `string`.
if (stdout) console.log(`stdout: ${stdout}`);
if (stderr) console.error(`stderr: ${stderr}`);
}
Expand Down
6 changes: 3 additions & 3 deletions packages/migration/src/data.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { ReplaceInFileConfig } from 'replace-in-file';
import type { ProgrammOptionsType } from './types';
import { colorQ32024 } from './migration/color-q32024';
import type { ReplaceInFileConfig } from 'replace-in-file';
import { iconQ32024 } from './migration/icon-q32024';
import { v005_v006 } from './migration/v0.0.5-v0.0.6';
import { v006_v007 } from './migration/v0.0.6-v0.0.7';
import { v005_v006 } from './migration/v0.0.5-v0.0.6.ts';
import { v006_v007 } from './migration/v0.0.6-v0.0.7.ts';

export const migrationTypes: Record<string, ReplaceInFileConfig[]> = {
colorQ32024,
Expand Down
9 changes: 7 additions & 2 deletions packages/migration/src/migration/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#!/usr/bin/env node
import { globSync } from 'glob';
import type { ReplaceInFileConfig, ReplaceResult } from 'replace-in-file';
import { replaceInFileSync } from 'replace-in-file';
import {
type ReplaceInFileConfig,
type ReplaceResult,
replaceInFileSync
} from 'replace-in-file';
import type { OptionsType } from '../types';
import { migrationTypes } from '../data';
import { AdditionalInformation } from './additional-information';
Expand Down Expand Up @@ -50,6 +54,7 @@ export const migrate = (
if (cli) {
console.log(result);
}

return result;
}
}
Expand Down
1 change: 1 addition & 0 deletions packages/migration/src/program.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env node
import { program } from 'commander';
import type { OptionsType, ProgrammOptionsType } from './types';

Expand Down
7 changes: 5 additions & 2 deletions packages/migration/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { v005_v006 } from './migration/v0.0.5-v0.0.6';
#!/usr/bin/env node
import { v005_v006 } from './migration/v0.0.5-v0.0.6.ts';

export type ProgrammOptionsType = {
name: string;
Expand All @@ -12,6 +13,8 @@ export type ProgrammOptionsType = {

export type OptionsType = {
src: string;
type: (string | 'colorQ32024' | 'iconQ32024' | 'v005_v006' | 'v006_v007')[];
type: Array<
string | 'colorQ32024' | 'iconQ32024' | 'v005_v006' | 'v006_v007'
>;
dryRun?: string | boolean;
};
4 changes: 1 addition & 3 deletions packages/migration/test/color-q32024/color-q32024.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ describe('color-q32024', () => {

expect(result).not.undefined;

expect(
(result as ReplaceResult[]).filter((res) => res.hasChanged)
).toHaveLength(1);
expect(result!.filter((res) => res.hasChanged)).toHaveLength(1);
});
});
4 changes: 1 addition & 3 deletions packages/migration/test/icon-q32024/icon-q32024.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ describe('icon-q32024', () => {

expect(result).not.undefined;

expect(
(result as ReplaceResult[]).filter((res) => res.hasChanged)
).toHaveLength(1);
expect(result!.filter((res) => res.hasChanged)).toHaveLength(1);
});
});
4 changes: 1 addition & 3 deletions packages/migration/test/v0.0.5-v0.0.6/v005_v006.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ describe('v005_v006', () => {

expect(result).not.undefined;

expect(
(result as ReplaceResult[]).filter((res) => res.hasChanged)
).toHaveLength(1);
expect(result!.filter((res) => res.hasChanged)).toHaveLength(1);
});
});
4 changes: 1 addition & 3 deletions packages/migration/test/v0.0.6-v0.0.7/v006_v007.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ describe('v006_v007', () => {

expect(result).not.undefined;

expect(
(result as ReplaceResult[]).filter((res) => res.hasChanged)
).toHaveLength(1);
expect(result!.filter((res) => res.hasChanged)).toHaveLength(1);
});
});
Loading