refactor: Rename @n8n/utils files to kebab-case and enforce with ESLint (PR 1a) (#33028)

This commit is contained in:
Tomi Turtiainen 2026-06-26 11:45:02 +03:00 committed by GitHub
parent 6b916974c1
commit b43ed0880d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
32 changed files with 34 additions and 33 deletions

View File

@ -6,5 +6,6 @@ export default defineConfig(nodeConfig, {
// TODO: Remove this
'no-prototype-builtins': 'warn',
'@typescript-eslint/require-await': 'warn',
'unicorn/filename-case': ['error', { case: 'kebabCase' }],
},
});

View File

@ -1,4 +1,4 @@
import { createEventQueue } from './event-queue';
import { createEventQueue } from './create-event-queue';
describe('createEventQueue', () => {
beforeEach(() => {

View File

@ -1,6 +1,6 @@
import { describe, it, expect } from 'vitest';
import { isWindowsFilePath } from './path';
import { isWindowsFilePath } from './is-windows-file-path';
describe('isWindowsFilePath', () => {
describe('valid Windows paths', () => {

View File

@ -1,6 +1,6 @@
import { describe, it, expect } from 'vitest';
import { sanitizeFilename } from './sanitize';
import { sanitizeFilename } from './sanitize-filename';
describe('sanitizeFilename', () => {
it('should return normal filenames unchanged', () => {

View File

@ -1,6 +1,6 @@
import { describe, expect, it } from 'vitest';
import { getJwtExpiry } from './jwt';
import { getJwtExpiry } from './get-jwt-expiry';
function base64url(input: string): string {
return Buffer.from(input, 'utf8').toString('base64url');

View File

@ -1,17 +1,17 @@
export * from './assert';
export * from './event-bus';
export * from './event-queue';
export * from './create-event-queue';
export * from './retry';
export * from './workflowId';
export * from './number/smartDecimal';
export * from './search/reRankSearchResults';
export * from './search/sublimeSearch';
export * from './sort/sortByProperty';
export * from './generate-nano-id';
export * from './number/smart-decimal';
export * from './search/re-rank-search-results';
export * from './search/sublime-search';
export * from './sort/sort-by-property';
export * from './string/truncate';
export * from './files/sanitize';
export * from './files/path';
export * from './files/sanitize-filename';
export * from './files/is-windows-file-path';
export * from './placeholder';
export * from './jwt';
export * from './get-jwt-expiry';
export * from './scrub-secrets';
export type * from './types';
export * from './validation';
export * from './is-record';

View File

@ -1,4 +1,4 @@
import { smartDecimal } from './smartDecimal';
import { smartDecimal } from './smart-decimal';
describe('smartDecimal', () => {
it('should return the same value if it is an integer', () => {

View File

@ -1,6 +1,6 @@
import { reRankSearchResults } from './reRankSearchResults';
import { reRankSearchResults } from './re-rank-search-results';
import topLevel from './snapshots/toplevel.snapshot.json';
import { sublimeSearch } from './sublimeSearch';
import { sublimeSearch } from './sublime-search';
describe('reRankSearchResults', () => {
describe('should re-rank search results based on additional factors', () => {

View File

@ -1,6 +1,6 @@
import { reRankSearchResults } from './reRankSearchResults';
import { reRankSearchResults } from './re-rank-search-results';
import topLevel from './snapshots/toplevel.snapshot.json';
import { sublimeSearch } from './sublimeSearch';
import { sublimeSearch } from './sublime-search';
// Mirrors packages/frontend/editor-ui/data/node-popularity.json scaled by the factor
// applied in useViewStacks.ts. Only the nodes asserted below are included.

View File

@ -1,4 +1,4 @@
import { sortByProperty } from './sortByProperty';
import { sortByProperty } from './sort-by-property';
const arrayOfObjects = [
{ name: 'Álvaro', age: 30 },

View File

@ -1,4 +1,4 @@
import { smartDecimal } from '@n8n/utils/number/smartDecimal';
import { smartDecimal } from '@n8n/utils/number/smart-decimal';
import type { DirectiveBinding, FunctionDirective } from 'vue';
/**

View File

@ -4,7 +4,7 @@ import { AGENTS_MODULE_NAME, NEW_AGENT_VIEW } from '@/features/agents/constants'
import { INSTANCE_AI_VIEW } from '@/features/ai/instanceAi/constants';
import { useRouter } from 'vue-router';
import { useI18n } from '@n8n/i18n';
import { sortByProperty } from '@n8n/utils/sort/sortByProperty';
import { sortByProperty } from '@n8n/utils/sort/sort-by-property';
import { useToast } from '@/app/composables/useToast';
import { useProjectsStore } from '@/features/collaboration/projects/projects.store';
import { useSettingsStore } from '@/app/stores/settings.store';

View File

@ -27,7 +27,7 @@ import {
import type { PushHandlerOptions } from '@/app/composables/usePushConnection/handlers/types';
import { injectWorkflowDocumentStore } from '@/app/stores/workflowDocument.store';
import { useEditorContext } from '@/app/composables/useEditorContext';
import { createEventQueue } from '@n8n/utils/event-queue';
import { createEventQueue } from '@n8n/utils/create-event-queue';
import type { useRouter } from 'vue-router';
export function usePushConnection({ router }: { router: ReturnType<typeof useRouter> }) {

View File

@ -2,7 +2,7 @@
import { computed, ref, watch } from 'vue';
import { N8nText } from '@n8n/design-system';
import { useI18n } from '@n8n/i18n';
import { sublimeSearch } from '@n8n/utils/search/sublimeSearch';
import { sublimeSearch } from '@n8n/utils/search/sublime-search';
import { useCredentialsStore } from '@/features/credentials/credentials.store';
import { useNodeTypesStore } from '@/app/stores/nodeTypes.store';
import { removePreviewToken } from '@/features/shared/nodeCreator/nodeCreator.utils';

View File

@ -1,7 +1,7 @@
import merge from 'lodash/merge';
import { type ChartOptions, type ScriptableContext } from 'chart.js';
import { useCssVar } from '@vueuse/core';
import { smartDecimal } from '@n8n/utils/number/smartDecimal';
import { smartDecimal } from '@n8n/utils/number/smart-decimal';
/**
*

View File

@ -10,7 +10,7 @@ import type { DateValue } from '@internationalized/date';
import type { InsightsSummary } from '@n8n/api-types';
import { N8nIcon, N8nTooltip } from '@n8n/design-system';
import { useI18n } from '@n8n/i18n';
import { smartDecimal } from '@n8n/utils/number/smartDecimal';
import { smartDecimal } from '@n8n/utils/number/smart-decimal';
import { computed, useCssModule } from 'vue';
import { I18nT } from 'vue-i18n';
import { useRoute } from 'vue-router';

View File

@ -9,7 +9,7 @@ import {
INSIGHTS_UNIT_MAPPING,
} from '@/features/execution/insights/insights.constants';
import { transformInsightsAverageRunTime } from '@/features/execution/insights/insights.utils';
import { smartDecimal } from '@n8n/utils/number/smartDecimal';
import { smartDecimal } from '@n8n/utils/number/smart-decimal';
import { type ChartData, Filler, type ScriptableContext } from 'chart.js';
import { computed } from 'vue';
import { Line } from 'vue-chartjs';

View File

@ -2,7 +2,7 @@
import { useI18n } from '@n8n/i18n';
import { generateBarChartOptions } from '@/features/execution/insights/chartjs.utils';
import { GRANULARITY_DATE_FORMAT_MASK } from '@/features/execution/insights/insights.constants';
import { smartDecimal } from '@n8n/utils/number/smartDecimal';
import { smartDecimal } from '@n8n/utils/number/smart-decimal';
import { useCssVar } from '@vueuse/core';
import type { ChartData } from 'chart.js';
import { computed } from 'vue';

View File

@ -6,7 +6,7 @@ import {
INSIGHTS_UNIT_MAPPING,
} from '@/features/execution/insights/insights.constants';
import { transformInsightsFailureRate } from '@/features/execution/insights/insights.utils';
import { smartDecimal } from '@n8n/utils/number/smartDecimal';
import { smartDecimal } from '@n8n/utils/number/smart-decimal';
import { useCssVar } from '@vueuse/core';
import type { ChartData } from 'chart.js';
import { computed } from 'vue';

View File

@ -8,7 +8,7 @@ import {
} from '@/features/execution/insights/insights.utils';
import type { InsightsByWorkflow } from '@n8n/api-types';
import type { TableHeader } from '@n8n/design-system/components/N8nDataTableServer';
import { smartDecimal } from '@n8n/utils/number/smartDecimal';
import { smartDecimal } from '@n8n/utils/number/smart-decimal';
import { useTelemetry } from '@/app/composables/useTelemetry';
import { VIEWS } from '@/app/constants';
import { computed, defineAsyncComponent, ref, watch } from 'vue';

View File

@ -8,7 +8,7 @@ import WorkerJobAccordion from './WorkerJobAccordion.vue';
import WorkerNetAccordion from './WorkerNetAccordion.vue';
import WorkerChartsAccordion from './WorkerChartsAccordion.vue';
import WorkerMemoryMonitorAccordion from './WorkerMemoryMonitorAccordion.vue';
import { sortByProperty } from '@n8n/utils/sort/sortByProperty';
import { sortByProperty } from '@n8n/utils/sort/sort-by-property';
import { useI18n } from '@n8n/i18n';
import { N8nCard, N8nHeading, N8nText } from '@n8n/design-system';

View File

@ -32,8 +32,8 @@ import {
import { v4 as uuidv4 } from 'uuid';
import { i18n } from '@n8n/i18n';
import { reRankSearchResults } from '@n8n/utils/search/reRankSearchResults';
import { sublimeSearch } from '@n8n/utils/search/sublimeSearch';
import { reRankSearchResults } from '@n8n/utils/search/re-rank-search-results';
import { sublimeSearch } from '@n8n/utils/search/sublime-search';
import * as changeCase from 'change-case';
import sortBy from 'lodash/sortBy';
import type { NodeViewItemSection } from './views/viewsData';