Skip to content

Commit 114cdd3

Browse files
authored
refactor(vscode): use string over String (#865)
1 parent 4dc8555 commit 114cdd3

File tree

7 files changed

+26
-26
lines changed

7 files changed

+26
-26
lines changed

extensions/vscode/src/commands/create.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,15 +99,15 @@ function promptProjectName(value: string): Thenable<string | undefined> {
9999
}
100100

101101
async function executeDartFrogCreateCommand(
102-
outputDirectory: String,
102+
outputDirectory: string,
103103
projectName: string
104104
): Promise<void> {
105105
return cp.exec(
106106
`dart_frog create '${projectName}'`,
107107
{
108108
cwd: outputDirectory,
109109
},
110-
function (error: Error, stdout: String, stderr: String) {
110+
function (error: Error, stdout: string, stderr: string) {
111111
if (error) {
112112
window.showErrorMessage(error.message);
113113
}

extensions/vscode/src/commands/install-cli.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export const installCLI = async (): Promise<void> => {
2525
async function installDartFrogCliVersion(): Promise<void> {
2626
await cp.exec(
2727
`dart pub global activate dart_frog_cli`,
28-
function (error: Error, stdout: String, stderr: String) {
28+
function (error: Error, stdout: string, stderr: string) {
2929
if (error) {
3030
window.showErrorMessage(error.message);
3131
}

extensions/vscode/src/commands/new-middleware.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,18 +126,18 @@ function promptRoutePath(routePath: string): Thenable<string | undefined> {
126126
* Runs the `dart_frog new middleware` command with the given route path.
127127
*
128128
* @param {string} routePath, the path of the new middleware.
129-
* @param {String} dartFrogProjectPath, the root of the Dart Frog project.
129+
* @param {string} dartFrogProjectPath, the root of the Dart Frog project.
130130
*/
131131
function executeDartFrogNewMiddlewareCommand(
132-
routePath: String,
133-
dartFrogProjectPath: String
132+
routePath: string,
133+
dartFrogProjectPath: string
134134
): void {
135135
cp.exec(
136136
`dart_frog new middleware '${routePath}'`,
137137
{
138138
cwd: dartFrogProjectPath,
139139
},
140-
function (error: Error, stdout: String, stderr: String) {
140+
function (error: Error, stdout: string, stderr: string) {
141141
if (error) {
142142
window.showErrorMessage(error.message);
143143
}

extensions/vscode/src/commands/new-route.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,18 +123,18 @@ async function promptForTargetDirectory(): Promise<string | undefined> {
123123
* Runs the `dart_frog new route` command with the given route path.
124124
*
125125
* @param {string} routePath, the path of the new route.
126-
* @param {String} dartFrogProjectPath, the root of the Dart Frog project.
126+
* @param {string} dartFrogProjectPath, the root of the Dart Frog project.
127127
*/
128128
function executeDartFrogNewRouteCommand(
129-
routePath: String,
130-
dartFrogProjectPath: String
129+
routePath: string,
130+
dartFrogProjectPath: string
131131
): void {
132132
cp.exec(
133133
`dart_frog new route '${routePath}'`,
134134
{
135135
cwd: dartFrogProjectPath,
136136
},
137-
function (error: Error, stdout: String, stderr: String) {
137+
function (error: Error, stdout: string, stderr: string) {
138138
if (error) {
139139
window.showErrorMessage(error.message);
140140
}

extensions/vscode/src/commands/update-cli.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export const updateCLI = async (): Promise<void> => {
2929
async function updateDartFrogCLIVersion(): Promise<void> {
3030
await cp.exec(
3131
`dart_frog update`,
32-
function (error: Error, stdout: String, stderr: String) {
32+
function (error: Error, stdout: string, stderr: string) {
3333
if (error) {
3434
window.showErrorMessage(error.message);
3535
}

extensions/vscode/src/utils/cli-version.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ const compatibleCLIVersion = ">=0.3.7 <2.0.0";
1111
/**
1212
* Collects the version of Dart Frog CLI installed in the user's system.
1313
*
14-
* @returns {String | undefined} The semantic version of Dart Frog CLI installed
14+
* @returns {string | undefined} The semantic version of Dart Frog CLI installed
1515
* in the user's system, or null if Dart Frog CLI is not installed.
1616
*/
17-
export function readDartFrogCLIVersion(): String | undefined {
17+
export function readDartFrogCLIVersion(): string | undefined {
1818
try {
1919
const result = cp.execSync(`dart_frog --version`);
2020
const decodedResult = new TextDecoder().decode(result);
@@ -27,10 +27,10 @@ export function readDartFrogCLIVersion(): String | undefined {
2727
/**
2828
* Collects the latest available version of Dart Frog CLI.
2929
*
30-
* @returns {String | undefined} The latest available semantic version of
30+
* @returns {string | undefined} The latest available semantic version of
3131
* Dart Frog CLI, or undefined if Dart Frog CLI is not installed.
3232
*/
33-
export function readLatestDartFrogCLIVersion(): String | undefined {
33+
export function readLatestDartFrogCLIVersion(): string | undefined {
3434
try {
3535
const result = cp.execSync(`dart_frog --version`);
3636
const decodedResult = new TextDecoder().decode(result);
@@ -48,13 +48,13 @@ export function readLatestDartFrogCLIVersion(): String | undefined {
4848
* Checks if the version of Dart Frog CLI installed in the user's system is
4949
* compatible with this extension.
5050
*
51-
* @param {String} version The semantic version of Dart Frog CLI installed in
51+
* @param {string} version The semantic version of Dart Frog CLI installed in
5252
* the user's system.
5353
* @returns {Boolean} True if the version of Dart Frog CLI installed in the
5454
* user's system is compatible with this extension, false otherwise.
5555
* @see {@link readDartFrogCLIVersion}, to collect the version of Dart Frog CLI.
5656
*/
57-
export function isCompatibleDartFrogCLIVersion(version: String): Boolean {
57+
export function isCompatibleDartFrogCLIVersion(version: string): Boolean {
5858
return semver.satisfies(version, compatibleCLIVersion);
5959
}
6060

@@ -71,10 +71,10 @@ export function isDartFrogCLIInstalled(): boolean {
7171
/**
7272
* Opens the changelog for the specified version in a browser.
7373
*
74-
* @param {String} version The semantic version of Dart Frog CLI which changelog
74+
* @param {string} version The semantic version of Dart Frog CLI which changelog
7575
* is requested to open.
7676
*/
77-
export async function openChangelog(version: String): Promise<void> {
77+
export async function openChangelog(version: string): Promise<void> {
7878
vscode.commands.executeCommand(
7979
"vscode.open",
8080
vscode.Uri.parse(

extensions/vscode/src/utils/dart-frog-structure.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ import { window, workspace } from "vscode";
2222
* project from a file path.
2323
*/
2424
export function normalizeRoutePath(
25-
selectedPath: String,
26-
dartFrogProjectPath: String
25+
selectedPath: string,
26+
dartFrogProjectPath: string
2727
): string {
2828
const routesPath = path.join(dartFrogProjectPath, "routes");
2929
if (!selectedPath.startsWith(routesPath)) {
@@ -62,7 +62,7 @@ export function normalizeRoutePath(
6262
* @see {@link isDartFrogProject}, to determine if a file is a Dart Frog
6363
* project.
6464
*/
65-
export function nearestDartFrogProject(filePath: String): String | undefined {
65+
export function nearestDartFrogProject(filePath: string): string | undefined {
6666
let currentPath = filePath;
6767
while (currentPath !== path.sep) {
6868
if (isDartFrogProject(currentPath)) {
@@ -88,7 +88,7 @@ export function nearestDartFrogProject(filePath: String): String | undefined {
8888
* @returns {boolean} Whether or not the {@link filePath} is the root of Dart
8989
* Frog project.
9090
*/
91-
export function isDartFrogProject(filePath: String): boolean {
91+
export function isDartFrogProject(filePath: string): boolean {
9292
const routesPath = path.join(filePath, "routes");
9393
const pubspecPath = path.join(filePath, "pubspec.yaml");
9494

@@ -123,8 +123,8 @@ export function isDartFrogProject(filePath: String): boolean {
123123
*/
124124
export function resolveDartFrogProjectPathFromWorkspace(
125125
_nearestDartFrogProject: (
126-
filePath: String
127-
) => String | undefined = nearestDartFrogProject
126+
filePath: string
127+
) => string | undefined = nearestDartFrogProject
128128
): string | undefined {
129129
if (window.activeTextEditor) {
130130
const currentTextEditorPath = path.normalize(

0 commit comments

Comments
 (0)