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

apply prettier to react templates #26551

Merged
merged 1 commit into from
Jun 26, 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
4 changes: 1 addition & 3 deletions generators/react/templates/postcss.config.js.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,5 @@
limitations under the License.
-%>
module.exports = {
plugins: [
require('autoprefixer')
]
plugins: [require('autoprefixer')],
};
134 changes: 68 additions & 66 deletions generators/react/templates/src/main/webapp/app/app.scss.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,9 @@ Generic styles
}

.shadow {
box-shadow: rgba(0, 0, 0, 0.12) 0px 1px 6px, rgba(0, 0, 0, 0.12) 0px 1px 4px;
box-shadow:
rgba(0, 0, 0, 0.12) 0px 1px 6px,
rgba(0, 0, 0, 0.12) 0px 1px 4px;
border-radius: 2px;
}

Expand All @@ -157,8 +159,8 @@ Generic styles
/* padding helpers */

@mixin pad($size, $side) {
@if $size== "" {
@if $side== "" {
@if $size== '' {
@if $side== '' {
.pad {
padding: 10px !important;
}
Expand All @@ -168,7 +170,7 @@ Generic styles
}
}
} @else {
@if $side== "" {
@if $side== '' {
.pad-#{$size} {
padding: #{$size}px !important;
}
Expand All @@ -180,54 +182,54 @@ Generic styles
}
}

@include pad("", "");
@include pad("2", "");
@include pad("3", "");
@include pad("5", "");
@include pad("10", "");
@include pad("20", "");
@include pad("25", "");
@include pad("30", "");
@include pad("50", "");
@include pad("75", "");
@include pad("100", "");
@include pad("4", "top");
@include pad("5", "top");
@include pad("10", "top");
@include pad("20", "top");
@include pad("25", "top");
@include pad("30", "top");
@include pad("50", "top");
@include pad("75", "top");
@include pad("100", "top");
@include pad("4", "bottom");
@include pad("5", "bottom");
@include pad("10", "bottom");
@include pad("20", "bottom");
@include pad("25", "bottom");
@include pad("30", "bottom");
@include pad("50", "bottom");
@include pad("75", "bottom");
@include pad("100", "bottom");
@include pad("5", "right");
@include pad("10", "right");
@include pad("20", "right");
@include pad("25", "right");
@include pad("30", "right");
@include pad("50", "right");
@include pad("75", "right");
@include pad("100", "right");
@include pad("5", "left");
@include pad("10", "left");
@include pad("20", "left");
@include pad("25", "left");
@include pad("30", "left");
@include pad("50", "left");
@include pad("75", "left");
@include pad("100", "left");
@include pad('', '');
@include pad('2', '');
@include pad('3', '');
@include pad('5', '');
@include pad('10', '');
@include pad('20', '');
@include pad('25', '');
@include pad('30', '');
@include pad('50', '');
@include pad('75', '');
@include pad('100', '');
@include pad('4', 'top');
@include pad('5', 'top');
@include pad('10', 'top');
@include pad('20', 'top');
@include pad('25', 'top');
@include pad('30', 'top');
@include pad('50', 'top');
@include pad('75', 'top');
@include pad('100', 'top');
@include pad('4', 'bottom');
@include pad('5', 'bottom');
@include pad('10', 'bottom');
@include pad('20', 'bottom');
@include pad('25', 'bottom');
@include pad('30', 'bottom');
@include pad('50', 'bottom');
@include pad('75', 'bottom');
@include pad('100', 'bottom');
@include pad('5', 'right');
@include pad('10', 'right');
@include pad('20', 'right');
@include pad('25', 'right');
@include pad('30', 'right');
@include pad('50', 'right');
@include pad('75', 'right');
@include pad('100', 'right');
@include pad('5', 'left');
@include pad('10', 'left');
@include pad('20', 'left');
@include pad('25', 'left');
@include pad('30', 'left');
@include pad('50', 'left');
@include pad('75', 'left');
@include pad('100', 'left');

@mixin no-padding($side) {
@if $side== "all" {
@if $side== 'all' {
.no-padding {
padding: 0 !important;
}
Expand All @@ -238,19 +240,19 @@ Generic styles
}
}

@include no-padding("left");
@include no-padding("right");
@include no-padding("top");
@include no-padding("bottom");
@include no-padding("all");
@include no-padding('left');
@include no-padding('right');
@include no-padding('top');
@include no-padding('bottom');
@include no-padding('all');

/* end of padding helpers */

.no-margin {
margin: 0px;
}
@mixin voffset($size) {
@if $size== "" {
@if $size== '' {
.voffset {
margin-top: 2px !important;
}
Expand All @@ -261,16 +263,16 @@ Generic styles
}
}

@include voffset("");
@include voffset("5");
@include voffset("10");
@include voffset("15");
@include voffset("30");
@include voffset("40");
@include voffset("60");
@include voffset("80");
@include voffset("100");
@include voffset("150");
@include voffset('');
@include voffset('5');
@include voffset('10');
@include voffset('15');
@include voffset('30');
@include voffset('40');
@include voffset('60');
@include voffset('80');
@include voffset('100');
@include voffset('150');

.readonly {
background-color: #eee;
Expand Down
4 changes: 2 additions & 2 deletions generators/react/templates/src/main/webapp/app/app.tsx.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ export const App = () => {
<div className="container-fluid view-container" id="app-view-container">
<Card className="jh-card">
<ErrorBoundary>
<AppRoutes/>
<AppRoutes />
</ErrorBoundary>
</Card>
<Footer/>
<Footer />
</div>
</div>
</BrowserRouter>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe('Axios Interceptor', () => {

it('onRequestSuccess is called on fulfilled request', () => {
expect((client.interceptors.request as any).handlers[0].fulfilled({ data: 'foo', url: '/test' })).toMatchObject({
data: 'foo'
data: 'foo',
});
});
it('onResponseSuccess is called on fulfilled response', () => {
Expand All @@ -40,12 +40,11 @@ describe('Axios Interceptor', () => {
response: {
statusText: 'NotFound',
status: 401,
data: { message: 'Page not found' }
}
data: { message: 'Page not found' },
},
};
expect((client.interceptors.response as any).handlers[0].rejected(rejectError)).rejects.toEqual(rejectError);
expect(onUnauthenticated.calledOnce).toBe(true);
});
});
});

Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
-%>
export const AUTHORITIES = {
ADMIN: 'ROLE_ADMIN',
USER: 'ROLE_USER'
USER: 'ROLE_USER',
};

export const messages = {
DATA_ERROR_ALERT: 'Internal Error'
DATA_ERROR_ALERT: 'Internal Error',
};

export const APP_DATE_FORMAT = 'DD/MM/YY HH:mm';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ describe('Notification Middleware', () => {
// Default action for use in local tests
const DEFAULT = {
type: SUCCESS_TYPE,
payload: 'foo'
payload: 'foo',
};
const HEADER_SUCCESS = {
type: SUCCESS_TYPE,
payload: {
"status": 201,
"statusText": "Created",
"headers": {"app-alert": "foo.created", "app-params": "foo"}
status: 201,
statusText: 'Created',
headers: { 'app-alert': 'foo.created', 'app-params': 'foo' },
},
};

Expand Down Expand Up @@ -120,7 +120,7 @@ describe('Notification Middleware', () => {
response: {
data: '',
config: {
url: 'api/authenticate'
url: 'api/authenticate',
},
status: 401,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export function configureInjectableStore(storeToInject) {
combineReducers({
...sharedReducers,
...injectableStore.asyncReducers,
})
}),
);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const render = Component =>
<Component />
</div>
</Provider>
</ErrorBoundary>
</ErrorBoundary>,
);

render(AppComponent);
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
See the License for the specific language governing permissions and
limitations under the License.
-%>

import axios from 'axios';
import sinon from 'sinon';
import { configureStore } from '@reduxjs/toolkit';
Expand Down Expand Up @@ -95,10 +94,7 @@ describe('Activate reducer tests', () => {
});
it('dispatches RESET actions', async () => {
await store.dispatch(reset());
expect(store.getState()).toEqual([
expect.any(Object),
expect.objectContaining(reset()),
]);
expect(store.getState()).toEqual([expect.any(Object), expect.objectContaining(reset())]);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ import { serializeAxiosError } from 'app/shared/reducers/reducer.utils';

const initialState = {
activationSuccess: false,
activationFailure: false
activationFailure: false,
};

export type ActivateState = Readonly<typeof initialState>;
export type ActivateState = Readonly<typeof initialState>;

// Actions

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ const successAlert = (
</Translate>
<Link to="/login" className="alert-link">
<Translate contentKey="global.messages.info.authenticated.link">sign in</Translate>
</Link>.
</Link>
.
</Alert>
);

Expand All @@ -49,7 +50,7 @@ export const ActivatePage = () => {
const [searchParams] = useSearchParams();

useEffect(() => {
const key = searchParams.get("key");
const key = searchParams.get('key');

dispatch(activateAction(key));
return () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const PasswordResetFinishPage = () => {
() => () => {
dispatch(reset());
},
[]
[],
);

const handleValidSubmit = ({ newPassword }) => dispatch(handlePasswordResetFinish({ key, newPassword }));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const PasswordResetInit = () => {
() => () => {
dispatch(reset());
},
[]
[],
);

const handleValidSubmit = ({ email }) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const initialState = {
successMessage: null,
};

export type PasswordResetState = Readonly<typeof initialState>;
export type PasswordResetState = Readonly<typeof initialState>;

const apiUrl = 'api/account/reset-password';
// Actions
Expand All @@ -37,13 +37,13 @@ export const handlePasswordResetInit = createAsyncThunk(
'passwordReset/reset_password_init',
// If the content-type isn't set that way, axios will try to encode the body and thus modify the data sent to the server.
async (mail: string) => axios.post(`${apiUrl}/init`, mail, { headers: { ['Content-Type']: 'text/plain' } }),
{ serializeError: serializeAxiosError }
{ serializeError: serializeAxiosError },
);

export const handlePasswordResetFinish = createAsyncThunk(
'passwordReset/reset_password_finish',
async (data: { key: string; newPassword: string }) => axios.post(`${apiUrl}/finish`, data),
{ serializeError: serializeAxiosError }
{ serializeError: serializeAxiosError },
);

export const PasswordResetSlice = createSlice({
Expand Down Expand Up @@ -91,4 +91,3 @@ export const { reset } = PasswordResetSlice.actions;

// Reducer
export default PasswordResetSlice.reducer;

Loading
Loading