Skip to content

Commit

Permalink
chore: update eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
ElMassimo committed Nov 16, 2023
1 parent ecf132d commit 84c3a12
Show file tree
Hide file tree
Showing 17 changed files with 896 additions and 1,526 deletions.
6 changes: 0 additions & 6 deletions .estlintrc.json

This file was deleted.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ Add it to your plugins in `vite.config.js`

```ts
// vite.config.js
import StimulusHMR from 'vite-plugin-stimulus-hmr'
import StimulusHMR from 'vite-plugin-stimulus-hmr'

export default {
plugins: [
StimulusHMR(),
],
};
}
```

You should now enjoy HMR for your Stimulus controllers! 🚀
Expand Down
13 changes: 13 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import eslint from '@antfu/eslint-config'

export default [
...eslint(),
{
rules: {
'no-console': 'off',
'node/prefer-global/process': 'off',
'style/space-before-function-paren': ['error', 'always'],
'antfu/if-newline': 'off',
},
},
]
2 changes: 1 addition & 1 deletion example/components/home_controller.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Controller } from '@hotwired/stimulus'

export default class extends Controller {
connect() {
connect () {
console.log('Home 🏠', this.element)
}
}
4 changes: 2 additions & 2 deletions example/controllers/hello_controller.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { Controller } from '@hotwired/stimulus'

export default class extends Controller {
connect() {
connect () {
console.log('Stimulus with Vite.js ⚡️', this.element)
this.originalText = this.element.textContent
this.element.textContent = 'Stimulus with Vite.js'
}

disconnect() {
disconnect () {
this.element.textContent = this.originalText
}
}
4 changes: 2 additions & 2 deletions example/controllers/image/reveal_controller.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { Controller } from '@hotwired/stimulus'

export default class extends Controller {
connect() {
connect () {
console.log('Revealing Image', this.element)
this.element.classList.remove('hidden')
}

disconnect() {
disconnect () {
console.log('Hiding Image', this.element)
this.element.classList.add('hidden')
}
Expand Down
4 changes: 2 additions & 2 deletions example/package.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"name": "vite-plugin-stimulus-hmr-example",
"type": "module",
"version": "0.0.0",
"private": true,
"license": "MIT",
"type": "module",
"scripts": {
"dev": "cross-env DEBUG=stimulus-hmr:* vite",
"build": "cross-env DEBUG=stimulus-hmr:* vite build --mode production",
"preview": "cross-env RAILS_ENV=production DEBUG=stimulus-hmr:* vite preview"
},
"devDependencies": {
"cross-env": "^7.0.3",
"@hotwired/stimulus": "^3.0.1",
"cross-env": "^7.0.3",
"typescript": "^4.1.3",
"vite": "^5",
"vite-plugin-stimulus-hmr": "workspace:*"
Expand Down
8 changes: 4 additions & 4 deletions example/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"compilerOptions": {
"module": "esnext",
"target": "es2020",
"lib": ["ESNext", "DOM"],
"esModuleInterop": true,
"strict": true,
"strictNullChecks": true,
"module": "esnext",
"moduleResolution": "Node",
"resolveJsonModule": true,
"strict": true,
"strictNullChecks": true,
"esModuleInterop": true,
"skipLibCheck": true
},
"exclude": [
Expand Down
3 changes: 2 additions & 1 deletion example/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { defineConfig } from 'vite'
import { defineConfig, splitVendorChunkPlugin } from 'vite'
import StimulusHMR from 'vite-plugin-stimulus-hmr'

export default defineConfig({
plugins: [
splitVendorChunkPlugin(),
StimulusHMR(),
],
})
48 changes: 22 additions & 26 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,29 +1,15 @@
{
"name": "vite-plugin-stimulus-hmr",
"description": "HMR for Stimulus controllers in Vite.js, tweak your JS without refreshing the page.",
"version": "3.0.0",
"files": [
"dist"
],
"sideEffects": false,
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": {
".": {
"require": "./dist/index.cjs",
"import": "./dist/index.js",
"types": "./dist/index.d.ts"
}
},
"license": "MIT",
"version": "3.0.0",
"description": "HMR for Stimulus controllers in Vite.js, tweak your JS without refreshing the page.",
"author": "Máximo Mussini <[email protected]>",
"license": "MIT",
"homepage": "https://github.com/ElMassimo/vite-plugin-stimulus-hmr",
"repository": {
"type": "git",
"url": "https://github.com/ElMassimo/vite-plugin-stimulus-hmr"
},
"homepage": "https://github.com/ElMassimo/vite-plugin-stimulus-hmr",
"bugs": "https://github.com/ElMassimo/vite-plugin-stimulus-hmr/issues",
"keywords": [
"plugin",
Expand All @@ -35,6 +21,20 @@
"vite-plugin",
"vitejs"
],
"sideEffects": false,
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js",
"require": "./dist/index.cjs"
}
},
"main": "./dist/index.cjs",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"files": [
"dist"
],
"scripts": {
"lint": "eslint .",
"test": "vitest --config example/vite.config.ts",
Expand All @@ -51,11 +51,12 @@
"stimulus-vite-helpers": "^3.0.1"
},
"devDependencies": {
"@mussi/eslint-config": "^0.5.1",
"@antfu/eslint-config": "^1.1.4",
"@types/debug": "^4.1.12",
"@types/node": "^18.18.9",
"@typescript-eslint/eslint-plugin": "^4.33.0",
"eslint": "^7.32.0",
"@typescript-eslint/eslint-plugin": "^6.10.0",
"eslint": "^8.53.0",
"eslint-define-config": "^1.24.1",
"fast-glob": "^3.3.2",
"happy-dom": "^2.55.0",
"rollup": "^4.4.1",
Expand All @@ -64,10 +65,5 @@
"typescript": "^4.9.5",
"vite": "^5.0.0",
"vitest": "^0.34.6"
},
"eslintConfig": {
"extends": [
"@mussi/eslint-config"
]
}
}
Loading

0 comments on commit 84c3a12

Please sign in to comment.