Skip to content

Commit

Permalink
Merge pull request #735 from SignalK/frontend_lint
Browse files Browse the repository at this point in the history
Lint and Reformat frontend files
  • Loading branch information
mairas authored Aug 25, 2024
2 parents 318e26a + 227eb9c commit 474cda8
Show file tree
Hide file tree
Showing 24 changed files with 229 additions and 173 deletions.
46 changes: 0 additions & 46 deletions frontend/.eslintrc.js

This file was deleted.

1 change: 1 addition & 0 deletions frontend/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ dist-ssr
*.njsproj
*.sln
*.sw?
.vite

# Bootstrap CSS files are generated with "npm run css"
css/styles.css*
12 changes: 12 additions & 0 deletions frontend/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import pluginJs from "@eslint/js";
import globals from "globals";
import tseslint from "typescript-eslint";



export default [
{files: ["**/*.{js,mjs,cjs,ts,jsx,tsx}"]},
{languageOptions: { globals: globals.browser }},
pluginJs.configs.recommended,
...tseslint.configs.recommended,
];
7 changes: 5 additions & 2 deletions frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "sensesp-frontend",
"private": true,
"type": "module",
"type": "commonjs",
"scripts": {
"dev": "vite",
"build": "vite build",
Expand All @@ -11,7 +11,7 @@
"css": "pnpm run css-compile && pnpm run css-prefix",
"preview": "vite preview",
"type-check": "tsc --noEmit",
"lint": "eslint --fix --ext .js,.jsx,.ts,.tsx ./src",
"lint": "eslint --fix ./src",
"format": "prettier --write ./src",
"purgecss": "node ./node_modules/purgecss/bin/purgecss.js --config ./purgecss.config.js",
"fix": "pnpm run format && pnpm run type-check && pnpm run lint"
Expand All @@ -24,6 +24,7 @@
"preact-router": "^4.1.2"
},
"devDependencies": {
"@eslint/js": "^9.9.1",
"@originjs/vite-plugin-federation": "^1.3.5",
"@preact/preset-vite": "^2.9.0",
"@types/bootstrap": "^5.2.10",
Expand All @@ -39,6 +40,7 @@
"eslint-plugin-preact": "^0.1.0",
"eslint-plugin-promise": "^7.1.0",
"eslint-plugin-react": "^7.35.0",
"globals": "^15.9.0",
"jest": "^29.7.0",
"postcss": "^8.4.41",
"postcss-cli": "^11.0.0",
Expand All @@ -49,6 +51,7 @@
"sass": "^1.77.8",
"sass-loader": "^16.0.0",
"typescript": "^5.5.4",
"typescript-eslint": "^8.2.0",
"vite": "^5.4.0",
"vite-plugin-mock-dev-server": "^1.7.0",
"vite-tsconfig-paths": "^5.0.1"
Expand Down
158 changes: 158 additions & 0 deletions frontend/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ interface RedirectProps {
to: string;
}

function Redirect({ path, to }: RedirectProps): JSX.Element {
function Redirect({ to }: RedirectProps): JSX.Element {
useEffect(() => {
route(to);
// Also update the browser URL
Expand All @@ -61,7 +61,7 @@ export function App(): JSX.Element {
const data = await res.json();
setRoutes(data);

let populatedRoutes: RouteInstruction[] = [];
const populatedRoutes: RouteInstruction[] = [];
for (const route of data) {
if (route.loadPath) {
const remoteInfo = {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/common/InputDirtyContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ export interface InputDirtyContextType {

export const InputDirtyContext = createContext<InputDirtyContextType>({
isInputDirty: false,
setInputDirty: (v) => {},
setInputDirty: () => {},
});
Loading

0 comments on commit 474cda8

Please sign in to comment.