Skip to content

refactor(xo): removed ignores #3761

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

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
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: [
{
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,20 +1,19 @@
import { exec } from 'node:child_process';

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

GitHub Actions / lint / Lint

This rule requires the `strictNullChecks` compiler option to be turned on to function correctly.
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('\\', '/');

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

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.'
Comment on lines +16 to 18
Copy link
Preview

Copilot AI Mar 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By omitting the error parameter in the catch block, important error details might be lost during debugging. Consider capturing the error (e.g., 'catch (e)') and logging its message for improved traceability.

Suggested change
} catch {
console.warn(
'You need to install pyftsubset. Check packages/foundations/assets/fonts/README.md for more information.'
} catch (e) {
console.warn(
`You need to install pyftsubset. Check packages/foundations/assets/fonts/README.md for more information. Error: ${e.message}`

Copilot uses AI. Check for mistakes.

);
@@ -34,8 +33,8 @@
);

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

GitHub Actions / lint / Lint

Unexpected `await` inside a loop.
if (stdout) console.log(`stdout: ${stdout}`);

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

GitHub Actions / lint / Lint

Unexpected console statement.
if (stderr) console.error(`stderr: ${stderr}`);
}
} catch (error) {
8 changes: 4 additions & 4 deletions packages/migration/src/data.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
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 { v007_v100 } from './migration/v0.0.7-v1.0.0';
import { v005_v006 } from './migration/v0.0.5-v0.0.6.ts';
import { v006_v007 } from './migration/v0.0.6-v0.0.7.ts';
import { v007_v100 } from './migration/v0.0.7-v1.0.0.ts';

export const migrationTypes: Record<string, ReplaceInFileConfig[]> = {
colorQ32024,
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';
@@ -52,6 +56,7 @@ export const migrate = (
if (cli) {
console.log(result.filter((res) => res.hasChanged));
}

return result;
}
}
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';

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;
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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