diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index 34af3774f..000000000 --- a/.eslintignore +++ /dev/null @@ -1,2 +0,0 @@ -build/*.js -config/*.js diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 361cff5f2..000000000 --- a/.eslintrc.js +++ /dev/null @@ -1,27 +0,0 @@ -module.exports = { - root: true, - parserOptions: { - parser: '@babel/eslint-parser', - sourceType: 'module' - }, - // https://github.com/feross/standard/blob/master/RULES.md#javascript-standard-style - extends: [ - 'standard', - 'plugin:vue/recommended' - ], - // required to lint *.vue files - plugins: [ - 'vue' - ], - // add your custom rules here - rules: { - // allow paren-less arrow functions - 'arrow-parens': 0, - // allow async-await - 'generator-star-spacing': 0, - // allow debugger during development - 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0, - 'vue/require-prop-types': 0, - 'vue/multi-word-component-names': 0 - } -} diff --git a/build/utils.js b/build/utils.js index c094c3c87..02fa2f724 100644 --- a/build/utils.js +++ b/build/utils.js @@ -34,26 +34,18 @@ exports.cssLoaders = function (options) { use: generateLoaders(['css-loader', 'postcss-loader', 'less-loader']), }, { - test: /\.sass$/, + test: /\.scss$/, use: generateLoaders([ 'css-loader', 'postcss-loader', { loader: 'sass-loader', options: { - indentedSyntax: true + api: 'modern' } } ]) - }, - { - test: /\.scss$/, - use: generateLoaders(['css-loader', 'postcss-loader', 'sass-loader']) - }, - { - test: /\.styl(us)?$/, - use: generateLoaders(['css-loader', 'postcss-loader', 'stylus-loader']), - }, + } ] } diff --git a/build/webpack.base.conf.js b/build/webpack.base.conf.js index 7e69352a6..72b4ac0a6 100644 --- a/build/webpack.base.conf.js +++ b/build/webpack.base.conf.js @@ -108,8 +108,9 @@ module.exports = { filename: 'sw-pleroma.js' }), new ESLintPlugin({ - extensions: ['js', 'vue'], - formatter: require('eslint-formatter-friendly') + formatter: require('eslint-formatter-friendly'), + overrideConfigFile: path.resolve(__dirname, '..', 'eslint.config.mjs'), + configType: 'flat' }), new StylelintPlugin({}), new VueLoaderPlugin(), diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 000000000..c103904aa --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,37 @@ +import vue from "eslint-plugin-vue"; +import js from "@eslint/js"; +import globals from "globals"; + + +export default [ + ...vue.configs['flat/recommended'], + js.configs.recommended, + { + files: ["**/*.js", "**/*.mjs", "**/*.vue"], + ignores: ["build/*.js", "config/*.js"], + + languageOptions: { + ecmaVersion: 2024, + sourceType: "module", + + parserOptions: { + parser: "@babel/eslint-parser", + }, + globals: { + ...globals.browser, + ...globals.mocha, + ...globals.chai, + ...globals.commonjs, + ...globals.serviceworker + } + }, + + rules: { + 'arrow-parens': 0, + 'generator-star-spacing': 0, + 'no-debugger': 0, + 'vue/require-prop-types': 0, + 'vue/multi-word-component-names': 0, + } + } +] diff --git a/package.json b/package.json index 8cb74ce40..4a3ad2a59 100644 --- a/package.json +++ b/package.json @@ -12,8 +12,8 @@ "e2e": "node test/e2e/runner.js", "test": "yarn run unit && yarn run e2e", "stylelint": "yarn exec stylelint '**/*.scss' '**/*.vue'", - "lint": "eslint --ext .js,.vue src test/unit/specs test/e2e/specs", - "lint-fix": "eslint --fix --ext .js,.vue src test/unit/specs test/e2e/specs" + "lint": "eslint src test/unit/specs test/e2e/specs", + "lint-fix": "eslint --fix src test/unit/specs test/e2e/specs" }, "dependencies": { "@babel/runtime": "7.26.7", @@ -32,6 +32,7 @@ "click-outside-vue3": "4.0.1", "cropperjs": "1.6.2", "escape-html": "1.0.3", + "globals": "^15.14.0", "hash-sum": "^2.0.0", "js-cookie": "3.0.5", "localforage": "1.10.0", @@ -74,14 +75,14 @@ "css-loader": "7.1.2", "css-minimizer-webpack-plugin": "7.0.0", "custom-event-polyfill": "1.0.7", - "eslint": "8.57.1", + "eslint": "9.19.0", "eslint-config-standard": "17.1.0", "eslint-formatter-friendly": "7.0.0", "eslint-plugin-import": "2.31.0", "eslint-plugin-n": "15.7.0", "eslint-plugin-promise": "6.6.0", "eslint-plugin-vue": "9.32.0", - "eslint-webpack-plugin": "3.2.0", + "eslint-webpack-plugin": "4.2.0", "eventsource-polyfill": "0.9.6", "express": "4.21.2", "function-bind": "1.1.2", diff --git a/src/App.js b/src/App.js index ca218cfff..1c1b3a8c2 100644 --- a/src/App.js +++ b/src/App.js @@ -47,10 +47,10 @@ export default { mobileActivePanel: 'timeline' }), watch: { - themeApplied (value) { + themeApplied () { this.removeSplash() }, - layoutType (value) { + layoutType () { document.getElementById('modal').classList = ['-' + this.layoutType] } }, diff --git a/src/boot/after_store.js b/src/boot/after_store.js index 680aec14d..dbbbdb2e4 100644 --- a/src/boot/after_store.js +++ b/src/boot/after_store.js @@ -79,7 +79,7 @@ const getInstanceConfig = async ({ store }) => { } } -const getBackendProvidedConfig = async ({ store }) => { +const getBackendProvidedConfig = async () => { try { const res = await window.fetch('/api/pleroma/frontend_configurations') if (res.ok) { diff --git a/src/boot/routes.js b/src/boot/routes.js index 66d937c8e..da87c6c61 100644 --- a/src/boot/routes.js +++ b/src/boot/routes.js @@ -43,7 +43,7 @@ export default (store) => { { name: 'root', path: '/', - redirect: _to => { + redirect: () => { return (store.state.users.currentUser ? store.state.instance.redirectRootLogin : store.state.instance.redirectRootNoLogin) || '/main/all' diff --git a/src/components/attachment/attachment.js b/src/components/attachment/attachment.js index 2bf6b846f..21d793930 100644 --- a/src/components/attachment/attachment.js +++ b/src/components/attachment/attachment.js @@ -145,7 +145,7 @@ const Attachment = { window.open(target.href, '_blank') } }, - openModal (event) { + openModal () { if (this.useModal) { this.$emit('setMedia') useMediaViewerStore().setCurrentMedia(this.attachment) @@ -153,7 +153,7 @@ const Attachment = { window.open(this.attachment.url) } }, - openModalForce (event) { + openModalForce () { this.$emit('setMedia') useMediaViewerStore().setCurrentMedia(this.attachment) }, diff --git a/src/components/attachment/attachment.vue b/src/components/attachment/attachment.vue index 9abc26271..3ab7040ef 100644 --- a/src/components/attachment/attachment.vue +++ b/src/components/attachment/attachment.vue @@ -238,8 +238,8 @@ ref="flash" class="flash" :src="attachment.large_thumb_url || attachment.url" - @playerOpened="setFlashLoaded(true)" - @playerClosed="setFlashLoaded(false)" + @player-opened="setFlashLoaded(true)" + @player-closed="setFlashLoaded(false)" /> diff --git a/src/components/chat_list_item/chat_list_item.js b/src/components/chat_list_item/chat_list_item.js index e5032176f..8f8c491f5 100644 --- a/src/components/chat_list_item/chat_list_item.js +++ b/src/components/chat_list_item/chat_list_item.js @@ -52,7 +52,7 @@ const ChatListItem = { } }, methods: { - openChat (_e) { + openChat () { if (this.chat.id) { this.$router.push({ name: 'chat', diff --git a/src/components/checkbox/checkbox.vue b/src/components/checkbox/checkbox.vue index 1e502f5a5..e447595f2 100644 --- a/src/components/checkbox/checkbox.vue +++ b/src/components/checkbox/checkbox.vue @@ -53,7 +53,7 @@ export default { } }, methods: { - onTransitionEnd (e) { + onTransitionEnd () { if (!this.indeterminate) { this.indeterminateTransitionFix = false } diff --git a/src/components/color_input/color_input.vue b/src/components/color_input/color_input.vue index 418fb18c4..26b67cfe8 100644 --- a/src/components/color_input/color_input.vue +++ b/src/components/color_input/color_input.vue @@ -15,7 +15,7 @@ :model-value="present" :disabled="disabled" class="opt" - @update:modelValue="updateValue(typeof modelValue === 'undefined' ? fallback : undefined)" + @update:model-value="updateValue(typeof modelValue === 'undefined' ? fallback : undefined)" />
!prop.replying && prop.mediaPlaying.length === 0) + .every(([, prop]) => !prop.replying && prop.mediaPlaying.length === 0) } if (this.$refs.statusComponent && this.$refs.statusComponent[0]) { return this.$refs.statusComponent.every(s => s.suspendable) @@ -272,11 +272,8 @@ const conversation = { }, replies () { let i = 1 - // eslint-disable-next-line camelcase - return reduce(this.conversation, (result, { id, in_reply_to_status_id }) => { - /* eslint-disable camelcase */ - const irid = in_reply_to_status_id - /* eslint-enable camelcase */ + + return reduce(this.conversation, (result, { id, in_reply_to_status_id: irid }) => { if (irid) { result[irid] = result[irid] || [] result[irid].push({ @@ -381,7 +378,7 @@ const conversation = { this.resetDisplayState() } }, - virtualHidden (value) { + virtualHidden () { this.$store.dispatch( 'setVirtualHeight', { statusId: this.statusId, height: `${this.$el.clientHeight}px` } @@ -477,7 +474,7 @@ const conversation = { // nothing found, fall back to toplevel return this.topLevel[0] ? this.topLevel[0].id : undefined }, - diveIntoStatus (id, preventScroll) { + diveIntoStatus (id) { this.tryScrollTo(id) }, diveToTopLevel () { diff --git a/src/components/conversation/conversation.vue b/src/components/conversation/conversation.vue index 51c016323..f1206e644 100644 --- a/src/components/conversation/conversation.vue +++ b/src/components/conversation/conversation.vue @@ -123,7 +123,7 @@ :controlled-set-media-playing="(newVal) => toggleStatusContentProperty(status.id, 'mediaPlaying', newVal)" @goto="setHighlight" - @toggleExpanded="toggleExpanded" + @toggle-expanded="toggleExpanded" />
diff --git a/src/components/edit_status_modal/edit_status_modal.vue b/src/components/edit_status_modal/edit_status_modal.vue index a53caf4ec..3d192b1ee 100644 --- a/src/components/edit_status_modal/edit_status_modal.vue +++ b/src/components/edit_status_modal/edit_status_modal.vue @@ -2,7 +2,7 @@
diff --git a/src/components/emoji_input/emoji_input.js b/src/components/emoji_input/emoji_input.js index 09d44b0bd..f3b6dfe9b 100644 --- a/src/components/emoji_input/emoji_input.js +++ b/src/components/emoji_input/emoji_input.js @@ -265,7 +265,7 @@ const EmojiInput = { } }, watch: { - showSuggestions: function (newValue, oldValue) { + showSuggestions: function (newValue) { this.$emit('shown', newValue) if (newValue) { this.$refs.suggestorPopover.showPopover() diff --git a/src/components/emoji_input/suggestor.js b/src/components/emoji_input/suggestor.js index e746dcd76..f2daf2f46 100644 --- a/src/components/emoji_input/suggestor.js +++ b/src/components/emoji_input/suggestor.js @@ -116,7 +116,6 @@ export const suggestUsers = ({ dispatch, state }) => { const screenNameAlphabetically = a.screen_name > b.screen_name ? 1 : -1 return diff + nameAlphabetically + screenNameAlphabetically - /* eslint-disable camelcase */ }).map((user) => ({ user, displayText: user.screen_name_ui, @@ -124,7 +123,6 @@ export const suggestUsers = ({ dispatch, state }) => { imageUrl: user.profile_image_url_original, replacement: '@' + user.screen_name + ' ' })) - /* eslint-enable camelcase */ suggestions = newSuggestions || [] return suggestions diff --git a/src/components/emoji_picker/emoji_picker.js b/src/components/emoji_picker/emoji_picker.js index 48532d3e7..17a317a4d 100644 --- a/src/components/emoji_picker/emoji_picker.js +++ b/src/components/emoji_picker/emoji_picker.js @@ -352,7 +352,7 @@ const EmojiPicker = { }, allEmojiGroups () { return Object.entries(this.allCustomGroups) - .map(([_, v]) => v) + .map(([, v]) => v) .concat(this.unicodeEmojiGroups) }, stickerPickerEnabled () { diff --git a/src/components/emoji_reactions/emoji_reactions.js b/src/components/emoji_reactions/emoji_reactions.js index 861fbe542..d71dcbc4d 100644 --- a/src/components/emoji_reactions/emoji_reactions.js +++ b/src/components/emoji_reactions/emoji_reactions.js @@ -71,7 +71,7 @@ const EmojiReactions = { unreact (emoji) { this.$store.dispatch('unreactWithEmoji', { id: this.status.id, emoji }) }, - async emojiOnClick (emoji, event) { + async emojiOnClick (emoji) { if (!this.loggedIn) return await this.fetchEmojiReactionsByIfMissing() diff --git a/src/components/font_control/font_control.vue b/src/components/font_control/font_control.vue index ecf217fb4..5f4ed105c 100644 --- a/src/components/font_control/font_control.vue +++ b/src/components/font_control/font_control.vue @@ -86,7 +86,7 @@ :id="name + '-local-font-switcher'" :model-value="modelValue?.family" class="custom-font" - @update:modelValue="v => $emit('update:modelValue', { ...(modelValue || {}), family: v })" + @update:model-value="v => $emit('update:modelValue', { ...(modelValue || {}), family: v })" >
diff --git a/src/components/interface_language_switcher/interface_language_switcher.vue b/src/components/interface_language_switcher/interface_language_switcher.vue index e6a0c1617..ad11589b0 100644 --- a/src/components/interface_language_switcher/interface_language_switcher.vue +++ b/src/components/interface_language_switcher/interface_language_switcher.vue @@ -13,7 +13,7 @@