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
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ public class TaskGenerateTsConfig extends AbstractTaskClientGenerator {
private static final String VERSION = "flow_version";
private static final String ES_TARGET_VERSION = "target";
private static final String TSCONFIG_JSON_OLDER_VERSIONS_TEMPLATE = "tsconfig-%s.json";
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

6% of developers fix this issue

InlineFormatString: Prefer to create format strings inline, instead of extracting them to a single-use constant


ℹ️ Learn about @sonatype-lift commands

You can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.

Command Usage
@sonatype-lift ignore Leave out the above finding from this PR
@sonatype-lift ignoreall Leave out all the existing findings from this PR
@sonatype-lift exclude <file|issue|path|tool> Exclude specified file|issue|path|tool from Lift findings by updating your config.toml file

Note: When talking to LiftBot, you need to refresh the page to see its response.
Click here to add LiftBot to another repo.


Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]

private static final String[] vaadinVersions = { "latest", "v23.3.0",
"v23.2", "v23.1", "v22", "v14", "osgi" };
private static final String[] vaadinVersions = { "latest", "v23.3.0.1",
"v23.3.0", "v23.2", "v23.1", "v22", "v14", "osgi" };

//@formatter:off
static final String ERROR_MESSAGE =
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// This TypeScript configuration file is generated by vaadin-maven-plugin.
// This is needed for TypeScript compiler to compile your TypeScript code in the project.
// It is recommended to commit this file to the VCS.
// You might want to change the configurations to fit your preferences
// For more information about the configurations, please refer to http://www.typescriptlang.org/docs/handbook/tsconfig-json.html
{
"flow_version": "23.3.0.1",
"compilerOptions": {
"sourceMap": true,
"jsx": "react-jsx",
"inlineSources": true,
"module": "esNext",
"target": "es2020",
"moduleResolution": "node",
"strict": true,
"skipLibCheck": true,
"noFallthroughCasesInSwitch": true,
"noImplicitReturns": true,
"noImplicitAny": true,
"noImplicitThis": true,
"noUnusedLocals": false,
"noUnusedParameters": false,
"experimentalDecorators": true,
"useDefineForClassFields": false,
"baseUrl": "frontend",
"paths": {
"@vaadin/flow-frontend": ["generated/jar-resources"],
"@vaadin/flow-frontend/*": ["generated/jar-resources/*"],
"Frontend/*": ["*"]
}
},
"include": [
"frontend/**/*",
"types.d.ts"
],
"exclude": []
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// You might want to change the configurations to fit your preferences
// For more information about the configurations, please refer to http://www.typescriptlang.org/docs/handbook/tsconfig-json.html
{
"flow_version": "23.3.0.1",
"flow_version": "23.3.4",
"compilerOptions": {
"sourceMap": true,
"jsx": "react-jsx",
Expand Down Expand Up @@ -33,5 +33,7 @@
"frontend/**/*",
"types.d.ts"
],
"exclude": []
"exclude": [
"frontend/generated/jar-resources/**"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@
*/
package com.vaadin.flow.server.frontend;

import static java.nio.charset.StandardCharsets.UTF_8;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicBoolean;

import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
Expand All @@ -32,15 +33,12 @@
import org.junit.rules.TemporaryFolder;
import org.mockito.Mockito;

import com.vaadin.experimental.Feature;
import com.vaadin.experimental.FeatureFlags;
import com.vaadin.flow.di.Lookup;
import com.vaadin.flow.server.ExecutionFailedException;

import static java.nio.charset.StandardCharsets.UTF_8;

public class TaskGenerateTsConfigTest {
static private String LATEST_VERSION = "23.3.0.1";
static private String LATEST_VERSION = "23.3.4";

@Rule
public TemporaryFolder temporaryFolder = new TemporaryFolder();
Expand Down
6 changes: 4 additions & 2 deletions flow-server/src/test/resources/tsconfig-reference.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// You might want to change the configurations to fit your preferences
// For more information about the configurations, please refer to http://www.typescriptlang.org/docs/handbook/tsconfig-json.html
{
"flow_version": "23.3.0.1",
"flow_version": "23.3.4",
"compilerOptions": {
"sourceMap": true,
"jsx": "react-jsx",
Expand Down Expand Up @@ -33,5 +33,7 @@
"frontend/**/*",
"types.d.ts"
],
"exclude": []
"exclude": [
"frontend/generated/jar-resources/**"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
@JsModule("./testscopebuttonloader.js")
@JsModule("./testscopemaploader.js")
@JsModule("./importdir.js")
@JsModule("./bad.ts")
@CssImport(value = "./cssimport-textfield.css", themeFor = "vaadin-text-field")
@CssImport(value = "./cssimport.css")
public class MainView extends Div {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
package com.vaadin.viteapp;

import com.vaadin.flow.component.html.testbench.ParagraphElement;
import org.junit.Assert;
import org.junit.Test;

import com.vaadin.flow.testutil.DevToolsElement;
import com.vaadin.testbench.TestBenchElement;
import com.vaadin.viteapp.views.empty.MainView;

import org.junit.Assert;
import org.junit.Test;

public class BasicsIT extends ViteDevModeIT {

@Test
Expand All @@ -17,6 +16,15 @@ public void applicationStarts() {
header.getText());
}

@Test
public void noTypescriptErrors() throws Exception {
// Ensure the file was loaded
Assert.assertEquals("good", executeScript("return window.bad()"));
Thread.sleep(2000); // Checking is async so it sometimes needs some time
Assert.assertFalse("There should be no error overlay",
$("vite-plugin-checker-error-overlay").exists());
}

@Test
public void imageFromThemeShown() {
TestBenchElement img = $("img").id(MainView.PLANT);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
let hello: any; // Must be initialized

function foo(err: any) { // parameter declared but not read
this.emit('end'); // `this` implicitly has type `any`
}

function func1(bar) { // Parameter 'bar' implicitly has an 'any' type.
const baz = "a"; // Local declared but never used

return bar + 'a';
}

(window as any).bad = function() {
return "good";
}