Skip to content

Commit

Permalink
Add eslint to server - update deps - fix ui build error
Browse files Browse the repository at this point in the history
  • Loading branch information
jordojordo committed Nov 22, 2024
1 parent 215c7a5 commit c7da0a7
Show file tree
Hide file tree
Showing 5 changed files with 763 additions and 15 deletions.
2 changes: 1 addition & 1 deletion pi/package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ cp package.json $PROJECT_NAME/
echo "Creating the tar.gz archive"
tar -czf $TARGET_ARCHIVE $PROJECT_NAME

# rm -rf $PROJECT_NAME
rm -rf $PROJECT_NAME

echo "Build and transfer complete"
echo "To run the app on the Raspberry Pi:"
Expand Down
138 changes: 138 additions & 0 deletions pi/server/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
import globals from 'globals';

export default [
{ languageOptions: { globals: globals.node } },
{ ignores: ['dist/*', 'node_modules/*'] },
{
'rules': {
'dot-notation': 'off',
'guard-for-in': 'off',
'new-cap': 'off',
'no-empty': 'off',
'no-extra-boolean-cast': 'off',
'no-new': 'off',
'no-plusplus': 'off',
'no-useless-escape': 'off',
'strict': 'off',

'array-bracket-spacing': 'warn',
'arrow-parens': 'warn',
'arrow-spacing': ['warn', {
'before': true,
'after': true
}],
'block-spacing': ['warn', 'always'],
'brace-style': ['warn', '1tbs'],
'comma-dangle': ['warn', 'only-multiline'],
'comma-spacing': 'warn',
'curly': 'warn',
'eqeqeq': 'warn',
'func-call-spacing': ['warn', 'never'],
'implicit-arrow-linebreak': 'warn',
'indent': ['warn', 2],
'keyword-spacing': 'warn',
'lines-between-class-members': ['warn', 'always', { 'exceptAfterSingleLine': true }],
'multiline-ternary': ['warn', 'never'],
'newline-per-chained-call': ['warn', { 'ignoreChainWithDepth': 4 }],
'no-caller': 'warn',
'no-cond-assign': ['warn', 'except-parens'],
'no-console': 'warn',
'no-debugger': 'warn',
'no-eq-null': 'warn',
'no-eval': 'warn',
'no-trailing-spaces': 'warn',
'no-undef': 'warn',
'no-unused-vars': 'warn',
'no-whitespace-before-property': 'warn',
'object-curly-spacing': ['warn', 'always'],
'object-property-newline': 'warn',
'object-shorthand': 'warn',
'padded-blocks': ['warn', 'never'],
'prefer-arrow-callback': 'warn',
'prefer-template': 'warn',
'rest-spread-spacing': 'warn',
'semi': ['warn', 'always'],
'space-before-function-paren': ['warn', 'never'],
'space-infix-ops': 'warn',
'spaced-comment': 'warn',
'switch-colon-spacing': 'warn',
'template-curly-spacing': ['warn', 'always'],
'yield-star-spacing': ['warn', 'both'],

'key-spacing': ['warn', {
'align': {
'beforeColon': false,
'afterColon': true,
'on': 'value',
'mode': 'minimum'
},
'multiLine': {
'beforeColon': false,
'afterColon': true
},
}],

'object-curly-newline': ['warn', {
'ObjectExpression': {
'multiline': true,
'minProperties': 3
},
'ObjectPattern': {
'multiline': true,
'minProperties': 4
},
'ImportDeclaration': {
'multiline': true,
'minProperties': 5
},
'ExportDeclaration': {
'multiline': true,
'minProperties': 3
}
}],

'padding-line-between-statements': [
'warn',
{
'blankLine': 'always',
'prev': '*',
'next': 'return',
},
{
'blankLine': 'always',
'prev': 'function',
'next': 'function',
},
// This configuration would require blank lines after every sequence of variable declarations
{
'blankLine': 'always',
'prev': ['const', 'let', 'var'],
'next': '*'
},
{
'blankLine': 'any',
'prev': ['const', 'let', 'var'],
'next': ['const', 'let', 'var']
}
],

'quotes': [
'warn',
'single',
{
'avoidEscape': true,
'allowTemplateLiterals': true
},
],

'space-unary-ops': [
'warn',
{
'words': true,
'nonwords': false,
}
]
}
}
];

8 changes: 6 additions & 2 deletions pi/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
"scripts": {
"start": "node dist/server.js",
"build": "tsc --outDir dist",
"dev": "nodemon --watch src --ext ts --exec 'node --loader ts-node/esm ./src/server.ts'"
"dev": "nodemon --watch src --ext ts --exec 'node --loader ts-node/esm ./src/server.ts'",
"lint": "npx eslint .",
"format": "npx eslint . --fix"
},
"keywords": [],
"author": "",
Expand All @@ -23,10 +25,12 @@
"@types/cors": "^2.8.17",
"@types/express": "^5.0.0",
"@types/node": "^22.9.1",
"eslint": "^9.15.0",
"globals": "^15.12.0",
"http-proxy-middleware": "^3.0.3",
"nodemon": "^3.1.7",
"ts-node": "^10.9.2",
"ts-node-dev": "^2.0.0",
"typescript": "^5.6.3"
"typescript": "^5.7.2"
}
}
Loading

0 comments on commit c7da0a7

Please sign in to comment.