Skip to content

Commit

Permalink
fix: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
yamcodes committed Mar 30, 2024
1 parent c8d4313 commit 82da71a
Show file tree
Hide file tree
Showing 23 changed files with 332 additions and 294 deletions.
4 changes: 2 additions & 2 deletions apps/api/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@acme/api",
"name": "api",
"version": "1.0.0",
"files": [
"dist"
Expand Down Expand Up @@ -28,7 +28,7 @@
},
"main": "dist/index.js",
"dependencies": {
"@acme/shared": "workspace:*",
"utilities": "workspace:*",
"@faker-js/faker": "^8.0.1",
"express": "^4.18.2",
"fastify": "^4.26.2",
Expand Down
2 changes: 1 addition & 1 deletion apps/api/src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { iLikeTurtles } from '@acme/shared';
import { iLikeTurtles } from 'utilities';
import { faker } from '@faker-js/faker';
import { type FastifyInstance, type FastifyRequest } from 'fastify';

Expand Down
2 changes: 1 addition & 1 deletion apps/api/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { defineConfig } from 'vite';
import generatePackageJson from 'rollup-plugin-generate-package-json';
import packageJson from './package.json' assert { type: 'json' };

// NOTE: the @acme/shared package cannot be included into the deps casue it will attempt to be installed in
// NOTE: the utilities package cannot be included into the deps casue it will attempt to be installed in
// the firebase function build step and fail, so as a work around we are using a bundler to move the code into the final bundle that we ship to firebase

// NOTE: we are using vite for bundling but "native" support for nodejs is not yet available
Expand Down
9 changes: 9 additions & 0 deletions apps/web/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/** @type {import("eslint").Linter.Config} */
module.exports = {
root: true,
extends: ["custom/react"],
parser: "@typescript-eslint/parser",
parserOptions: {
project: true,
},
};
6 changes: 4 additions & 2 deletions apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,21 @@
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview",
"deploy": "firebase deploy --only hosting",
"clean": "rimraf node_modules dist"
},
"dependencies": {
"@acme/shared": "*",
"react": "^18.2.0",
"react-dom": "^18.2.0"
"react-dom": "^18.2.0",
"utilities": "workspace:*"
},
"devDependencies": {
"@types/react": "^18.2.6",
"@types/react-dom": "^18.2.4",
"@vitejs/plugin-react": "^4.0.0",
"eslint": "^8.41.0",
"vite": "^5.0.0"
}
}
25 changes: 14 additions & 11 deletions apps/web/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,48 +1,51 @@
import { useEffect, useState } from 'react';
import { iLikeTurtles } from '@acme/shared';
import { iLikeTurtles } from 'utilities';

import './App.css';

function App() {
const App = () => {
const [data, setData] = useState({});
useEffect(() => {
fetch('/api/test')
void fetch('/api/test')
.then((res) => res.json())
.then((res) => setData(res));
.then((res) => {
// TODO: we need a stronger contract with the backend
setData(res as Record<string, unknown>);
});
}, []);

return (
<div className="App">
<header className="header">
<div className="icon-wrap">
<img className="icon-firebase" src="/firebase.svg" />
<img className="icon-firebase" src="/firebase.svg" alt="firebase" />
<div className="icon-divider">+</div>
<img className="icon-turbo" src="/turborepo.svg" />
<img className="icon-turbo" src="/turborepo.svg" alt="turborepo" />
</div>
<div>
<div style={{ textAlign: 'left' }}>
<p style={{ fontWeight: 'bold' }}>From apps/api (@acme/api)</p>
<p style={{ fontWeight: 'bold' }}>From apps/api (api)</p>
<pre>{JSON.stringify(data, null, 2)}</pre>
</div>
<div style={{ textAlign: 'left' }}>
<p style={{ fontWeight: 'bold' }}>
From packages/shared (@acme/shared)
From packages/shared (utilities)
</p>
<pre>{JSON.stringify(iLikeTurtles())}</pre>
</div>
<div style={{ textAlign: 'left' }}>
<p style={{ fontWeight: 'bold' }}>Source code</p>
<a
style={{ color: 'lightblue' }}
href="https://github.com/Hacksore/turborepo-firebase-example"
href="https://github.com/yamcodes/turborepo-firebase-example"
>
https://github.com/Hacksore/turborepo-firebase-example
https://github.com/yamcodes/turborepo-firebase-example
</a>
</div>
</div>
</header>
</div>
);
}
};

