Skip to content

Commit 0819597

Browse files
authored
Merge pull request #4639 from cloud-gov/chore-update-linting-and-formatting
chore: Update linting and formatting
2 parents 78546af + 954d07e commit 0819597

File tree

117 files changed

+1270
-825
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

117 files changed

+1270
-825
lines changed

.eslintignore

Lines changed: 0 additions & 5 deletions
This file was deleted.

.eslintrc.js

Lines changed: 0 additions & 78 deletions
This file was deleted.

.prettierignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Ignore artifacts:
2+
build
3+
coverage
4+
5+
Ignore All Non JS
6+
**/*.yml
7+
**/*.md
8+
**/*.css
9+
**/*.scss
10+
**/*.njk

.prettierrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"singleQuote": true
3+
}

admin-client/.eslintrc.json

Lines changed: 0 additions & 28 deletions
This file was deleted.

admin-client/eslint.config.mjs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import globals from 'globals';
2+
import pluginJs from '@eslint/js';
3+
import eslintPluginSvelte from 'eslint-plugin-svelte';
4+
5+
export default [
6+
{ languageOptions: { globals: { ...globals.browser, process: false } } },
7+
{ files: ['**/*.svelte'] },
8+
{
9+
ignores: ['public/build', 'rollup.config.js'],
10+
},
11+
pluginJs.configs.recommended,
12+
...eslintPluginSvelte.configs['flat/recommended'],
13+
{
14+
rules: {
15+
'no-unused-vars': [
16+
'error',
17+
{
18+
argsIgnorePattern: '^_',
19+
varsIgnorePattern: '^_',
20+
caughtErrorsIgnorePattern: '^_',
21+
},
22+
],
23+
},
24+
},
25+
];

admin-client/jest.config.js

Lines changed: 0 additions & 12 deletions
This file was deleted.

