Skip to content
Merged
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
File renamed without changes.
8 changes: 7 additions & 1 deletion jest.config.js → jest.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,13 @@ module.exports = {
statements: 100,
},
},
moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"],
extensionsToTreatAsEsm: [".ts"],
moduleFileExtensions: ["ts", "tsx", "js", "jsx", "node", "mjs", "cjs"],
moduleNameMapper: {
chalk: "chalk/source/index.js",
"#ansi-styles": "chalk/source/vendor/ansi-styles/index.js",
"#supports-color": "chalk/source/vendor/supports-color/index.js",
},
testRegex: "src(.*)\\.test\\.tsx?$",
testEnvironment: "node",
transform: {
Expand Down
5,193 changes: 3,526 additions & 1,667 deletions package-lock.json

Large diffs are not rendered by default.

12 changes: 7 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"node": ">=14.0.0"
},
"dependencies": {
"chalk": "4.1.2",
"chalk": "5.0.0",
"commander": "9.0.0",
"cson-parser": "4.0.9",
"eslint-config-prettier": "8.4.0",
Expand All @@ -29,10 +29,11 @@
"@types/json5": "0.0.30",
"@types/lodash": "4.14.178",
"@types/minimatch": "3.0.5",
"@types/node": "16.11.26",
"@types/node": "17.0.18",
"@typescript-eslint/eslint-plugin": "5.12.1",
"@typescript-eslint/parser": "5.12.1",
"ansi-regex": "6.0.1",
"cross-env": "^7.0.3",
"eslint": "8.9.0",
"eslint-plugin-simple-import-sort": "7.0.0",
"husky": "7.0.4",
Expand Down Expand Up @@ -65,9 +66,10 @@
"prepare": "husky install",
"prettier": "prettier \"./src/*.{js,json,ts,xml,yaml}\" \"./src/**/*.{js,json,ts,xml,yaml}\" --ignore-path .prettierignore",
"prettier:write": "npm run prettier -- --write",
"test": "jest",
"test:ci": "jest --coverage --maxWorkers=2",
"test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest",
"test:ci": "cross-env NODE_OPTIONS=--experimental-vm-modules jest --coverage --maxWorkers=2",
"tsc": "tsc"
},
"version": "2.11.0"
"type": "module",
"version": "3.0.0-alpha.0"
}
4 changes: 3 additions & 1 deletion src/cli/runCli.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { describe, expect, it } from "@jest/globals";
import { EOL } from "os";

import { version } from "../../package.json";
import { createStubLogger, expectEqualWrites } from "../adapters/logger.stubs";
import { createStubOriginalConfigurationsData } from "../settings.stubs";
import { ConfigurationErrorResult, ResultStatus, TSLintToESLintResult } from "../types";
Expand All @@ -25,6 +24,9 @@ describe("runCli", () => {
// Arrange
const rawArgv = createStubArgv(["--version"]);
const dependencies = createStubRunCliDependencies();
const {
default: { version },
} = await import("../../package.json");

// Act
await runCli(dependencies, rawArgv);
Expand Down
12 changes: 10 additions & 2 deletions src/cli/runCli.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
import chalk from "chalk";
import { Command } from "commander";
import { EOL } from "os";
import { promises as fs } from "fs";
import { EOL } from "node:os";
import path from "node:path";
import { fileURLToPath } from "node:url";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

import { version } from "../../package.json";
import { Logger } from "../adapters/logger";
import { SansDependencies } from "../binding";
import { Converter } from "../converters/types";
Expand Down Expand Up @@ -48,6 +53,9 @@ export const runCli = async (

// 2. If the version should be printed, we do that and stop execution.
if (command.opts().version) {
const { version } = JSON.parse(
(await fs.readFile(path.join(__dirname, "../../package.json"))).toString(),
);
dependencies.logger.stdout.write(`${version}${EOL}`);
return ResultStatus.Succeeded;
}
Expand Down
2 changes: 1 addition & 1 deletion src/converters/comments/parseFileComments.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as utils from "tsutils";
import * as ts from "typescript";
import ts from "typescript";

export type FileComment = {
commentKind: ts.CommentKind;
Expand Down
2 changes: 1 addition & 1 deletion src/converters/comments/replaceFileComments.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as ts from "typescript";
import ts from "typescript";

import { ConversionError } from "../../errors/conversionError";
import { uniqueFromSources } from "../../utils";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as CsonParser from "cson-parser";
import { merge } from "lodash";
import merge from "lodash/merge";

const knownMissingSettings = ["enableSemanticRules", "rulesDirectory"];

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as path from "path";
import * as ts from "typescript";
import ts from "typescript";

import { parseJson } from "../../../utils";
import { EditorConfigConverter } from "../types";
Expand Down
2 changes: 1 addition & 1 deletion src/converters/lintConfigs/rules/convertRules.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isEqual } from "lodash";
import isEqual from "lodash/isEqual";

import { ConversionError } from "../../../errors/conversionError";
import { ErrorSummary } from "../../../errors/errorSummary";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isNumber } from "lodash";
import isNumber from "lodash/isNumber";

import { RuleConverter } from "../ruleConverter";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { assignWith, isObject } from "lodash";
import assignWith from "lodash/assignWith";
import isObject from "lodash/isObject";

import { RuleMerger } from "../ruleMerger";

Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"esModuleInterop": true,
"incremental": true,
"lib": [],
"module": "commonjs",
"module": "esnext",
"moduleResolution": "node",
"noFallthroughCasesInSwitch": true,
"noImplicitAny": true,
Expand Down