Update to JS coding standard v2.5.0

This commit is contained in:
Alejandro Celaya 2024-06-06 17:49:12 +02:00
parent fa39302474
commit b2908d2b1f
8 changed files with 1769 additions and 966 deletions

View file

@ -16,6 +16,7 @@ updates:
patterns:
- '@shlinkio/eslint-config-js-coding-standard'
- '@typescript-eslint/*'
- 'eslint-plugin-*'
- 'eslint'
shlink:
patterns:

View file

@ -1,5 +1,3 @@
version: '3'
services:
shlink_web_client_node:
user: 1000:1000

View file

@ -1,5 +1,3 @@
version: '3'
services:
shlink_web_client_node:
container_name: shlink_web_client_node

2714
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -57,7 +57,7 @@
"workbox-strategies": "^7.1.0"
},
"devDependencies": {
"@shlinkio/eslint-config-js-coding-standard": "~2.4.1",
"@shlinkio/eslint-config-js-coding-standard": "~2.5.0",
"@shlinkio/stylelint-config-css-coding-standard": "~1.1.1",
"@testing-library/jest-dom": "^6.4.5",
"@testing-library/react": "^15.0.7",
@ -74,6 +74,10 @@
"axe-core": "^4.9.1",
"chalk": "^5.3.0",
"eslint": "^8.57.0",
"eslint-plugin-jsx-a11y": "^6.8.0",
"eslint-plugin-react": "^7.34.2",
"eslint-plugin-react-hooks": "^4.6.2",
"eslint-plugin-simple-import-sort": "^12.1.0",
"history": "^5.3.0",
"jsdom": "^24.1.0",
"sass": "^1.77.4",

View file

@ -44,4 +44,4 @@ export const isNotFoundServer = (server: SelectedServer): server is NotFoundServ
export const getServerId = (server: SelectedServer) => (isServerWithId(server) ? server.id : '');
export const serverWithIdToServerData = ({ id, autoConnect, ...server }: ServerWithId): ServerData => server;
export const serverWithIdToServerData = ({ name, url, apiKey }: ServerWithId): ServerData => ({ name, url, apiKey });

View file

@ -44,8 +44,8 @@ export const { actions, reducer } = createSlice({
},
},
deleteServer: (state, { payload }) => {
const { [payload.id]: deletedServer, ...rest } = state;
return rest;
delete state[payload.id];
return state;
},
setAutoConnect: {
prepare: ({ id: serverId }: ServerWithId, autoConnect: boolean) => ({

View file

@ -107,7 +107,9 @@ describe('serversReducer', () => {
});
it('generates an id for every provided server if they do not have it', () => {
const servers = Object.values(list).map(({ id, ...rest }) => rest);
const servers = Object.values(list).map(({ name, autoConnect, url, apiKey }) => (
{ name, autoConnect, url, apiKey }
));
const { payload } = createServers(servers);
expect(Object.values(payload).every(({ id }) => !!id)).toEqual(true);