admin-client/package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,15 @@
1313
"node": "^20.x.x"
1414
},
1515
"devDependencies": {
16+
"@eslint/js": "^9.13.0",
1617
"@rollup/plugin-commonjs": "^12.0.0",
1718
"@rollup/plugin-node-resolve": "^8.0.0",
1819
"@rollup/plugin-replace": "^2.2.0",
19-
"eslint": "^8.53.0",
20+
"eslint": "^9.13.0",
2021
"eslint-config-airbnb-base": "^14.2.0",
2122
"eslint-plugin-import": "^2.29.0",
22-
"eslint-plugin-svelte3": "^3.2.0",
23+
"eslint-plugin-svelte": "^2.46.0",
24+
"globals": "^15.11.0",
2325
"rollup": "^2.3.4",
2426
"rollup-plugin-copy": "^3.5.0",
2527
"rollup-plugin-livereload": "^1.0.0",

admin-client/src/flows/organizations.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { notification } from '../stores';
33
import { deactivateOrganization, activateOrganization } from '../lib/api';
44

55
async function deactivate(id, redirectTo) {
6-
// eslint-disable-next-line no-alert
76
if (!window.confirm('Are you sure you want to deactivate this organization?')) { return null; }
87
try {
98
await deactivateOrganization(id);

admin-client/src/helpers/downloadCSV.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable import/prefer-default-export */
21
export const downloadCSV = async (fetchCSV, filename) => {
32
const csv = await fetchCSV();
43
const blob = new Blob([csv], { type: 'application/octet-stream' });

admin-client/src/helpers/formatter.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
1-
/* eslint-disable import/prefer-default-export */
21
import { format, formatRelative } from 'date-fns';
32

43
export const formatDateTime = (date, relative = false) => {
54
try {
65
return relative
76
? formatRelative(new Date(date), new Date())
87
: format(new Date(date), 'yyyy-MM-dd hh:mma');
9-
} catch (error) {
8+
} catch (_) {
109
return 'N/A';
1110
}
1211
};
1312

1413
export const formatSha = (commit) => {
1514
try {
1615
return commit.slice(0, 7);
17-
} catch (error) {
16+
} catch (_) {
1817
return 'N/A';
1918
}
2019
};

admin-client/src/lib/api.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable no-console */
21
/* global API_URL */
32
import { notification, session } from '../stores';
43
import { logout as authLogout } from './auth';
@@ -13,18 +12,15 @@ const defaultOptions = {
1312
mode: 'cors',
1413
};
1514

16-
// eslint-disable-next-line no-underscore-dangle
1715
function _setSearchString(query = {}) {
1816
const search = new URLSearchParams();
1917

20-
// eslint-disable-next-line array-callback-return
2118
Object.keys(query).map((key) => {
2219
search.set(key, query[key]);
2320
});
2421
return search.toString();
2522
}
2623

27-
// eslint-disable-next-line no-underscore-dangle
2824
async function _fetch(path, fetchOpts = {}, apiOpts = { handleError: true }) {
2925
const fetchOptions = { ...defaultOptions, ...fetchOpts };
3026
if (!['GET', 'HEAD', 'OPTIONS'].includes(fetchOptions.method)) {
@@ -58,7 +54,6 @@ async function _fetch(path, fetchOpts = {}, apiOpts = { handleError: true }) {
5854
return request;
5955
}
6056

61-
// eslint-disable-next-line no-underscore-dangle
6257
async function _fetchAttachedFile(path) {
6358
const fetchOptions = { ...defaultOptions };
6459
fetchOptions.headers['x-csrf-token'] = session.csrfToken();
@@ -125,7 +120,6 @@ function fetchBuildLogEventSource(id, onMessage) {
125120
const es = new EventSource(`${apiUrl}/admin/builds/${id}/log`, { withCredentials: true });
126121
es.addEventListener('message', onMessage);
127122
es.addEventListener('error', (error) => {
128-
// eslint-disable-next-line no-console
129123
console.error('EventSource failed:', error);
130124
if (es) {
131125
es.close();

admin-client/src/lib/jsonTreeView.js

Lines changed: 27 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -393,11 +393,6 @@ function JSONTreeView(name_, value_, parent_, isRoot_) {
393393
: (n >> (i + 1) << (i + 1)) | (n % (n >> i << i)) | (+b << i);
394394
}
395395

396-
function squarebracketify(exp) {
397-
return typeof exp === 'string'
398-
? exp.replace(/\.([0-9]+)/g, '[$1]') : `${exp}`;
399-
}
400-
401396
function refresh(silent) {
402397
const expandable = type == 'object' || type == 'array';
403398

@@ -487,11 +482,11 @@ function JSONTreeView(name_, value_, parent_, isRoot_) {
487482
let child; let
488483
event;
489484

490-
while (event = domEventListeners.pop()) {
485+
while (event === domEventListeners.pop()) {
491486
event.element.removeEventListener(event.name, event.fn);
492487
}
493488

494-
while (child = children.pop()) {
489+
while (child === children.pop()) {
495490
removeChild(child);
496491
}
497492
}
@@ -668,7 +663,7 @@ function JSONTreeView(name_, value_, parent_, isRoot_) {
668663
document.execCommand('selectAll', false, null);
669664
}
670665

671-
function itemClicked(field) {
666+
function itemClicked() {
672667
self.emit('click', self,
673668
!self.withRootName && self.isRoot ? [''] : [self.name], self.value);
674669
}
@@ -705,7 +700,7 @@ function JSONTreeView(name_, value_, parent_, isRoot_) {
705700
const text = element.innerText;
706701
try {
707702
setValue(text === 'undefined' ? undefined : JSON.parse(text));
708-
} catch (err) {
703+
} catch (_) {
709704
setValue(text);
710705
}
711706
}
@@ -800,28 +795,28 @@ function JSONTreeView(name_, value_, parent_, isRoot_) {
800795
}
801796
}
802797

803-
function onInsertClick() {
804-
const newName = type == 'array' ? value.length : undefined;
805-
const child = addChild(newName, null);
806-
if (child.parent) {
807-
child.parent.inserting = true;
808-
}
809-
if (type == 'array') {
810-
value.push(null);
811-
child.editValue();
812-
child.emit('append', self, [value.length - 1], 'value', null, true);
813-
if (child.parent) {
814-
child.parent.inserting = false;
815-
}
816-
} else {
817-
child.editName();
818-
}
819-
}
820-
821-
function onDeleteClick() {
822-
self.emit('delete', self, [self.name], self.value,
823-
self.parent.isRoot ? self.parent.oldType : self.parent.type, false);
824-
}
798+
// function onInsertClick() {
799+
// const newName = type == 'array' ? value.length : undefined;
800+
// const child = addChild(newName, null);
801+
// if (child.parent) {
802+
// child.parent.inserting = true;
803+
// }
804+
// if (type == 'array') {
805+
// value.push(null);
806+
// child.editValue();
807+
// child.emit('append', self, [value.length - 1], 'value', null, true);
808+
// if (child.parent) {
809+
// child.parent.inserting = false;
810+
// }
811+
// } else {
812+
// child.editName();
813+
// }
814+
// }
815+
816+
// function onDeleteClick() {
817+
// self.emit('delete', self, [self.name], self.value,
818+
// self.parent.isRoot ? self.parent.oldType : self.parent.type, false);
819+
// }
825820

826821
function onChildRename(child, keyPath, oldName, newName, original) {
827822
const allow = newName && type != 'array' && !(newName in value) && original;
@@ -847,9 +842,8 @@ function JSONTreeView(name_, value_, parent_, isRoot_) {
847842

848843
if (self.withRootName || !self.isRoot) {
849844
keyPath.unshift(name);
850-
} else if (self.withRootName && self.isRoot) {
851-
keyPath.unshift(name);
852845
}
846+
853847
if (oldName !== undefined) {
854848
self.emit('rename', child, keyPath, oldName, newName, false);
855849
}

admin-client/src/pages/domain/Show.svelte

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
}
3636
3737
async function deprovision() {
38-
// eslint-disable-next-line no-alert
3938
if (window.confirm('Are you sure you want to deprovision this domain?')) {
4039
domainPromise = deprovisionDomain(id);
4140
await domainPromise;
@@ -44,7 +43,6 @@
4443
}
4544
4645
async function destroy() {
47-
// eslint-disable-next-line no-alert
4846
if (!window.confirm('Are you sure you want to destroy this domain?')) { return null; }
4947
try {
5048
await destroyDomain(id);
@@ -126,4 +124,4 @@
126124
{/if}
127125
</Await>
128126
</Await>
129-
</GridContainer>
127+
</GridContainer>

admin-client/src/stores/router.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ const initial = {};
55
const { set, subscribe } = writable(initial);
66

77
export default {
8-
setContext: ({ page, ...rest }) => set(rest),
8+
setContext: ({ _, ...rest }) => set(rest),
99
subscribe,
1010
};

0 commit comments

Comments
 (0)