Skip to content

Commit

Permalink
Merge pull request #141 from bcgov/format/prettier
Browse files Browse the repository at this point in the history
Formatter, package/security updates, tsconfig build updates
  • Loading branch information
TimCsaky authored Oct 26, 2023
2 parents b597f7e + 7b5bb13 commit 3a68ba9
Show file tree
Hide file tree
Showing 133 changed files with 3,582 additions and 3,433 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ yarn-error.log*

# Editor directories and files
.idea
.vscode
*.iml
*.suo
*.ntvs*
Expand Down
5 changes: 4 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
{
"recommendations": [
"bierner.markdown-preview-github-styles",
"davidanson.vscode-markdownlint",
"dbaeumer.vscode-eslint",
"eamodio.gitlens",
"editorconfig.editorconfig",
"esbenp.prettier-vscode",
"redhat.vscode-yaml",
"ryanluker.vscode-coverage-gutters",
"vue.volar",
"vue.vscode-typescript-vue-plugin",
"vue.vscode-typescript-vue-plugin"
]
}
26 changes: 26 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"[html]": {
"editor.defaultFormatter": "vscode.html-language-features"
},
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[json]": {
"editor.defaultFormatter": "vscode.json-language-features"
},
"[jsonc]": {
"editor.defaultFormatter": "vscode.json-language-features"
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[vue]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"coverage-gutters.showGutterCoverage": false,
"coverage-gutters.showLineCoverage": true,
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
"editor.formatOnSave": true,
"eslint.format.enable": true,
"files.insertFinalNewline": true
}
30 changes: 12 additions & 18 deletions app/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
/* eslint-env node */
require('@rushstack/eslint-patch/modern-module-resolution');

module.exports = {
root: true,
env: {
browser: true,
es2020: true,
jest: true,
node: true,
node: true
},
extends: [
'prettier',
'eslint:recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended'
Expand All @@ -19,30 +17,26 @@ module.exports = {
SharedArrayBuffer: 'readonly',
_: false
},
parserOptions: {
ecmaVersion: 11,
},
plugins: [
'@typescript-eslint',
],
plugins: ['@typescript-eslint'],
rules: {
'eol-last': ['error', 'always'],
indent: ['error', 2, {
'SwitchCase': 1
}],
indent: [
'error',
2,
{
SwitchCase: 1
}
],
'linebreak-style': ['error', 'unix'],
'max-len': ['warn', { 'code': 100, 'comments': 120, 'ignoreUrls': true }],
'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'],
semi: ['error', 'always']
},
overrides: [
{
files: [
'**/__tests__/*.{j,t}s?(x)',
'**/tests/unit/**/*.spec.{j,t}s?(x)'
],
files: ['**/__tests__/*.{j,t}s?(x)', '**/tests/unit/**/*.spec.{j,t}s?(x)'],
env: {
jest: true
}
Expand Down
29 changes: 29 additions & 0 deletions app/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
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
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
13 changes: 13 additions & 0 deletions app/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"arrowParens": "always",
"bracketSameLine": false,
"bracketSpacing": true,
"htmlWhitespaceSensitivity": "ignore",
"printWidth": 120,
"semi": true,
"singleAttributePerLine": true,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "none",
"useTabs": false
}
13 changes: 2 additions & 11 deletions app/frontend-utils.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
// This script attempts to gracefully rebuild and update bcbox-frontend if necessary
/* eslint-disable no-console */
import {
existsSync,
lstatSync,
mkdirSync,
readdirSync,
readFileSync,
rmSync,
statSync,
writeFileSync
} from 'fs';
import { existsSync, lstatSync, mkdirSync, readdirSync, readFileSync, rmSync, statSync, writeFileSync } from 'fs';
import { basename, join } from 'path';

const FRONTEND_DIR = '../frontend';
Expand Down Expand Up @@ -155,7 +146,7 @@ export function copyDirRecursiveSync(source: string, target: string) {
// Copy
if (lstatSync(source).isDirectory()) {
files = readdirSync(source);
files.forEach(file => {
files.forEach((file) => {
const curSource = join(source, file);
if (lstatSync(curSource).isDirectory()) {
copyDirRecursiveSync(curSource, targetFolder);
Expand Down
Loading

0 comments on commit 3a68ba9

Please sign in to comment.