chore(vite): use native esm modules and remove vite warning

This commit is contained in:
Paul Chavard 2024-04-24 11:10:30 +02:00
parent b239b6e4ea
commit eba13ab1b5
5 changed files with 63 additions and 59 deletions

View file

@ -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'
}
}
]
};

View file

@ -1,4 +0,0 @@
module.exports = {
singleQuote: true,
trailingComma: 'none'
};

View file

@ -1,4 +1,5 @@
{ {
"type": "module",
"dependencies": { "dependencies": {
"@coldwired/actions": "^0.11.2", "@coldwired/actions": "^0.11.2",
"@coldwired/turbo-stream": "^0.11.1", "@coldwired/turbo-stream": "^0.11.1",
@ -130,5 +131,61 @@
"core-js", "core-js",
"esbuild", "esbuild",
"rollup" "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"
}
}
] ]
} }
}

View file

@ -1,4 +1,4 @@
module.exports = { export default {
plugins: { plugins: {
autoprefixer: {} autoprefixer: {}
} }

View file

@ -7,7 +7,10 @@ import RubyPlugin from 'vite-plugin-ruby';
const plugins = [ const plugins = [
RubyPlugin(), RubyPlugin(),
ViteReact({ jsxRuntime: 'classic' }), 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()) { if (shouldBuildLegacy()) {