Skip to content

Commit

Permalink
ESLint and Prettier (#100)
Browse files Browse the repository at this point in the history
* updating eslint

* linting remediation

* prettier

* prettier fixes
  • Loading branch information
eebbesen authored Oct 8, 2024
1 parent f928364 commit f6170ef
Show file tree
Hide file tree
Showing 19 changed files with 1,159 additions and 1,374 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,10 @@ To have linter fix what it can
npm run lint -- --fix
```

### Prettier
```bash
npm run prettier
```

# Appendix

Expand Down
3 changes: 0 additions & 3 deletions nephridium/.eslintrc.js

This file was deleted.

6 changes: 6 additions & 0 deletions nephridium/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Ignore artifacts:
build
coverage
mochawesome-report
package.json
package-lock.json
3 changes: 3 additions & 0 deletions nephridium/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"singleQuote": true
}
11 changes: 8 additions & 3 deletions nephridium/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,21 @@ export function buildErrors(params) {
response += 'You must supply a time_column parameter.';
}
if (typeof params.url === 'undefined') {
if (response.length > 0) { response += ' '; }
response += 'You must supply a url parameter. Make sure the url parameter is last.';
if (response.length > 0) {
response += ' ';
}
response +=
'You must supply a url parameter. Make sure the url parameter is last.';
}

return response;
}

// arcGis or Socrata
export function helper(params) {
return params && params.provider && params.provider === 'arcGis' ? arcGis : socrata;
return params && params.provider && params.provider === 'arcGis'
? arcGis
: socrata;
}

// return object with only query filter params
Expand Down
3 changes: 1 addition & 2 deletions nephridium/arc_gis.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export function transform(json) {
}

export function buildDateFilter(timeColumn, timeRange) {
const lookback = (timeRange && timeRange === 'w') ? 7 : 30;
const lookback = timeRange && timeRange === 'w' ? 7 : 30;
return `${timeColumn}%20%3E%20CURRENT_TIMESTAMP%20-%20INTERVAL%20%27${lookback}%27%20DAY`;
}

Expand All @@ -35,4 +35,3 @@ export function buildUrl(params) {

return `${baseUrl}/0/query?where=${dateFilter}${otherSearchParams}&orderByFields=${timeColumn}%20DESC&outFields=*&f=json`;
}

3 changes: 1 addition & 2 deletions nephridium/assets/nephridium.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
*:not(.footerElement) {
border-collapse: collapse;
padding: 5px;
font-family: helvetica;;
font-family: helvetica;
}

th {
Expand Down Expand Up @@ -82,4 +82,3 @@ table {
display: flex;
justify-content: center;
}

8 changes: 4 additions & 4 deletions nephridium/assets/nephridium.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ function exportTableToCSV(filename) {
const rows = document.querySelectorAll('table tr');

for (let i = 0; i < rows.length; i++) {
const row = []; const
cols = rows[i].querySelectorAll('td, th');
const row = [];
const cols = rows[i].querySelectorAll('td, th');

for (let j = 0; j < cols.length; j++) {
row.push(cols[j].innerText);
Expand Down Expand Up @@ -33,9 +33,9 @@ function toggleFilterDisplay() {
const style = document.getElementById('filters').style.display;
if (style && style == 'block') {
document.getElementById('filters').style.display = 'none';
const b = document.getElementById('toggleFilters').innerText = 'Show Filters';
document.getElementById('toggleFilters').innerText = 'Show Filters';
} else {
document.getElementById('filters').style.display = 'block';
const b = document.getElementById('toggleFilters').innerText = 'Hide Filters';
document.getElementById('toggleFilters').innerText = 'Hide Filters';
}
}
2 changes: 1 addition & 1 deletion nephridium/data_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export function transformData(data) {
row[k] = row[k].replace('T', ' ');
}

if (k == ('location')) {
if (k == 'location') {
row[k] = mapIt(row[k]);
}
}
Expand Down
15 changes: 15 additions & 0 deletions nephridium/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import globals from 'globals';
import pluginJs from '@eslint/js';
import babelParser from '@babel/eslint-parser';

export default [
{ languageOptions: { globals: globals.browser } },
pluginJs.configs.recommended,
{ ignores: ['.config/*', 'mochawesome-report/*', 'assets/**.css'] },
{
languageOptions: {
parser: babelParser,
parserOptions: { requireConfigFile: false },
},
},
];
Loading

0 comments on commit f6170ef

Please sign in to comment.