aboutsummaryrefslogtreecommitdiffstats
path: root/.eslintrc.yaml
Commit message (Collapse)AuthorAgeFilesLines
* Add typescript guideline and typescript-specific eslint plugins and fix ↵silverwind2024-07-031-6/+127
| | | | | | | | issues (#31521) 1. Add some general guidelines how to write our typescript code 2. Add `@typescript-eslint/eslint-plugin`, general typescript rules 3. Add `eslint-plugin-deprecation` to detect deprecated code 4. Fix all new lint issues that came up
* Add initial typescript config and use it for eslint,vitest,playwright (#31186)silverwind2024-06-281-2/+29
| | | | | | | | | | | | | | | | | | | | This enables eslint to use the typescript parser and resolver which brings some benefits that eslint rules now have type information available and a tsconfig.json is required for the upcoming typescript migration as well. Notable changes done: - Add typescript parser and resolver - Move the vue-specific config into the root file - Enable `vue-scoped-css/enforce-style-type` rule, there was only one violation and I added a inline disable there. - Fix new lint errors that were detected because of the parser change - Update `i/no-unresolved` to remove now-unnecessary workaround for the resolver - Disable `i/no-named-as-default` as it seems to raise bogus issues in the webpack config - Change vitest config to typescript - Change playwright config to typescript - Add `eslint-plugin-playwright` and fix issues - Add `tsc` linting to `make lint-js`
* Bump htmx to 2.0.0 (#31413)Yarden Shoham2024-06-201-0/+1
| | | | | | | | | Tested Subscribe, Follow, Star, Watch, and System Status. --------- Signed-off-by: Yarden Shoham <git@yardenshoham.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: silverwind <me@silverwind.io>
* Update JS dependencies, remove `eslint-plugin-jquery` (#31402)silverwind2024-06-181-50/+1
| | | | | | | | | | | | - Result of `make update-js` - Added 1 new eslint rule - Autofixed 1 new eslint issue - Remove `eslint-plugin-jquery` as `eslint-plugin-no-jquery` does all it does and is actually the maintained fork of it. - Tested all affected `dependencies` --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Use `querySelector` over alternative DOM methods (#31280)silverwind2024-06-101-1/+1
| | | | | | | | | | | | | | | | As per https://github.com/go-gitea/gitea/pull/30115#discussion_r1626060164, prefer `querySelector` by enabling [`unicorn/prefer-query-selector`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-query-selector.md) and autofixing all except 10 issues. According to [this](https://old.reddit.com/r/learnjavascript/comments/i0f5o8/performance_of_getelementbyid_vs_queryselector/), querySelector may be faster as well, so it's a win-win. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: Giteabot <teabot@gitea.io>
* Remove jQuery `.text()` (#30506)silverwind2024-06-101-2/+2
| | | | | | | | | Remove and forbid [.text()](https://api.jquery.com/text/). Tested some, but not all functionality, but I think these are pretty safe replacements. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Update JS dependencies, add new eslint rules (#30840)silverwind2024-05-101-1/+8
|
* add built js files to eslint ignore (#30737)silverwind2024-04-281-0/+1
| | | | For the rare case that some overzealous tooling wants to lint our output files.
* Enable jquery-related eslint rules that have no violations (#30632)silverwind2024-04-221-4/+4
| | | All these have no violations, so enable them.
* Rewrite and restyle reaction selector and enable no-sizzle eslint rule (#30453)silverwind2024-04-141-2/+2
| | | | | | | | | | | Enable `no-sizzle` lint rule, there was only one use in `initCompReactionSelector` and: - Remove all jQuery except the necessary fomantic dropdown init - Remove the recursion, instead bind event listeners to common parent container nodes --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: Giteabot <teabot@gitea.io>
* Update JS dependencies and add new eslint rules (#30279)silverwind2024-04-051-1/+4
| | | | | - Run `make update-js` - Added new eslint rules - Tested webpack build and swagger ui
* Ignore fomantic folder in linters (#30200)silverwind2024-03-311-0/+1
| | | | We are not linting these files but editor integrations will still try to lint, disable that.
* Forbid jQuery `.attr` (#30116)Yarden Shoham2024-03-271-2/+2
| | | | | Use `.getAttribute`, `.setAttribute`, or `.removeAttribute` instead Signed-off-by: Yarden Shoham <git@yardenshoham.com>
* Enable eslint `space-before-function-paren` (#30078)silverwind2024-03-251-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
* Forbid jQuery `is` and fix issues (#30016)silverwind2024-03-241-2/+2
| | | | | | | Tested all functionality. --------- Co-authored-by: Yarden Shoham <git@yardenshoham.com>
* Enforce trailing comma in JS on multiline (#30002)silverwind2024-03-221-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.
* Forbid jQuery `.css` and refactor all usage (#29852)silverwind2024-03-191-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>
* move some scripts from 'build' to 'tools' directory, misc refactors (#29844)silverwind2024-03-171-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>
* Forbid jQuery `.prop` and fix related issues (#29832)silverwind2024-03-161-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>
* Forbid HTML injection using jQuery (#29843)Yarden Shoham2024-03-161-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>
* Forbid variables containing jQuery collections not having the `$` prefix ↵Yarden Shoham2024-03-161-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>
* Forbid jQuery AJAX (#29818)Yarden Shoham2024-03-161-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>
* Remove jQuery .map() and enable eslint rules for it (#29272)silverwind2024-02-211-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.
* Add `eslint-plugin-github` and fix issues (#29201)silverwind2024-02-161-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
* Update JS and PY dependencies (#29127)silverwind2024-02-111-1/+0
| | | | | | - Update all excluding `@mcaptcha/vanilla-glue` and `eslint-plugin-array-func` - Remove deprecated and duplicate eslint rule - Tested Monaco, Mermaid and Swagger
* Fix gitea-origin-url with default ports (#29085)silverwind2024-02-081-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
* 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-071-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-261-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-191-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.