Update eslint

I was having a bunch of dependency conflicts and eslint seemed to be the
culprit so I just removed it and set it up again, since it seems things
have changed quite a bit.
This commit is contained in:
Asher 2024-10-04 18:18:06 -08:00
parent 8b99fe937a
commit 3f80dc6d6a
No known key found for this signature in database
GPG Key ID: D63C1EF81242354A
11 changed files with 1383 additions and 1231 deletions

View File

@ -1,43 +0,0 @@
parser: "@typescript-eslint/parser"
env:
browser: true
es6: true # Map, etc.
jest: true
node: true
parserOptions:
ecmaVersion: 2018
sourceType: module
extends:
- eslint:recommended
- plugin:@typescript-eslint/recommended
- plugin:import/recommended
- plugin:import/typescript
- plugin:prettier/recommended
# Prettier should always be last
# Removes eslint rules that conflict with prettier.
- prettier
rules:
# Sometimes you need to add args to implement a function signature even
# if they are unused.
"@typescript-eslint/no-unused-vars": ["error", { "args": "none" }]
# For overloads.
no-dupe-class-members: off
"@typescript-eslint/no-use-before-define": off
"@typescript-eslint/no-non-null-assertion": off
"@typescript-eslint/ban-types": off
"@typescript-eslint/no-var-requires": off
"@typescript-eslint/explicit-module-boundary-types": off
"@typescript-eslint/no-explicit-any": off
"@typescript-eslint/no-extra-semi": off
eqeqeq: error
import/order:
[error, { alphabetize: { order: "asc" }, groups: [["builtin", "external", "internal"], "parent", "sibling"] }]
no-async-promise-executor: off
settings:
import/resolver:
typescript:
alwaysTryTypes: true

View File

@ -33,7 +33,7 @@ jobs:
- name: Run prettier with actionsx/prettier - name: Run prettier with actionsx/prettier
uses: actionsx/prettier@v3 uses: actionsx/prettier@v3
with: with:
args: --check --loglevel=warn . args: --check --log-level=warn .
doctoc: doctoc:
name: Doctoc markdown files name: Doctoc markdown files

84
eslint.config.mjs Normal file
View File

@ -0,0 +1,84 @@
import { fixupConfigRules } from "@eslint/compat"
import globals from "globals"
import tsParser from "@typescript-eslint/parser"
import path from "node:path"
import { fileURLToPath } from "node:url"
import js from "@eslint/js"
import { FlatCompat } from "@eslint/eslintrc"
const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
})
export default [
...fixupConfigRules(
compat.extends(
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:import/recommended",
"plugin:import/typescript",
"plugin:prettier/recommended",
"prettier",
),
),
{
languageOptions: {
globals: {
...globals.browser,
...globals.jest,
...globals.node,
},
parser: tsParser,
ecmaVersion: 2018,
sourceType: "module",
},
settings: {
"import/resolver": {
typescript: {
alwaysTryTypes: true,
},
},
},
rules: {
"@typescript-eslint/no-unused-vars": [
"error",
{
args: "none",
},
],
"no-dupe-class-members": "off",
"@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/ban-types": "off",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-extra-semi": "off",
"@typescript-eslint/no-require-imports": "off",
"@typescript-eslint/no-unused-vars": "off", // TODO: Fix these.
"@typescript-eslint/no-empty-object-type": "off",
eqeqeq: "error",
"import/order": [
"error",
{
alphabetize: {
order: "asc",
},
groups: [["builtin", "external", "internal"], "parent", "sibling"],
},
],
"no-async-promise-executor": "off",
},
},
]

