Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

React/ESLint some files are not linted #11345

Merged
merged 1 commit into from
Nov 12, 2024
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 @@ -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/main/webapp/**/*.{ts,tsx}', 'src/test/webapp/unit/**/*.{ts,tsx}'],
\t\textends: [...typescript.configs.recommendedTypeChecked, react],
\t\tsettings: {
\t\t\treact: {
Expand All @@ -143,6 +143,9 @@ 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-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-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
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/main/webapp/**/*.{ts,tsx}', 'src/test/webapp/unit/**/*.{ts,tsx}'],
extends: [...typescript.configs.recommendedTypeChecked, react],
settings: {
react: {
Expand All @@ -31,6 +31,9 @@ export default typescript.config(
},
rules: {
'react/react-in-jsx-scope': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/await-thenable': 'off',
'@typescript-eslint/no-misused-promises': [
'error',
{
Expand Down