Add initial typescript config and use it for eslint,vitest,playwright (#31186)

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`
This commit is contained in:
silverwind 2024-06-28 18:15:51 +02:00 committed by GitHub
parent df805d6ed0
commit 08579d6cbb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 249 additions and 66 deletions

View file

@ -1,22 +0,0 @@
plugins:
- eslint-plugin-vue
- eslint-plugin-vue-scoped-css
extends:
- ../../../.eslintrc.yaml
- plugin:vue/vue3-recommended
- plugin:vue-scoped-css/vue3-recommended
parserOptions:
sourceType: module
ecmaVersion: latest
env:
browser: true
rules:
vue/attributes-order: [0]
vue/html-closing-bracket-spacing: [2, {startTag: never, endTag: never, selfClosingTag: never}]
vue/max-attributes-per-line: [0]
vue/singleline-html-element-content-newline: [0]
vue-scoped-css/enforce-style-type: [0]

View file

@ -797,7 +797,7 @@ export function initRepositoryActionView() {
}
</style>
<style>
<style> /* eslint-disable-line vue-scoped-css/enforce-style-type */
/* some elements are not managed by vue, so we need to use global style */
.job-status-rotate {
animation: job-status-rotate-keyframes 1s linear infinite;

View file

@ -153,7 +153,7 @@ export function initRepoCodeView() {
});
$(window).on('hashchange', () => {
let m = window.location.hash.match(rangeAnchorRegex);
let m = rangeAnchorRegex.exec(window.location.hash.match);
const $linesEls = $(getLineEls());
let $first;
if (m) {
@ -170,7 +170,7 @@ export function initRepoCodeView() {
return;
}
}
m = window.location.hash.match(singleAnchorRegex);
m = singleAnchorRegex.exec(window.location.hash.match);
if (m) {
$first = $linesEls.filter(`[rel=L${m[2]}]`);
if ($first.length) {

View file

@ -4,7 +4,7 @@ import {isDocumentFragmentOrElementNode} from '../utils/dom.js';
import octiconKebabHorizontal from '../../../public/assets/img/svg/octicon-kebab-horizontal.svg';
window.customElements.define('overflow-menu', class extends HTMLElement {
updateItems = throttle(100, () => {
updateItems = throttle(100, () => { // eslint-disable-line unicorn/consistent-function-scoping -- https://github.com/sindresorhus/eslint-plugin-unicorn/issues/2088
if (!this.tippyContent) {
const div = document.createElement('div');
div.classList.add('tippy-target');