2461
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -30,16 +30,20 @@
"publish:docker": "./ci/steps/docker-buildx-push.sh", "publish:docker": "./ci/steps/docker-buildx-push.sh",
"fmt": "npm run prettier && ./ci/dev/doctoc.sh", "fmt": "npm run prettier && ./ci/dev/doctoc.sh",
"lint:scripts": "./ci/dev/lint-scripts.sh", "lint:scripts": "./ci/dev/lint-scripts.sh",
"lint:ts": "eslint --max-warnings=0 --fix $(git ls-files '*.ts' '*.js' | grep -v 'lib/vscode')", "lint:ts": "eslint --max-warnings=0 --fix $(git ls-files '*.ts' '*.js' | grep -v 'lib/vscode' | grep -v test-plugin)",
"test": "echo 'Run npm run test:unit or npm run test:e2e' && exit 1", "test": "echo 'Run npm run test:unit or npm run test:e2e' && exit 1",
"watch": "VSCODE_DEV=1 VSCODE_IPC_HOOK_CLI= NODE_OPTIONS='--max_old_space_size=32384 --trace-warnings' ts-node ./ci/dev/watch.ts", "watch": "VSCODE_DEV=1 VSCODE_IPC_HOOK_CLI= NODE_OPTIONS='--max_old_space_size=32384 --trace-warnings' ts-node ./ci/dev/watch.ts",
"icons": "./ci/dev/gen_icons.sh" "icons": "./ci/dev/gen_icons.sh"
}, },
"main": "out/node/entry.js", "main": "out/node/entry.js",
"devDependencies": { "devDependencies": {
"@eslint/compat": "^1.2.0",
"@eslint/eslintrc": "^3.1.0",
"@eslint/js": "^9.12.0",
"@schemastore/package": "^0.0.10", "@schemastore/package": "^0.0.10",
"@types/compression": "^1.7.3", "@types/compression": "^1.7.3",
"@types/cookie-parser": "^1.4.4", "@types/cookie-parser": "^1.4.4",
"@types/eslint__js": "^8.42.3",
"@types/express": "^4.17.17", "@types/express": "^4.17.17",
"@types/http-proxy": "1.17.7", "@types/http-proxy": "1.17.7",
"@types/js-yaml": "^4.0.6", "@types/js-yaml": "^4.0.6",
@ -50,18 +54,18 @@
"@types/semver": "^7.5.2", "@types/semver": "^7.5.2",
"@types/trusted-types": "^2.0.4", "@types/trusted-types": "^2.0.4",
"@types/ws": "^8.5.5", "@types/ws": "^8.5.5",
"@typescript-eslint/eslint-plugin": "^7.0.0",
"@typescript-eslint/parser": "^6.7.2",
"doctoc": "^2.2.1", "doctoc": "^2.2.1",
"eslint": "^8.49.0", "eslint": "^9.12.0",
"eslint-config-prettier": "^9.0.0", "eslint-config-prettier": "^9.0.0",
"eslint-import-resolver-typescript": "^3.6.0", "eslint-import-resolver-typescript": "^3.6.0",
"eslint-plugin-import": "^2.28.1", "eslint-plugin-import": "^2.28.1",
"eslint-plugin-prettier": "^5.0.0", "eslint-plugin-prettier": "^5.0.0",
"globals": "^15.10.0",
"prettier": "^3.0.3", "prettier": "^3.0.3",
"prettier-plugin-sh": "^0.14.0", "prettier-plugin-sh": "^0.14.0",
"ts-node": "^10.9.1", "ts-node": "^10.9.1",
"typescript": "^5.2.2" "typescript": "^5.6.2",
"typescript-eslint": "^8.8.0"
}, },
"dependencies": { "dependencies": {
"@coder/logger": "^3.0.1", "@coder/logger": "^3.0.1",

View File

@ -1,5 +1,3 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
self.addEventListener("install", () => { self.addEventListener("install", () => {
console.debug("[Service Worker] installed") console.debug("[Service Worker] installed")
}) })

View File

@ -47,7 +47,7 @@ export class SocketProxyProvider {
proxy.once("connect", () => proxy.write(id)) proxy.once("connect", () => proxy.write(id))
const timeout = setTimeout(() => { const timeout = setTimeout(() => {
listener.dispose() // eslint-disable-line @typescript-eslint/no-use-before-define listener.dispose()
socket.destroy() socket.destroy()
proxy.destroy() proxy.destroy()
reject(new Error("TLS socket proxy timed out")) reject(new Error("TLS socket proxy timed out"))

View File

@ -37,7 +37,6 @@ export async function makeEditorSessionManagerServer(
): Promise<http.Server> { ): Promise<http.Server> {
const router = express() const router = express()
// eslint-disable-next-line import/no-named-as-default-member
router.use(express.json()) router.use(express.json())
router.get<{}, GetSessionResponse | string | unknown, undefined, { filePath?: string }>( router.get<{}, GetSessionResponse | string | unknown, undefined, { filePath?: string }>(

View File

@ -54,5 +54,4 @@ export function Router(): WebsocketRouter {
return new WebsocketRouter() return new WebsocketRouter()
} }
// eslint-disable-next-line import/no-named-as-default-member -- the typings are not updated correctly
export const wss = new Websocket.Server({ noServer: true }) export const wss = new Websocket.Server({ noServer: true })

View File

@ -23,6 +23,6 @@ describe("Webviews", ["--disable-workspace-trust"], {}, () => {
.frameLocator("#active-frame") .frameLocator("#active-frame")
.locator("text=Hello world") .locator("text=Hello world")
expect(renderedText).toBeVisible expect(renderedText).toBeVisible()
}) })
}) })

View File

@ -61,7 +61,7 @@ describe("SocketProxyProvider", () => {
resolved[type] = true resolved[type] = true
if (resolved.client && resolved.server) { if (resolved.client && resolved.server) {
// We don't need any more connections. // We don't need any more connections.
main.close() // eslint-disable-line @typescript-eslint/no-use-before-define main.close()
_resolve() _resolve()
} }
} }