Migrate to a new eslint

Linter is not yet autoenabled, need to fix some issues first in npm run test

Signed-off-by: Alexander Borsuk <me@alex.bio>
This commit is contained in:
Alexander Borsuk 2024-08-03 13:55:02 +02:00
parent 492220adaa
commit 77fc96a519
4 changed files with 1099 additions and 404 deletions

View file

@ -1,18 +0,0 @@
env:
es2020: true
worker: true
extends: ["plugin:@typescript-eslint/recommended"]
parser: "@typescript-eslint/parser"
parserOptions:
ecmaVersion: 2020
ecmaFeatures:
impliedStrict: true
sourceType: module
root: true
rules:
indent: [error, 2, { SwitchCase: 1 }]
semi: [error, always]
quotes: [error, single, avoid-escape]
no-trailing-spaces: [error]
no-unused-vars: [error, { argsIgnorePattern: ^_ }]
prefer-const: [error, { destructuring: all }]

50
eslint.config.mjs Normal file
View file

@ -0,0 +1,50 @@
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 [...compat.extends("plugin:@typescript-eslint/recommended"), {
languageOptions: {
globals: {
...globals.worker,
},
parser: tsParser,
ecmaVersion: 2020,
sourceType: "module",
parserOptions: {
ecmaFeatures: {
impliedStrict: true,
},
},
},
rules: {
indent: ["error", 2, {
SwitchCase: 1,
}],
semi: ["error", "always"],
quotes: ["error", "single", "avoid-escape"],
"no-trailing-spaces": ["error"],
"no-unused-vars": ["error", {
argsIgnorePattern: "^_",
}],
"prefer-const": ["error", {
destructuring: "all",
}],
},
}];

1416
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -13,14 +13,19 @@
"author": "Alexander Borsuk <me@alex.bio>",
"license": "MIT",
"devDependencies": {
"@cloudflare/workers-types": "^4.20240620.0",
"esbuild": "^0.21.5",
"eslint": "^9.5.0",
"prettier": "^3.3.2",
"typescript": "^5.5.2",
"wrangler": "^3.61.0"
"@cloudflare/workers-types": "^4.20240729.0",
"@eslint/eslintrc": "^3.1.0",
"@eslint/js": "^9.8.0",
"@typescript-eslint/eslint-plugin": "^8.0.0",
"@typescript-eslint/parser": "^8.0.0",
"esbuild": "^0.23.0",
"eslint": "^9.8.0",
"globals": "^15.9.0",
"prettier": "^3.3.3",
"typescript": "^5.5.4",
"wrangler": "^3.68.0"
},
"dependencies": {
"@cloudflare/kv-asset-handler": "^0.3.3"
"@cloudflare/kv-asset-handler": "^0.3.4"
}
}