From eba13ab1b5a0a84a5ae92ad53bbb24adf68423de Mon Sep 17 00:00:00 2001 From: Paul Chavard Date: Wed, 24 Apr 2024 11:10:30 +0200 Subject: [PATCH] chore(vite): use native esm modules and remove vite warning --- .eslintrc.js | 52 ----------------------------------------- .prettierrc.js | 4 ---- package.json | 59 ++++++++++++++++++++++++++++++++++++++++++++++- postcss.config.js | 2 +- vite.config.ts | 5 +++- 5 files changed, 63 insertions(+), 59 deletions(-) delete mode 100644 .eslintrc.js delete mode 100644 .prettierrc.js diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index aa165d0b6..000000000 --- a/.eslintrc.js +++ /dev/null @@ -1,52 +0,0 @@ -module.exports = { - root: true, - parser: '@typescript-eslint/parser', - globals: { - process: true, - gon: true - }, - plugins: ['prettier', 'react-hooks'], - extends: [ - 'eslint:recommended', - 'prettier', - 'plugin:react/recommended', - 'plugin:react-hooks/recommended' - ], - env: { - es6: true, - browser: true - }, - rules: { - 'prettier/prettier': 'error', - 'react-hooks/rules-of-hooks': 'error', - 'react-hooks/exhaustive-deps': 'error', - 'react/prop-types': 'off', - 'react/no-deprecated': 'off' - }, - settings: { - react: { version: 'detect' } - }, - overrides: [ - { - files: ['.eslintrc.js', 'vite.config.ts', 'postcss.config.js'], - env: { node: true } - }, - { - files: ['**/*.ts', '**/*.tsx'], - plugins: ['@typescript-eslint'], - extends: [ - 'eslint:recommended', - 'plugin:@typescript-eslint/recommended', - 'plugin:react-hooks/recommended', - 'prettier' - ], - rules: { - 'prettier/prettier': 'error', - 'react-hooks/rules-of-hooks': 'error', - 'react-hooks/exhaustive-deps': 'error', - '@typescript-eslint/no-explicit-any': 'error', - '@typescript-eslint/no-unused-vars': 'error' - } - } - ] -}; diff --git a/.prettierrc.js b/.prettierrc.js deleted file mode 100644 index f0722fd99..000000000 --- a/.prettierrc.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - singleQuote: true, - trailingComma: 'none' -}; diff --git a/package.json b/package.json index 4186d3462..b42172e48 100644 --- a/package.json +++ b/package.json @@ -1,4 +1,5 @@ { + "type": "module", "dependencies": { "@coldwired/actions": "^0.11.2", "@coldwired/turbo-stream": "^0.11.1", @@ -130,5 +131,61 @@ "core-js", "esbuild", "rollup" - ] + ], + "prettier": { + "singleQuote": true, + "trailingComma": "none" + }, + "eslintConfig": { + "root": true, + "parser": "@typescript-eslint/parser", + "globals": { + "process": true, + "gon": true + }, + "plugins": ["prettier", "react-hooks"], + "extends": [ + "eslint:recommended", + "prettier", + "plugin:react/recommended", + "plugin:react-hooks/recommended" + ], + "env": { + "es6": true, + "browser": true + }, + "rules": { + "prettier/prettier": "error", + "react-hooks/rules-of-hooks": "error", + "react-hooks/exhaustive-deps": "error", + "react/prop-types": "off", + "react/no-deprecated": "off" + }, + "settings": { + "react": { "version": "detect" } + }, + "overrides": [ + { + "files": [".eslintrc.js", "vite.config.ts", "postcss.config.js"], + "env": { "node": true } + }, + { + "files": ["**/*.ts", "**/*.tsx"], + "plugins": ["@typescript-eslint"], + "extends": [ + "eslint:recommended", + "plugin:@typescript-eslint/recommended", + "plugin:react-hooks/recommended", + "prettier" + ], + "rules": { + "prettier/prettier": "error", + "react-hooks/rules-of-hooks": "error", + "react-hooks/exhaustive-deps": "error", + "@typescript-eslint/no-explicit-any": "error", + "@typescript-eslint/no-unused-vars": "error" + } + } + ] + } } diff --git a/postcss.config.js b/postcss.config.js index 5bfb8f628..8c589bbe1 100644 --- a/postcss.config.js +++ b/postcss.config.js @@ -1,4 +1,4 @@ -module.exports = { +export default { plugins: { autoprefixer: {} } diff --git a/vite.config.ts b/vite.config.ts index fb29eb6e3..30cff164b 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -7,7 +7,10 @@ import RubyPlugin from 'vite-plugin-ruby'; const plugins = [ RubyPlugin(), ViteReact({ jsxRuntime: 'classic' }), - FullReload(['config/routes.rb', 'app/views/**/*', 'app/components/**/*.haml'], { delay: 200 }) + FullReload( + ['config/routes.rb', 'app/views/**/*', 'app/components/**/*.haml'], + { delay: 200 } + ) ]; if (shouldBuildLegacy()) {