Merge pull request #32516 from backstage/freben/nodecolon
Add a rule for the use of `node:` prefix on native imports
This commit is contained in:
@@ -18,7 +18,7 @@
|
||||
/* eslint-disable no-restricted-syntax */
|
||||
/* eslint-disable @backstage/no-undeclared-imports */
|
||||
|
||||
const path = require('path');
|
||||
const path = require('node:path');
|
||||
|
||||
const NUNJUCKS_LICENSE = `/**
|
||||
* Copyright (c) 2012-2015, James Long
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { IncomingMessage } from 'http';
|
||||
import { IncomingMessage } from 'node:http';
|
||||
import request from 'supertest';
|
||||
import waitForExpect from 'wait-for-expect';
|
||||
|
||||
|
||||
+2
-2
@@ -22,10 +22,10 @@ const fsMock = fs as jest.Mocked<typeof fs>;
|
||||
|
||||
import { createMockActionContext } from '@backstage/plugin-scaffolder-node-test-utils';
|
||||
import { createCatalogWriteAction } from './write';
|
||||
import { resolve as resolvePath } from 'path';
|
||||
import { resolve as resolvePath } from 'node:path';
|
||||
import * as yaml from 'yaml';
|
||||
import { examples } from './write.examples';
|
||||
import os from 'os';
|
||||
import os from 'node:os';
|
||||
|
||||
describe('catalog:write', () => {
|
||||
const action = createCatalogWriteAction();
|
||||
|
||||
@@ -20,11 +20,11 @@ jest.mock('fs-extra');
|
||||
|
||||
const fsMock = fs as jest.Mocked<typeof fs>;
|
||||
|
||||
import os from 'os';
|
||||
import os from 'node:os';
|
||||
import { createMockActionContext } from '@backstage/plugin-scaffolder-node-test-utils';
|
||||
import { ANNOTATION_ORIGIN_LOCATION } from '@backstage/catalog-model';
|
||||
import { createCatalogWriteAction } from './write';
|
||||
import { resolve as resolvePath } from 'path';
|
||||
import { resolve as resolvePath } from 'node:path';
|
||||
import * as yaml from 'yaml';
|
||||
|
||||
describe('catalog:write', () => {
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@
|
||||
|
||||
import { createMockActionContext } from '@backstage/plugin-scaffolder-node-test-utils';
|
||||
import { createDebugLogAction } from './log';
|
||||
import { join } from 'path';
|
||||
import { join } from 'node:path';
|
||||
import yaml from 'yaml';
|
||||
import { examples } from './log.examples';
|
||||
import { createMockDirectory } from '@backstage/backend-test-utils';
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
import { createMockActionContext } from '@backstage/plugin-scaffolder-node-test-utils';
|
||||
import { Logger } from 'winston';
|
||||
import { createDebugLogAction } from './log';
|
||||
import { join } from 'path';
|
||||
import { join } from 'node:path';
|
||||
import yaml from 'yaml';
|
||||
import { createMockDirectory } from '@backstage/backend-test-utils';
|
||||
import fs from 'fs-extra';
|
||||
|
||||
@@ -16,10 +16,10 @@
|
||||
|
||||
import { resolveSafeChildPath } from '@backstage/backend-plugin-api';
|
||||
import { readdir, stat } from 'fs-extra';
|
||||
import { join, relative } from 'path';
|
||||
import { join, relative } from 'node:path';
|
||||
import { createTemplateAction } from '@backstage/plugin-scaffolder-node';
|
||||
import { examples } from './log.examples';
|
||||
import fs from 'fs';
|
||||
import fs from 'node:fs';
|
||||
|
||||
const id = 'debug:log';
|
||||
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@
|
||||
|
||||
import yaml from 'yaml';
|
||||
|
||||
import { resolve as resolvePath } from 'path';
|
||||
import { resolve as resolvePath } from 'node:path';
|
||||
import { ConfigReader } from '@backstage/config';
|
||||
import { ScmIntegrations } from '@backstage/integration';
|
||||
import { createFetchPlainAction } from './plain';
|
||||
|
||||
@@ -19,7 +19,7 @@ jest.mock('@backstage/plugin-scaffolder-node', () => {
|
||||
return { ...actual, fetchContents: jest.fn() };
|
||||
});
|
||||
|
||||
import { resolve as resolvePath } from 'path';
|
||||
import { resolve as resolvePath } from 'node:path';
|
||||
import { createMockActionContext } from '@backstage/plugin-scaffolder-node-test-utils';
|
||||
import { ConfigReader } from '@backstage/config';
|
||||
import { ScmIntegrations } from '@backstage/integration';
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ jest.mock('@backstage/plugin-scaffolder-node', () => {
|
||||
});
|
||||
|
||||
import yaml from 'yaml';
|
||||
import { resolve as resolvePath } from 'path';
|
||||
import { resolve as resolvePath } from 'node:path';
|
||||
import { ConfigReader } from '@backstage/config';
|
||||
import { ScmIntegrations } from '@backstage/integration';
|
||||
import { createFetchPlainFileAction } from './plainFile';
|
||||
|
||||
@@ -19,7 +19,7 @@ jest.mock('@backstage/plugin-scaffolder-node', () => {
|
||||
return { ...actual, fetchFile: jest.fn() };
|
||||
});
|
||||
|
||||
import { resolve as resolvePath } from 'path';
|
||||
import { resolve as resolvePath } from 'node:path';
|
||||
import { createMockActionContext } from '@backstage/plugin-scaffolder-node-test-utils';
|
||||
import { ConfigReader } from '@backstage/config';
|
||||
import { ScmIntegrations } from '@backstage/integration';
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { join as joinPath, sep as pathSep } from 'path';
|
||||
import { join as joinPath, sep as pathSep } from 'node:path';
|
||||
import fs from 'fs-extra';
|
||||
import { UrlReaderService } from '@backstage/backend-plugin-api';
|
||||
import { resolvePackagePath } from '@backstage/backend-plugin-api';
|
||||
|
||||
@@ -19,7 +19,7 @@ jest.mock('@backstage/plugin-scaffolder-node', () => {
|
||||
return { ...actual, fetchContents: jest.fn() };
|
||||
});
|
||||
|
||||
import { join as joinPath, sep as pathSep } from 'path';
|
||||
import { join as joinPath, sep as pathSep } from 'node:path';
|
||||
import fs from 'fs-extra';
|
||||
import {
|
||||
UrlReaderService,
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ import { isBinaryFile } from 'isbinaryfile';
|
||||
import { createDefaultFilters } from '../../../../lib/templating/filters/createDefaultFilters';
|
||||
import { convertFiltersToRecord } from '../../../../util/templating';
|
||||
import { SecureTemplater } from '../../../../lib/templating/SecureTemplater';
|
||||
import { extname } from 'path';
|
||||
import { extname } from 'node:path';
|
||||
|
||||
export type TemplateActionInput = {
|
||||
targetPath?: string;
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { join as joinPath } from 'path';
|
||||
import { join as joinPath } from 'node:path';
|
||||
import fs from 'fs-extra';
|
||||
import { UrlReaderService } from '@backstage/backend-plugin-api';
|
||||
import { ScmIntegrations } from '@backstage/integration';
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@ jest.mock('@backstage/plugin-scaffolder-node', () => {
|
||||
return { ...actual, fetchFile: jest.fn() };
|
||||
});
|
||||
|
||||
import { join as joinPath } from 'path';
|
||||
import { join as joinPath } from 'node:path';
|
||||
import fs from 'fs-extra';
|
||||
import { UrlReaderService } from '@backstage/backend-plugin-api';
|
||||
import { ScmIntegrations } from '@backstage/integration';
|
||||
|
||||
@@ -22,7 +22,7 @@ import {
|
||||
TemplateFilter,
|
||||
TemplateGlobal,
|
||||
} from '@backstage/plugin-scaffolder-node';
|
||||
import path from 'path';
|
||||
import path from 'node:path';
|
||||
import { examples } from './templateFile.examples';
|
||||
import { createTemplateFileActionHandler } from './templateFileActionHandler';
|
||||
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ import fs from 'fs-extra';
|
||||
import { createDefaultFilters } from '../../../../lib/templating/filters/createDefaultFilters';
|
||||
import { convertFiltersToRecord } from '../../../../util/templating';
|
||||
import { resolveSafeChildPath } from '@backstage/backend-plugin-api';
|
||||
import path from 'path';
|
||||
import path from 'node:path';
|
||||
import { SecureTemplater } from '../../../../lib/templating/SecureTemplater';
|
||||
|
||||
export type TemplateFileActionInput = {
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ import {
|
||||
} from '@backstage/plugin-scaffolder-node';
|
||||
import { createMockActionContext } from '@backstage/plugin-scaffolder-node-test-utils';
|
||||
import fs from 'fs-extra';
|
||||
import { join as joinPath, sep as pathSep } from 'path';
|
||||
import { join as joinPath, sep as pathSep } from 'node:path';
|
||||
import { createWorkspaceTemplateAction } from './workspaceTemplate';
|
||||
import { TemplateActionInput } from './templateActionHandler';
|
||||
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ import {
|
||||
} from '@backstage/plugin-scaffolder-node';
|
||||
import { createMockActionContext } from '@backstage/plugin-scaffolder-node-test-utils';
|
||||
import fs from 'fs-extra';
|
||||
import { join as joinPath } from 'path';
|
||||
import { join as joinPath } from 'node:path';
|
||||
import { createWorkspaceTemplateFileAction } from './workspaceTemplateFile';
|
||||
import { TemplateFileActionInput } from './templateFileActionHandler';
|
||||
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@
|
||||
|
||||
import { createFilesystemDeleteAction } from './delete';
|
||||
import { createMockActionContext } from '@backstage/plugin-scaffolder-node-test-utils';
|
||||
import { resolve as resolvePath } from 'path';
|
||||
import { resolve as resolvePath } from 'node:path';
|
||||
import fs from 'fs-extra';
|
||||
import yaml from 'yaml';
|
||||
import { examples } from './delete.examples';
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { resolve as resolvePath } from 'path';
|
||||
import { resolve as resolvePath } from 'node:path';
|
||||
import { createFilesystemDeleteAction } from './delete';
|
||||
import { createMockActionContext } from '@backstage/plugin-scaffolder-node-test-utils';
|
||||
import fs from 'fs-extra';
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@
|
||||
|
||||
import { createFilesystemReadDirAction } from './read';
|
||||
import { createMockActionContext } from '@backstage/plugin-scaffolder-node-test-utils';
|
||||
import { resolve as resolvePath } from 'path';
|
||||
import { resolve as resolvePath } from 'node:path';
|
||||
import { createMockDirectory } from '@backstage/backend-test-utils';
|
||||
import { examples } from './read.examples';
|
||||
import yaml from 'yaml';
|
||||
|
||||
@@ -15,8 +15,8 @@
|
||||
*/
|
||||
import { createTemplateAction } from '@backstage/plugin-scaffolder-node';
|
||||
import { resolveSafeChildPath } from '@backstage/backend-plugin-api';
|
||||
import fs from 'fs/promises';
|
||||
import path from 'path';
|
||||
import fs from 'node:fs/promises';
|
||||
import path from 'node:path';
|
||||
import { z as zod } from 'zod';
|
||||
import { examples } from './read.examples';
|
||||
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { resolve as resolvePath } from 'path';
|
||||
import { resolve as resolvePath } from 'node:path';
|
||||
import { createFilesystemRenameAction } from './rename';
|
||||
import { createMockActionContext } from '@backstage/plugin-scaffolder-node-test-utils';
|
||||
import fs from 'fs-extra';
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { resolve as resolvePath } from 'path';
|
||||
import { resolve as resolvePath } from 'node:path';
|
||||
import { createFilesystemRenameAction } from './rename';
|
||||
import { createMockActionContext } from '@backstage/plugin-scaffolder-node-test-utils';
|
||||
import fs from 'fs-extra';
|
||||
|
||||
@@ -39,8 +39,8 @@ import {
|
||||
} from '@backstage/plugin-scaffolder-node';
|
||||
import { JsonObject } from '@backstage/types';
|
||||
import fs from 'fs-extra';
|
||||
import path from 'path';
|
||||
import { fileURLToPath } from 'url';
|
||||
import path from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { v4 as uuid } from 'uuid';
|
||||
import { NunjucksWorkflowRunner } from '../tasks/NunjucksWorkflowRunner';
|
||||
import { DecoratedActionsRegistry } from './DecoratedActionsRegistry';
|
||||
|
||||
@@ -27,7 +27,7 @@ import { metrics } from '@opentelemetry/api';
|
||||
import fs from 'fs-extra';
|
||||
import { validate as validateJsonSchema } from 'jsonschema';
|
||||
import nunjucks from 'nunjucks';
|
||||
import path from 'path';
|
||||
import path from 'node:path';
|
||||
import * as winston from 'winston';
|
||||
import {
|
||||
SecureTemplater,
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import os from 'os';
|
||||
import os from 'node:os';
|
||||
import { DatabaseManager } from '@backstage/backend-defaults/database';
|
||||
import { ConfigReader } from '@backstage/config';
|
||||
import { DatabaseTaskStore } from './DatabaseTaskStore';
|
||||
|
||||
@@ -28,7 +28,7 @@ import PQueue from 'p-queue';
|
||||
import { TemplateActionRegistry } from '../actions/TemplateActionRegistry';
|
||||
import { NunjucksWorkflowRunner } from './NunjucksWorkflowRunner';
|
||||
import { WorkflowRunner } from './types';
|
||||
import { setTimeout } from 'timers/promises';
|
||||
import { setTimeout } from 'node:timers/promises';
|
||||
import { JsonObject } from '@backstage/types';
|
||||
import { Config } from '@backstage/config';
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ import { assertError, InputError, NotFoundError } from '@backstage/errors';
|
||||
import { CatalogService } from '@backstage/plugin-catalog-node';
|
||||
import { TemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common';
|
||||
import fs from 'fs-extra';
|
||||
import os from 'os';
|
||||
import os from 'node:os';
|
||||
|
||||
export async function getWorkingDirectory(
|
||||
config: Config,
|
||||
|
||||
@@ -82,7 +82,7 @@ import {
|
||||
import { HumanDuration, JsonObject } from '@backstage/types';
|
||||
import express from 'express';
|
||||
import { Duration } from 'luxon';
|
||||
import { pathToFileURL } from 'url';
|
||||
import { pathToFileURL } from 'node:url';
|
||||
import { v4 as uuid } from 'uuid';
|
||||
import { z } from 'zod';
|
||||
import {
|
||||
|
||||
Reference in New Issue
Block a user