Skip to content

Commit

Permalink
Enable JSX processing and add Prettier
Browse files Browse the repository at this point in the history
But don't run Prettier on any files yet.
  • Loading branch information
caleb531 committed Aug 21, 2024
1 parent a045ffe commit 98dc3ed
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 4 deletions.
21 changes: 17 additions & 4 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,37 @@
import vitest from "@vitest/eslint-plugin";
import js from '@eslint/js';
import vitest from '@vitest/eslint-plugin';
import prettier from 'eslint-config-prettier';
import globals from 'globals';

/** @type {import('eslint').Linter.Config[]} */
export default [
js.configs.recommended,
prettier,
{
files: ['**/*.js', '**/*.jsx'],
languageOptions: {
globals: {
...globals.browser,
...globals.node
}
},
rules: {
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': 'off'
'no-unused-vars': 'off'
}
},
// Enable parsing of JSX syntax
{
files: ["test/*.js"],
files: ['**/*.jsx'],
languageOptions: {
parserOptions: {
ecmaFeatures: {
jsx: true
}
}
}
},
{
files: ['test/*.js'],
languageOptions: {
globals: {
...vitest.environments.env.globals
Expand Down
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,20 @@
"workbox-window": "^7.1.0"
},
"devDependencies": {
"@eslint/js": "^9.9.0",
"@testing-library/jest-dom": "^6.4.6",
"@types/eslint-config-prettier": "^6.11.3",
"@types/eslint__js": "^8.42.3",
"@types/node": "^20.14.10",
"@vitest/coverage-v8": "^2.0.1",
"@vitest/eslint-plugin": "^1.0.3",
"eslint": "^9.9.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-jest": "^28.8.0",
"globals": "^15.9.0",
"idb-keyval": "^6.2.1",
"jsdom": "^24.1.0",
"prettier": "^3.3.3",
"sass": "^1.77.6",
"vite": "^5.3.3",
"vitest": "^2.0.1",
Expand Down
51 changes: 51 additions & 0 deletions pnpm-lock.yaml

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

9 changes: 9 additions & 0 deletions vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@ export default defineConfig({
// projects domain (e.g. https://projects.calebevans.me/truthy/), we must
// specify . as the base directory to serve from
base: './',
// Enable JSX processing
esbuild: {
// We need to use _m as the imported name so that it doesn't collide with
// explicitly importing _m, while still allowing us to have organizeImports
// strip out "unused" mithril imports
jsxInject: "import _m from 'mithril'",
jsxFactory: '_m',
jsxFragment: '_m.Fragment'
},
plugins: [
VitePWA({
filename: 'service-worker.js',
Expand Down

0 comments on commit 98dc3ed

Please sign in to comment.