export default App;
16 changes: 10 additions & 6 deletions apps/web/src/main.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import React from 'react';
import ReactDOM from 'react-dom/client';
import App from './App';
import { StrictMode } from 'react';
import { createRoot } from 'react-dom/client';
import App from './app';
import './index.css';

ReactDOM.createRoot(document.getElementById('root')!).render(
<React.StrictMode>
const container = document.getElementById('root');

if (!container) throw new Error('Failed to find the root element');

createRoot(container).render(
<StrictMode>
<App />
</React.StrictMode>
</StrictMode>
);
25 changes: 9 additions & 16 deletions apps/web/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,14 @@
{
"compilerOptions": {
"target": "ESNext",
"useDefineForClassFields": true,
"lib": ["DOM", "DOM.Iterable", "ESNext"],
"allowJs": false,
"skipLibCheck": true,
"esModuleInterop": false,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"module": "ESNext",
"moduleResolution": "Node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx"
"paths": {
"react": ["./node_modules/@types/react"],
"react-dom": ["./node_modules/@types/react-dom"],
"react/jsx-runtime": ["./node_modules/@types/react/jsx-runtime"],
"@/*": ["./src/*"]
}
},
"include": ["src"],
"extends": "tsconfig/react.json",
"include": ["."],
"exclude": ["dist", "build", "node_modules"],
"references": [{ "path": "./tsconfig.node.json" }]
}
9 changes: 6 additions & 3 deletions apps/web/tsconfig.node.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
{
"compilerOptions": {
"composite": true,
"module": "esnext",
"moduleResolution": "node"
"skipLibCheck": true,
"module": "ESNext",
"moduleResolution": "bundler",
"allowSyntheticDefaultImports": true,
"strict": true
},
"include": ["vite.config.ts"]
"include": ["vite.config.ts", ".eslintrc.cjs"]
}
12 changes: 0 additions & 12 deletions packages/config/eslint-preset.js

This file was deleted.

17 changes: 0 additions & 17 deletions packages/config/package.json

This file was deleted.

7 changes: 0 additions & 7 deletions packages/eslint-config-custom/CHANGELOG.md

This file was deleted.

1 change: 0 additions & 1 deletion packages/shared/src/index.ts

This file was deleted.

3 changes: 0 additions & 3 deletions packages/tsconfig-legacy/README.md

This file was deleted.

20 changes: 0 additions & 20 deletions packages/tsconfig-legacy/base.json

This file was deleted.

14 changes: 0 additions & 14 deletions packages/tsconfig-legacy/package.json

This file was deleted.

3 changes: 2 additions & 1 deletion packages/tsconfig/base.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
"skipLibCheck": true,
"strict": true,
"noUncheckedIndexedAccess": true,
"noImplicitAny": true
"noImplicitAny": true,
"noEmit": true
},
"exclude": ["node_modules"]
}
9 changes: 9 additions & 0 deletions packages/utilities/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/** @type {import("eslint").Linter.Config} */
module.exports = {
root: true,
extends: ['custom/node'],
parser: '@typescript-eslint/parser',
parserOptions: {
project: true,
},
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@acme/shared",
"name": "utilities",
"version": "0.0.0",
"private": true,
"type": "module",
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions packages/utilities/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './i-like-turtles';
5 changes: 5 additions & 0 deletions packages/utilities/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extends": "tsconfig/base.json",
"include": ["."],
"exclude": ["dist", "build", "node_modules"]
}
Loading

0 comments on commit 82da71a

Please sign in to comment.