From 9d6eacf4bea6aca6423b995366b96d925180db35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C4=9Bj=20Chalk?= Date: Tue, 17 Dec 2024 12:59:01 +0100 Subject: [PATCH] fix: lint import extensions and fix missing .js extensions --- eslint.config.js | 6 ++++++ .../src/lib/runner/runner.integration.test.ts | 2 +- packages/plugin-js-packages/src/lib/js-packages-plugin.ts | 2 +- .../src/lib/runner/runner.integration.test.ts | 2 +- packages/plugin-lighthouse/src/lib/normalize-flags.ts | 2 +- packages/plugin-lighthouse/src/lib/utils.ts | 2 +- packages/utils/src/lib/zod-validation.unit.test.ts | 2 +- 7 files changed, 12 insertions(+), 6 deletions(-) diff --git a/eslint.config.js b/eslint.config.js index 3734f3e67..a9bff8986 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -95,6 +95,12 @@ export default tseslint.config( files: ['**/*.json'], languageOptions: { parser: jsoncParser }, }, + { + files: ['**/*.ts', '**/*.js'], + rules: { + 'n/file-extension-in-import': ['error', 'always'], + }, + }, { files: ['**/perf/**/*.ts'], rules: { diff --git a/packages/plugin-coverage/src/lib/runner/runner.integration.test.ts b/packages/plugin-coverage/src/lib/runner/runner.integration.test.ts index cb1b64530..abe081b2c 100644 --- a/packages/plugin-coverage/src/lib/runner/runner.integration.test.ts +++ b/packages/plugin-coverage/src/lib/runner/runner.integration.test.ts @@ -8,13 +8,13 @@ import type { RunnerConfig, } from '@code-pushup/models'; import { readJsonFile, removeDirectoryIfExists } from '@code-pushup/utils'; -import { createRunnerConfig, executeRunner } from '.'; import type { FinalCoveragePluginConfig } from '../config.js'; import { PLUGIN_CONFIG_PATH, RUNNER_OUTPUT_PATH, WORKDIR, } from './constants.js'; +import { createRunnerConfig, executeRunner } from './index.js'; describe('createRunnerConfig', () => { it('should create a valid runner config', async () => { diff --git a/packages/plugin-js-packages/src/lib/js-packages-plugin.ts b/packages/plugin-js-packages/src/lib/js-packages-plugin.ts index 97e5b97e9..2744f2b27 100644 --- a/packages/plugin-js-packages/src/lib/js-packages-plugin.ts +++ b/packages/plugin-js-packages/src/lib/js-packages-plugin.ts @@ -10,7 +10,7 @@ import { dependencyGroups, } from './config.js'; import { dependencyDocs, dependencyGroupWeights } from './constants.js'; -import { packageManagers } from './package-managers/package-managers'; +import { packageManagers } from './package-managers/package-managers.js'; import { createRunnerConfig } from './runner/index.js'; import { normalizeConfig } from './utils.js'; diff --git a/packages/plugin-js-packages/src/lib/runner/runner.integration.test.ts b/packages/plugin-js-packages/src/lib/runner/runner.integration.test.ts index 8f323ddf2..9e648923d 100644 --- a/packages/plugin-js-packages/src/lib/runner/runner.integration.test.ts +++ b/packages/plugin-js-packages/src/lib/runner/runner.integration.test.ts @@ -1,10 +1,10 @@ import { describe, expect, it } from 'vitest'; import type { RunnerConfig } from '@code-pushup/models'; import { readJsonFile, removeDirectoryIfExists } from '@code-pushup/utils'; -import { createRunnerConfig } from '.'; import type { FinalJSPackagesPluginConfig } from '../config.js'; import { defaultAuditLevelMapping } from '../constants.js'; import { PLUGIN_CONFIG_PATH, WORKDIR } from './constants.js'; +import { createRunnerConfig } from './index.js'; describe('createRunnerConfig', () => { it('should create a valid runner config', async () => { diff --git a/packages/plugin-lighthouse/src/lib/normalize-flags.ts b/packages/plugin-lighthouse/src/lib/normalize-flags.ts index a2cc0e51c..a5d45e62f 100644 --- a/packages/plugin-lighthouse/src/lib/normalize-flags.ts +++ b/packages/plugin-lighthouse/src/lib/normalize-flags.ts @@ -2,7 +2,7 @@ import { bold, yellow } from 'ansis'; import { ui } from '@code-pushup/utils'; import { LIGHTHOUSE_PLUGIN_SLUG } from './constants.js'; import { DEFAULT_CLI_FLAGS } from './runner/constants.js'; -import type { LighthouseCliFlags } from './runner/types'; +import type { LighthouseCliFlags } from './runner/types.js'; import type { LighthouseOptions } from './types.js'; const { onlyCategories, ...originalDefaultCliFlags } = DEFAULT_CLI_FLAGS; diff --git a/packages/plugin-lighthouse/src/lib/utils.ts b/packages/plugin-lighthouse/src/lib/utils.ts index 52d6bbbf3..e889b617d 100644 --- a/packages/plugin-lighthouse/src/lib/utils.ts +++ b/packages/plugin-lighthouse/src/lib/utils.ts @@ -1,7 +1,7 @@ import type { Audit, CategoryRef, Group } from '@code-pushup/models'; import { filterItemRefsBy, toArray } from '@code-pushup/utils'; import { LIGHTHOUSE_PLUGIN_SLUG } from './constants.js'; -import type { LighthouseCliFlags } from './runner/types'; +import type { LighthouseCliFlags } from './runner/types.js'; export type LighthouseGroupSlugs = | 'performance' diff --git a/packages/utils/src/lib/zod-validation.unit.test.ts b/packages/utils/src/lib/zod-validation.unit.test.ts index 2ce8be6b5..2c9725a4d 100644 --- a/packages/utils/src/lib/zod-validation.unit.test.ts +++ b/packages/utils/src/lib/zod-validation.unit.test.ts @@ -1,4 +1,4 @@ -import { formatErrorPath } from './zod-validation'; +import { formatErrorPath } from './zod-validation.js'; describe('formatErrorPath', () => { it.each([