Skip to content

Commit

Permalink
chore(homepage-legacy): setup linting
Browse files Browse the repository at this point in the history
  • Loading branch information
serjilyashenko committed May 14, 2024
1 parent 95f35f0 commit 690a45e
Show file tree
Hide file tree
Showing 6 changed files with 747 additions and 88 deletions.
12 changes: 10 additions & 2 deletions apps/homepage-legacy/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,19 @@ module.exports = {
env: { browser: true, es2020: true },
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
"plugin:react/recommended",
"plugin:react/jsx-runtime",
'plugin:react-hooks/recommended',
'plugin:@typescript-eslint/recommended-type-checked',
],
ignorePatterns: ['dist', '.eslintrc.cjs'],
ignorePatterns: ['dist', '.eslintrc.cjs', 'public'],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
project: ['./tsconfig.json', './tsconfig.node.json'],
tsconfigRootDir: __dirname,
},
plugins: ['react-refresh'],
rules: {
'react-refresh/only-export-components': [
Expand Down
31 changes: 2 additions & 29 deletions apps/homepage-legacy/README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,3 @@
# React + TypeScript + Vite
# Simple Pie: Homepage-legacy

This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.

Currently, two official plugins are available:

- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh

## Expanding the ESLint configuration

If you are developing a production application, we recommend updating the configuration to enable type aware lint rules:

- Configure the top-level `parserOptions` property like this:

```js
export default {
// other rules...
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
project: ['./tsconfig.json', './tsconfig.node.json'],
tsconfigRootDir: __dirname,
},
}
```

- Replace `plugin:@typescript-eslint/recommended` to `plugin:@typescript-eslint/recommended-type-checked` or `plugin:@typescript-eslint/strict-type-checked`
- Optionally add `plugin:@typescript-eslint/stylistic-type-checked`
- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and add `plugin:react/recommended` & `plugin:react/jsx-runtime` to the `extends` list
Read [here](../../README.md)
14 changes: 3 additions & 11 deletions apps/homepage-legacy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"lint": "tsc",
"lint": "tsc && eslint .",
"lint-legacy": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview"
},
Expand All @@ -20,21 +20,13 @@
"devDependencies": {
"@types/react": "18.2.64",
"@types/react-dom": "18.2.21",
"@typescript-eslint/eslint-plugin": "7.1.1",
"@typescript-eslint/eslint-plugin": "7.9.0",
"@typescript-eslint/parser": "7.1.1",
"@vitejs/plugin-react": "4.2.1",
"eslint": "8.56.0",
"eslint-plugin-react": "7.34.1",
"eslint-plugin-react-hooks": "4.6.0",
"eslint-plugin-react-refresh": "0.4.5",
"typescript": "5.3.3",
"vite": "5.2.8"
},
"eslintConfig": {
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:react-hooks/recommended",
"plugin:@typescript-eslint/recommended"
]
}
}
3 changes: 3 additions & 0 deletions apps/homepage-legacy/src/components/NetworkUseCase.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export const NetworkUseCase = memo(function NetworkUseCase(
},
]);

// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const edges = new DataSet([
{ from: 1, to: 2 },
Expand All @@ -83,8 +84,10 @@ export const NetworkUseCase = memo(function NetworkUseCase(
};
const options = {};

// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
new Network(container, data, options);
// eslint-disable-next-line
}, []);

return <div id="network-container" className="network-container"></div>;
Expand Down
Loading

0 comments on commit 690a45e

Please sign in to comment.