summaryrefslogtreecommitdiffstats
path: root/.eslintrc.yaml (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Ignore fomantic folder in linters (#30200)silverwind2024-04-071-0/+1
| | | | | | | We are not linting these files but editor integrations will still try to lint, disable that. (cherry picked from commit 38d56ca10600bdb867b363be717f7cf5d176297a)
* Forbid jQuery `.attr` (#30116)Yarden Shoham2024-03-301-2/+2
| | | | | | | Use `.getAttribute`, `.setAttribute`, or `.removeAttribute` instead Signed-off-by: Yarden Shoham <git@yardenshoham.com> (cherry picked from commit 34acd8e3767ec0898f90a74b64ac738d0ce05f0a)
* Enable eslint `space-before-function-paren` (#30078)silverwind2024-03-301-1/+1
| | | | | | | | | | Anonymous are set to ignore as I [couldn't decide](https://github.com/go-gitea/gitea/pull/30077#discussion_r1538117497). No current violations. Rule docs: https://eslint.style/rules/js/space-before-function-paren (cherry picked from commit bcb151c220c3fa6003810e436acdda9cc0501e58)
* Forbid jQuery `is` and fix issues (#30016)silverwind2024-03-301-2/+2
| | | | | | | | | Tested all functionality. --------- Co-authored-by: Yarden Shoham <git@yardenshoham.com> (cherry picked from commit 0a2f973de9b681a472c96bdfcd945978e88458d8)
* Enforce trailing comma in JS on multiline (#30002)silverwind2024-03-261-1/+1
| | | | | | | | | | | | | | | To keep blame info accurate and to avoid [changes like this](https://github.com/go-gitea/gitea/pull/29977/files#diff-c3422631a14edbe1e508c4b22f0c718db318be08a6e889427802f9b6165d88d6R359), it's good to always have a trailing comma, so let's enforce it in JS. This rule is completely automatically fixable with `make lint-js-fix` and that's what I did here. (cherry picked from commit 3d751b6ec18e57698ce86b79866031d2c80c2071) Conflicts: web_src/js/components/DashboardRepoList.vue trivial context conflict because of '3b7b899afa fix commit_status'
* Forbid jQuery `.css` and refactor all usage (#29852)silverwind2024-03-261-2/+2
| | | | | | | | | | | Tested all functionality. There is a [pre-existing bug](https://github.com/go-gitea/gitea/issues/29853) when moving a project panels which is not caused by this refactoring. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> (cherry picked from commit fa100618c4b644346bf5666f92d33dce0747d0a2)
* move some scripts from 'build' to 'tools' directory, misc refactors (#29844)silverwind2024-03-261-4/+0
| | | | | | | | | | | | | | | | - Move some scripts from `build` to new `tools` dir. Eventually i would like to move all but let's do it step-by-step. - Add dir to eslint and move the files into vars. - Update docs accordingly. - While updating docs I noticed we were incorrectly having `public/img` path still in a few places. Replace those with the current `public/assets/img`. --------- Co-authored-by: Nanguan Lin <nanguanlin6@gmail.com> Co-authored-by: Giteabot <teabot@gitea.io> (cherry picked from commit 095fdd691dd1a7d7748372cc73e7708278c80933)
* Forbid jQuery `.prop` and fix related issues (#29832)silverwind2024-03-201-2/+2
| | | | | | | | | | | | The issue checkbox code received a few more cleanups and I specifically tested it. The other changes are trivial. Also, I checked the cases for how many elements match the jQuery selection to determine querySelector vs. querySelectorAll. --------- Co-authored-by: Giteabot <teabot@gitea.io> (cherry picked from commit 21fe512aac42c9ce3440b8eaae6b2cb2116a0e50)
* Forbid HTML injection using jQuery (#29843)Yarden Shoham2024-03-201-1/+1
| | | | | | | | | | | | | | See https://github.com/wikimedia/eslint-plugin-no-jquery/blob/master/docs/rules/no-append-html.md Tested the following components and they work as before: - notification table - issue author dropdown - comment edit box attachments div Signed-off-by: Yarden Shoham <git@yardenshoham.com> Co-authored-by: Giteabot <teabot@gitea.io> (cherry picked from commit f9b4efd42c17d7f75b689142b17575a478fe903c)
* Forbid variables containing jQuery collections not having the `$` prefix ↵Yarden Shoham2024-03-201-1/+1
| | | | | | | | | | | | | (#29839) See https://github.com/wikimedia/eslint-plugin-no-jquery/blob/master/docs/rules/variable-pattern.md --------- Signed-off-by: Yarden Shoham <git@yardenshoham.com> Co-authored-by: silverwind <me@silverwind.io> (cherry picked from commit 3cd64949ae1402a4ff45fba0a27c4acca1c5aead)
* Forbid jQuery AJAX (#29818)Yarden Shoham2024-03-201-2/+2
| | | | | | | | Please use the fetch wrapper instead, or even better `htmx`. Signed-off-by: Yarden Shoham <git@yardenshoham.com> Co-authored-by: 6543 <6543@obermui.de> (cherry picked from commit 6ead30dbc469803d7e8361b13217e07d87d6f80d)
* Remove jQuery .map() and enable eslint rules for it (#29272)silverwind2024-02-261-3/+3
| | | | | | | | | | - Use case in `repo-commit` was tested until the point where the POST request was sent with the same payload. - Use case in `repo-legacy` was tested completely with comment editing. - `jquery/no-fade` was disabled as well to stay in sync with `no-jquery/no-fade`, had no violations. (cherry picked from commit a5c570c1e02302212a5d8f7cf7d91f24ab0578d5)
* Add `eslint-plugin-github` and fix issues (#29201)silverwind2024-02-171-0/+24
| | | | | | | | | | | This plugin has a few useful rules. The only thing I dislike about it is that it pulls in a rather big number of dependencies for react-related rules we don't use, but it can't really be avoided. Rule docs: https://github.com/github/eslint-plugin-github?tab=readme-ov-file#rules (cherry picked from commit 26b17537e651fe93ef9b64f961633cb4c0b8c2c3)
* Update JS and PY dependencies (#29127)silverwind2024-02-141-1/+0
| | | | | | | | | - Update all excluding `@mcaptcha/vanilla-glue` and `eslint-plugin-array-func` - Remove deprecated and duplicate eslint rule - Tested Monaco, Mermaid and Swagger (cherry picked from commit 4fe37124e9ad5395b734662a7e8ab7b0025c38a3)
* [gitea] Fix gitea-origin-url with default ports (#29085)silverwind2024-02-101-1/+1
| | | | | | | | | | | | | | | | When setting `url.host` on a URL object with no port specified (like is the case of default port), the resulting URL's port will not change. Workaround this quirk in the URL standard by explicitely setting port for the http and https protocols. Extracted the logic to a function for the purpose of testing. Initially I wanted to have the function in utils.js, but it turns out esbuild can not treeshake the unused functions which would result in the webcomponents chunk having all 2kB utils.js inlined, so it seemed not worth. Fixes: https://github.com/go-gitea/gitea/issues/29084 (cherry picked from commit b6bf8041d8e8ee845728687b1f358f1d482afff2)
* Update JS and PY dependencies, build for `es2020` browsers (#28977)silverwind2024-02-021-0/+1
| | | | | | | | | - Update all JS dependencies minus @mcaptcha/vanilla-glue - Fix new lint errors - Regenerate SVGs - Switch to maintained stylelint stylistic plugin - Tested Mermaid, Citation, Swagger, sorting - Raise ESBuild target to `es2020` as dictated by `pretty-ms` dependency.
* Update JS and PY dependencies (#28120)silverwind2023-11-201-1/+1
| | | | | | | | - Update all JS and PY dependencies minus `@mcaptcha/vanilla-glue` - Adapt to eslint rule rename - Regenerate all SVGs because of [new optimizations](https://github.com/svg/svgo/releases/tag/v3.0.4) from svgo. - Tested mentions, mermaid, vue, api docs
* Update JS dependencies (#27922)silverwind2023-11-061-59/+67
| | | | | | | | - Update all JS dependencies minus @mcaptcha/vanilla-glue (unsolved error, see https://github.com/mCaptcha/glue/issues/65) - Migrate deprecated eslint rules to `@stylistic/eslint-plugin-js` - Enable and autofix `@stylistic/js/no-multiple-empty-lines` - Regenerate poetry.lock with latest poetry - Tested Mermaid, Swagger, Citation, Vue
* Update and add new eslint plugins (#27698)silverwind2023-10-191-47/+103
| | | | | | | | - Switch `eslint-plugin-import` to [`eslint-plugin-i`](https://github.com/un-es/eslint-plugin-i), a fork with better dependencies - Update `eslint-plugin-regexp` to 2.0.0 and add new rules - Add [`eslint-plugin-vitest`](https://github.com/veritem/eslint-plugin-vitest)
* Update JS and PY dependencies (#27501)silverwind2023-10-081-1/+1
| | | | | | | | | | | | | - Update all JS and PY dependencies - Enable eslint `prefer-object-has-own` and autofix issue - Fix styling on citation buttons - Tested citation, mermaid, monaco, swagger, katex Citation button issue was that these buttons were not filled: <img width="136" alt="Screenshot 2023-10-07 at 14 05 08" src="https://github.com/go-gitea/gitea/assets/115237/435f0c91-28ac-46b3-bae4-dad768b29c05"> Co-authored-by: techknowlogick <techknowlogick@gitea.com>
* Use vitest globals (#27102)silverwind2023-09-271-0/+4
| | | | Enable [globals](https://vitest.dev/config/#globals) in vitest, reducing the noise in test files.
* Update JS and Poetry dependencies and eslint (#27200)silverwind2023-09-221-15/+14
| | | | | | | - Update all JS and Poetry dependencies - Remove deprecated `eslint-plugin-custom-elements` and replace it with rules from `eslint-plugin-wc` - Add a convenience `make update` to update both js and py dependencies - Tested markdown toolbar, swagger and citation
* Use fetch helpers instead of fetch (#27026)silverwind2023-09-191-1/+4
| | | | | | | | | | | | WIP because: - [x] Some calls set a `content-type` but send no body, can likely remove the header - [x] Need to check whether `charset=utf-8` has any significance on the webauthn calls, I assume not as it is the default for json content. - [x] Maybe `no-restricted-globals` is better for eslint, but will require a lot of duplication in the yaml or moving eslint config to a `.js` extension. - [x] Maybe export `request` as `fetch`, shadowing the global.
* Add `yamllint` (#26965)silverwind2023-09-081-1/+1
| | | | | | | | | So that https://github.com/go-gitea/gitea/pull/26964 does not happen again. Merge this after that PR. Config is based on [node's](https://github.com/nodejs/node/blob/main/.yamllint.yaml). --------- Co-authored-by: techknowlogick <techknowlogick@gitea.com>
* Update js and py dependencies (#26243)silverwind2023-07-311-1/+0
| | | | | | | | - Update all JS and PY dependencies minus `eslint-plugin-eslint-comments` (because of https://github.com/eslint-community/eslint-plugin-eslint-comments/issues/89) - Regenerate SVGs - Remove depreacted eslint rule - Tested mermaid and swagger
* Update JS dependencies (#26025)silverwind2023-07-211-2/+1
| | | | | | | | - Update all JS dependencies - Tweak eslint config, disable SequenceExpression aka. [Comma operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Comma_operator), remove deprecated rule - Add new stylelint rule - Tested Monaco and Swagger
* Update JS dependencies, misc tweaks (#25768)silverwind2023-07-081-3/+3
| | | | | | - Update all JS dependencies minus stylelint because of https://github.com/elirasza/stylelint-stylistic/issues/12 - Misc tweaks to eslint and stylelint configs - Tested Monaco and Mermaid
* Add toasts to UI (#25449)silverwind2023-06-271-3/+4
| | | | | Fixes https://github.com/go-gitea/gitea/issues/24353 In some case like async success/error, it is useful to show toasts in UI.
* Update js dependencies (#25137)silverwind2023-06-081-3/+3
| | | | | | | - Update all JS dependencies - Tweak eslint for more generic globs - Tested mermaid, pdf, monaco Co-authored-by: Giteabot <teabot@gitea.io>
* Add two eslint plugins (#24776)silverwind2023-05-181-0/+9
| | | | | | | | Add these two plugins and autofix issues: - [eslint-plugin-no-use-extend-native](https://github.com/dustinspecker/eslint-plugin-no-use-extend-native) - [eslint-plugin-array-func](https://github.com/freaktechnik/eslint-plugin-array-func)
* Switch to `@eslint-community/eslint-comments` (#24736)silverwind2023-05-151-13/+13
| | | | | | | | [eslint-plugin-eslint-comments](https://github.com/mysticatea/eslint-plugin-eslint-comments) is unmaintained, switch to the community fork. See https://github.com/mysticatea/eslint-plugin-eslint-comments/issues/72 for discussion.
* Add `eslint-plugin-eslint-comments` (#24690)silverwind2023-05-121-0/+10
| | | | | Add [eslint-plugin-eslint-comments](https://github.com/mysticatea/eslint-plugin-eslint-comments) which prevents some abuse related to eslint comments.
* Add `eslint-plugin-wc` (#24689)silverwind2023-05-121-0/+10
| | | | Add [eslint-plugin-wc](https://github.com/43081j/eslint-plugin-wc), another small set of eslint rules covering web components.
* Update JS dependencies, add new eslint rules (#24597)silverwind2023-05-091-13/+15
| | | | | | | | | | | | - Update all JS dependencies - Enable new eslint rules, fix issue (some via autofix) - Fix some missed eslint rule renames from [unicorn v25](https://github.com/sindresorhus/eslint-plugin-unicorn/releases/tag/v25.0.0) - Tested Monaco, Katex, Swagger UI --------- Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: Giteabot <teabot@gitea.io>
* Add eslint-plugin-regexp (#24361)silverwind2023-04-271-0/+75
| | | | | | Add [`eslint-plugin-regexp`](https://github.com/ota-meshi/eslint-plugin-regexp) and fix discovered issues. Config is mostly the recommended one, but I relaxed a few rules.
* Add all `no-query` rules to eslint config (#24294)silverwind2023-04-231-1/+93
| | | Add rules of the `no-jquery` plugin to the config and enable all non-violating ones.
* Introduce eslint-plugin-no-jquery/no-event-shorthand (#24198)yp053272023-04-201-0/+2
| | | | | | | https://github.com/go-gitea/gitea/pull/24098#issuecomment-1514010690 --------- Co-authored-by: silverwind <me@silverwind.io>
* Update JS dependencies (#24218)silverwind2023-04-201-2/+2
| | | | | | - Update all js dependencies, update playwright image to jammy - Adjust eslint and vitest config - Tested build, monaco, mermaid, katex
* Add eslint-plugin-custom-elements (#23991)silverwind2023-04-081-0/+14
| | | | | Add [eslint-plugin-custom-elements](https://github.com/github/eslint-plugin-custom-elements) and enable all rules that I've found sensible.
* Remove jQuery ready usage (#23858)silverwind2023-04-021-1/+1
| | | | Replace it with equal function of our own and enable the eslint rule to forbid future usage.
* Refactor hiding-methods, remove jQuery show/hide, remove `.hide` class, ↵wxiaoguang2023-02-191-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | remove inline style=display:none (#22950) Close #22847 This PR: * introduce Gitea's own `showElem` and related functions * remove jQuery show/hide * remove .hide class * remove inline style=display:none From now on: do not use: * "[hidden]" attribute: it's too weak, can not be applied to an element with "display: flex" * ".hidden" class: it has been polluted by Fomantic UI in many cases * inline style="display: none": it's difficult to tweak * jQuery's show/hide/toggle: it can not show/hide elements with "display: xxx !important" only use: * this ".gt-hidden" class * showElem/hideElem/toggleElem functions in "utils/dom.js" cc: @silverwind , this is the all-in-one PR
* Update JS dependencies (#22538)silverwind2023-01-211-0/+2
| | | | | | | | | | - Update all JS dependencies - Add new eslint rules - Rebuild SVGs - Tested citation and build SVG changes are because of https://github.com/primer/octicons/pull/883. Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Update JS dependencies and eslint (#22190)silverwind2022-12-201-3/+3
| | | | | | | - Update all JS dependencies to latest version - Enable unicorn/prefer-node-protocol and autofix issues - Regenerate SVGs - Add some comments to eslint rules - Tested build, Mermaid and Katex rendering
* Update JS dependencies (#21881)silverwind2022-11-221-0/+5
| | | | | | | | - Update all JS deps - Regenerate SVGs - Add new eslint rules, fix issues - Tested Mermaid, Swagger, Vue, Webpack, Citation Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Improvements for Content Copy (#21842)silverwind2022-11-211-1/+1
| | | | | | | | | It now supports copying Markdown, SVG and Images (not in Firefox currently because of lacking [`ClipboardItem`](https://developer.mozilla.org/en-US/docs/Web/API/ClipboardItem) support, but can be enabled in `about:config` and works). It will fetch the data if in a rendered view or when it's an image. Followup to https://github.com/go-gitea/gitea/pull/21629.
* Update JS dependencies and misc tweaks (#21583)silverwind2022-10-281-6/+6
| | | | | | | | | | | - Update all JS dependencies to latest version - Disable two redundant eslint rules - Adapt stylelint config to codebase - Regenerate SVGs - Make file editor spinner "reserve" height so page does not shift - Tested katex, swagger, monaco Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: 6543 <6543@obermui.de>
* Remove vitest globals (#21505)silverwind2022-10-191-3/+0
| | | | | | | Explicitly import them instead which is cleaner and enables better editor integration. Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Update JS dependencies and eslint config (#21388)silverwind2022-10-101-3/+6
| | | | | | | | - Update all JS dependencies and playwright image - Add new eslint rules, enable a few more, fix issues - Regenerate SVGs - Tested Vue and Swagger Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Update JS dependencies and lint (#21144)silverwind2022-09-111-1/+1
| | | | | - Update all JS dependencies minus vue - Enable one more eslint rule, no new issues with it - Tested build
* Update JS dependencies, adjust eslint (#20659)silverwind2022-08-061-9/+9
| | | | | | | | | | | | * Update JS dependencies - Update all JS dependencies minus vue-* - Improve eslint restricted globals - Tested build, lint and swagger * few more lint improvements Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>