-
Notifications
You must be signed in to change notification settings - Fork 2
Upgrade deps; migrate to Vite #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
59955f4
de20520
b8edd87
92cb8d0
8b39ce3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| import globals from "globals"; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is the eslint config used for? Have you been able to execute it successfully? Is the config just here for VSCode? (doesn't even work there for me...)
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, I broke it when upgrading other deps but I've now restored it. I only added it so the setup across this, react-app and in theory the editor all align to make it easier for ourselves when coding across different projects. |
||
| import pluginJs from "@eslint/js"; | ||
| import tseslint, { parser as tsParser } from "typescript-eslint"; | ||
| import pluginReact from "eslint-plugin-react"; | ||
| import pluginReactHooks from "eslint-plugin-react-hooks"; | ||
| import pluginJsxA11y from "eslint-plugin-jsx-a11y"; | ||
| import { fixupPluginRules } from "@eslint/compat"; | ||
| import path from 'path'; | ||
| import stylistic from '@stylistic/eslint-plugin' | ||
|
|
||
|
|
||
| export default [ | ||
| {files: ["**/*.{js,mjs,cjs,ts,jsx,tsx}"]}, | ||
| {languageOptions: { globals: globals.browser }}, | ||
| pluginJs.configs.recommended, | ||
| ...tseslint.configs.recommended, | ||
| pluginReact.configs.flat.recommended, | ||
| pluginJsxA11y.flatConfigs.strict, | ||
| { | ||
| plugins: { | ||
| "react-hooks": fixupPluginRules(pluginReactHooks), | ||
| '@stylistic': stylistic | ||
| }, | ||
| settings: { | ||
| react: { | ||
| version: "detect" | ||
| } | ||
| }, | ||
| rules: { | ||
| "no-prototype-builtins": "off", | ||
| "prefer-const": "error", | ||
| "semi": "error", | ||
| "@stylistic/indent": ["error", 4, {"SwitchCase": 1}], | ||
| "jsx-a11y/no-static-element-interactions": "error", | ||
| "react-hooks/rules-of-hooks": "error", | ||
| "react-hooks/exhaustive-deps": "error", | ||
| "@typescript-eslint/no-unused-vars": ["error", { | ||
| "argsIgnorePattern": "^_", | ||
| "varsIgnorePattern": "^_" | ||
| }], | ||
| "@typescript-eslint/ban-ts-comment": "off", | ||
| "@typescript-eslint/explicit-function-return-type": "off", | ||
| "@typescript-eslint/no-empty-interface": "error", | ||
| "@typescript-eslint/explicit-module-boundary-types": "off", | ||
| "@typescript-eslint/no-floating-promises": "error", | ||
| "react/jsx-no-target-blank": "off", // https://github.com/isaacphysics/isaac-react-app/pull/1134#discussion_r1774839755 | ||
| }, | ||
| languageOptions: { | ||
| parser: tsParser, | ||
| parserOptions: { | ||
| ecmaFeatures: { | ||
| "jsx": true | ||
| }, | ||
| projectService: true, | ||
| tsconfigRootDir: path.__dirname, | ||
| }, | ||
| } | ||
| } | ||
| ]; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,9 @@ | ||
| import React from 'react'; | ||
| import ReactDOM from 'react-dom'; | ||
|
|
||
| // @ts-ignore | ||
| import "./scss/cs/isaac.scss"; | ||
| import React from "react"; | ||
| import { createRoot } from 'react-dom/client'; | ||
| import { Sandbox } from "./app/Sandbox"; | ||
|
|
||
| ReactDOM.render( | ||
| <Sandbox />, | ||
| document.getElementById("root") | ||
| ); | ||
| const root = createRoot(document.getElementById('root')!); | ||
|
|
||
| root.render(<Sandbox />); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| import { defineConfig } from 'vite'; | ||
| import react from '@vitejs/plugin-react'; | ||
| import checker from 'vite-plugin-checker'; | ||
|
|
||
| export default defineConfig({ | ||
| plugins: [ | ||
| react(), | ||
| checker({ typescript: true }) | ||
| ], | ||
|
|
||
| build: { | ||
| target: 'es2022', | ||
| outDir: 'build', | ||
| emptyOutDir: true, | ||
| assetsInlineLimit: 0, // prevent inlining fonts (breaks content security policy) | ||
| rollupOptions: { | ||
| input: { | ||
| main: `./index.html`, | ||
| }, | ||
| output: { | ||
| entryFileNames: 'assets/[name].[hash].js', | ||
| chunkFileNames: 'assets/[name].[hash].js', | ||
| assetFileNames: 'assets/[name].[hash].[ext]', | ||
| }, | ||
| } | ||
| }, | ||
|
|
||
| css: { | ||
| devSourcemap: true, | ||
| preprocessorOptions: { | ||
| scss: { | ||
| // https://github.com/twbs/bootstrap/issues/40962 – should be able to remove when Bootstrap 6 is available | ||
| silenceDeprecations: ['color-functions', 'global-builtin', 'if-function', 'import'], | ||
| }, | ||
| }, | ||
| }, | ||
|
|
||
| optimizeDeps: { | ||
| exclude: ['@sqlite.org/sqlite-wasm'], // https://www.npmjs.com/package/@sqlite.org/sqlite-wasm | ||
| }, | ||
|
|
||
|
|
||
| mode: process.env.NODE_ENV === 'production' ? 'production' : 'development', | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. shouldn't we set "production" either in
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've only copied this over from the previous config; it seems perfectly fine to leave it here as Vite does accept a mode like this. I suppose we could pass it in via |
||
| }); | ||
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.