Skip to content

Commit

Permalink
React/ESLint some files are not linting
Browse files Browse the repository at this point in the history
  • Loading branch information
qmonmert committed Nov 11, 2024
1 parent ae11e4d commit 439ed96
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public JHipsterModule buildModule(JHipsterModuleProperties properties) {
private Consumer<JHipsterModuleBuilder> patchEslintConfig(JHipsterModuleProperties properties) {
String reactConfig =
"""
\t\tfiles: ['src/main/webapp/**/*.{ts,tsx}', 'src/main/webapp/**/*.spec.ts'],
\t\tfiles: ['src/*/webapp/**/*.{ts,tsx}'],
\t\textends: [...typescript.configs.recommendedTypeChecked, react],
\t\tsettings: {
\t\t\treact: {
Expand All @@ -143,6 +143,11 @@ private Consumer<JHipsterModuleBuilder> patchEslintConfig(JHipsterModuleProperti
regex("[ \\t]+quotes: \\['error', 'single', \\{ avoidEscape: true }],"),
"""
\t\t\t'react/react-in-jsx-scope': 'off',
\t\t\t'@typescript-eslint/no-redundant-type-constituents': 'off',
\t\t\t'@typescript-eslint/no-explicit-any': 'off',
\t\t\t'@typescript-eslint/no-unsafe-argument': 'off',
\t\t\t'@typescript-eslint/await-thenable': 'off',
\t\t\t'@typescript-eslint/no-unsafe-call': 'off',
\t\t\t'@typescript-eslint/no-misused-promises': [
\t\t\t\t'error',
\t\t\t\t{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public JHipsterModule buildModule(JHipsterModuleProperties properties) {
vi.mock('react-i18next', () => ({
useTranslation: () => {
return {
t: vi.fn().mockImplementation((_str: string) => 'Internationalization enabled'),
t: vi.fn().mockImplementation(() => 'Internationalization enabled'),
};
},
}));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const login = async () => {
const { getByText, getByPlaceholderText, getByTestId } = render(<LoginForm />);
const loginButton = getByText('Log in');
fireEvent.click(loginButton);
await act(async () => {
await act(() => {
fireEvent.change(getByPlaceholderText("Nom d'utilisateur"), {
target: { value: 'admin' },
});
Expand All @@ -40,7 +40,7 @@ describe('loginForm', () => {
fireEvent.click(loginButton);
expect(getByText('Connect')).toBeTruthy();
const submitButton = getByTestId('submit-button');
await act(async () => {
await act(() => {
fireEvent.click(submitButton);
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe('test login modal', () => {
it('should contain password input', async () => {
const { getByPlaceholderText, getByTestId } = LoginModalRender(true);
const username = getByPlaceholderText('Mot de passe');
await act(async () => {
await act(() => {
const displayPasswordButton = getByTestId('display-password');
fireEvent.click(displayPasswordButton);
});
Expand All @@ -54,7 +54,7 @@ describe('test login modal', () => {
const { getByPlaceholderText, getByTestId } = LoginModalRender(true);
const spy = vi.spyOn(axios, 'post');
spy.mockImplementationOnce((): Promise<any> => Promise.resolve({ data: {} }));
await act(async () => {
await act(() => {
fireEvent.change(getByPlaceholderText("Nom d'utilisateur"), {
target: { value: 'admin' },
});
Expand All @@ -71,7 +71,7 @@ describe('test login modal', () => {
const { getByPlaceholderText, getByRole } = LoginModalRender(true);
const spy = vi.spyOn(axios, 'post');
spy.mockImplementationOnce((): Promise<any> => Promise.resolve({ data: {} }));
await act(async () => {
await act(() => {
fireEvent.change(getByPlaceholderText("Nom d'utilisateur"), {
target: { value: 'admin' },
});
Expand All @@ -86,7 +86,7 @@ describe('test login modal', () => {

it('should contain error message when submit button is clicked with empty value', async () => {
const { getByTestId } = LoginModalRender(true);
await act(async () => {
await act(() => {
const submitButton = getByTestId('submit-button');
fireEvent.click(submitButton);
});
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/generator/typescript/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
"@/*": ["src/main/webapp/app/*"]
}
},
"include": ["src/main/webapp/**/*", "src/test/webapp/unit/**/*"]
"include": ["src/main/webapp/**/*", "src/test/webapp/**/*"]
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default typescript.config(
},
js.configs.recommended,
{
files: ['src/main/webapp/**/*.{ts,tsx}', 'src/main/webapp/**/*.spec.ts'],
files: ['src/*/webapp/**/*.{ts,tsx}'],
extends: [...typescript.configs.recommendedTypeChecked, react],
settings: {
react: {
Expand All @@ -31,6 +31,11 @@ export default typescript.config(
},
rules: {
'react/react-in-jsx-scope': 'off',
'@typescript-eslint/no-redundant-type-constituents': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/await-thenable': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-misused-promises': [
'error',
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
"@assets/*": ["src/main/webapp/assets/*"]
}
},
"include": ["src/main/webapp/**/*", "src/test/webapp/unit/**/*"]
"include": ["src/main/webapp/**/*", "src/test/webapp/**/*"]
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
"@/*": ["src/main/webapp/app/*"]
}
},
"include": ["src/main/webapp/**/*", "src/test/webapp/unit/**/*"]
"include": ["src/main/webapp/**/*", "src/test/webapp/**/*"]
}

0 comments on commit 439ed96

Please sign in to comment.