Skip to content
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
45 changes: 0 additions & 45 deletions app/.eslintrc.js

This file was deleted.

38 changes: 24 additions & 14 deletions app/.prettierignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,22 @@
# Logs
# Dependencies
/node_modules

# Production
/build

# Generated files
.docusaurus
.cache-loader
/pr-preview/**/.nojekyll

# Misc
.DS_Store
*.local
coverage
dist
dist-ssr

# Log files
logs
*.log
npm-debug.log*
Expand All @@ -7,23 +25,15 @@ yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

build
node_modules
.DS_Store
dist
dist-ssr
coverage
*.local

/cypress/videos/
/cypress/screenshots/

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
*.iml
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
*.mp4

# Temp Office files
~$*
18 changes: 8 additions & 10 deletions app/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,13 @@ import helmet from 'helmet';
import { join } from 'path';
import querystring from 'querystring';

import { version as appVersion } from './package.json';
import { requestSanitizer } from './src/middleware/requestSanitizer';
import router from './src/routes';
import { Problem } from './src/utils';
import { DEFAULTCORS } from './src/utils/constants/application';
import { getLogger, httpLogger } from './src/utils/log';
import { readIdpList } from './src/utils/utils';
import { state } from './state';
import { requestSanitizer } from './src/middleware/requestSanitizer.ts';
import router from './src/routes/index.ts';
import { Problem } from './src/utils/index.ts';
import { DEFAULTCORS } from './src/utils/constants/application.ts';
import { getLogger, httpLogger } from './src/utils/log.ts';
import { readIdpList } from './src/utils/utils.ts';
import { state } from './state.ts';

import type { NextFunction, Request, Response } from 'express';

Expand Down Expand Up @@ -81,8 +80,7 @@ appRouter.get('/config', (_req: Request, res: Response, next: NextFunction): voi
features: state.features,
...config.get('frontend'),
gitRev: state.gitRev,
idpList: readIdpList(),
version: appVersion
idpList: readIdpList()
});
} catch (err) {
next(err);
Expand Down
36 changes: 15 additions & 21 deletions app/deploy-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ try {
console.log(`${TITLE} is present and up to date`);
}
}
} catch (err) {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
} catch (error) {
console.log(`An error occured while managing ${TITLE}`);
process.exit(1);
}
Expand All @@ -51,8 +52,7 @@ try {
//

/**
* @function buildComponents
* @description Rebuild `nr-permitting-navigator-service-frontend` library
* Rebuild `nr-permitting-navigator-service-frontend` library
*/
function buildComponents() {
if (!existsSync(`${FRONTEND_DIR}/node_modules`)) {
Expand All @@ -65,8 +65,7 @@ function buildComponents() {
}

/**
* @function cleanComponents
* @description Clean `nr-permitting-navigator-service-frontend` library directory
* Clean `nr-permitting-navigator-service-frontend` library directory
*/
function cleanComponents() {
console.log(`Cleaning ${TITLE}...`);
Expand All @@ -83,8 +82,7 @@ function copyDocs() {
}

/**
* @function deployComponents
* @description Redeploy `nr-permitting-navigator-service-frontend` library
* Redeploy `nr-permitting-navigator-service-frontend` library
*/
function deployComponents() {
console.log(`Redeploying ${TITLE}...`);
Expand All @@ -98,14 +96,12 @@ function deployComponents() {
//

/**
* @function runSync
* @description Execute a single shell command where `cmd` is a string
* @param {string} cmd Shell command to run
* @param {string} [cwd] Working directory of the command to run
* Execute a single shell command where `cmd` is a string
* @param cmd Shell command to run
* @param cwd Working directory of the command to run
*/
export function runSync(cmd: string, cwd: string | undefined) {
// eslint-disable-next-line @typescript-eslint/no-var-requires
const { spawnSync } = require('child_process');
const { spawnSync } = require('child_process'); // eslint-disable-line @typescript-eslint/no-require-imports
const parts = cmd.split(/\s+/g);
const opts = {
cwd: cwd || undefined,
Expand All @@ -123,10 +119,9 @@ export function runSync(cmd: string, cwd: string | undefined) {
}

/**
* @function copyFileSync
* @description Copies `source` file to `target` file
* @param {string} source Source file location
* @param {string} target Target file location
* Copies `source` file to `target` file
* @param source Source file location
* @param target Target file location
*/
export function copyFileSync(source: string, target: string) {
let targetFile = target;
Expand All @@ -142,10 +137,9 @@ export function copyFileSync(source: string, target: string) {
}

/**
* @function copyDirRecursiveSync
* @description Recursively copies `source` directory contents to `target` directory
* @param {string} source Source directory location
* @param {string} target Target directory location
* Recursively copies `source` directory contents to `target` directory
* @param source Source directory location
* @param target Target directory location
*/
export function copyDirRecursiveSync(source: string, target: string) {
let files = [];
Expand Down
41 changes: 41 additions & 0 deletions app/eslint.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import eslint from '@eslint/js';
import eslintConfigPrettier from 'eslint-config-prettier';
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
import jsdoc from 'eslint-plugin-jsdoc';
import tseslint from 'typescript-eslint';

export default tseslint.config(
{
ignores: ['coverage/**', 'dist/**', 'jest.config.js', 'node_modules/**', 'sbin/**']
},
{
files: ['**/*.{js,ts}'],
extends: [
// Extensions are order dependent - always apply Prettier last
eslint.configs.recommended,
tseslint.configs.recommended,
tseslint.configs.stylistic,
jsdoc.configs['flat/recommended-typescript'],
eslintPluginPrettierRecommended,
eslintConfigPrettier // Drops conflicting rules
],
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: __dirname //TODO when type:module => import.meta.dirname
}
},
rules: {
'@typescript-eslint/no-require-imports': 'error',
'eol-last': ['error', 'always'],
indent: ['error', 2, { SwitchCase: 1 }],
'linebreak-style': ['error', 'unix'],
'max-len': ['warn', { code: 120, comments: 120, ignoreUrls: true }],
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'warn',
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'warn',
quotes: ['error', 'single'],
'jsdoc/require-jsdoc': 'off', // TODO: Turn this back on later
semi: ['error', 'always']
}
}
);
3 changes: 2 additions & 1 deletion app/knexfile.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import config from 'config';
import { format, parseJSON } from 'date-fns';
import { Knex } from 'knex';

import { type Knex } from 'knex';

import { getLogger } from './src/utils/log';
const log = getLogger(module.filename);
Expand Down
Loading