aboutsummaryrefslogtreecommitdiffstats
path: root/src/packages/eslint-config
diff options
context:
space:
mode:
authorMatt Strapp <matt@mattstrapp.net>2024-10-31 10:36:25 -0500
committerMatt Strapp <matt@mattstrapp.net>2024-10-31 10:36:25 -0500
commit8d1d5ca1cab59ead9085bf00f4ee5214bf10bfe8 (patch)
tree0d8a1772a4579a136ebfdd06a3d368b3a2c0d1cf /src/packages/eslint-config
parentci: Alter version bump to only ignore pnpm lockfile, not rest (diff)
downloadlocusts-8d1d5ca1cab59ead9085bf00f4ee5214bf10bfe8.tar
locusts-8d1d5ca1cab59ead9085bf00f4ee5214bf10bfe8.tar.gz
locusts-8d1d5ca1cab59ead9085bf00f4ee5214bf10bfe8.tar.bz2
locusts-8d1d5ca1cab59ead9085bf00f4ee5214bf10bfe8.tar.lz
locusts-8d1d5ca1cab59ead9085bf00f4ee5214bf10bfe8.tar.xz
locusts-8d1d5ca1cab59ead9085bf00f4ee5214bf10bfe8.tar.zst
locusts-8d1d5ca1cab59ead9085bf00f4ee5214bf10bfe8.zip
js: Migrate to ESLint 9
Signed-off-by: Matt Strapp <matt@mattstrapp.net>
Diffstat (limited to 'src/packages/eslint-config')
-rw-r--r--src/packages/eslint-config/eslint.library.config.js39
-rw-r--r--src/packages/eslint-config/library.js34
-rw-r--r--src/packages/eslint-config/package.json10
3 files changed, 46 insertions, 37 deletions
diff --git a/src/packages/eslint-config/eslint.library.config.js b/src/packages/eslint-config/eslint.library.config.js
new file mode 100644
index 0000000..e3c7866
--- /dev/null
+++ b/src/packages/eslint-config/eslint.library.config.js
@@ -0,0 +1,39 @@
+// @ts-check
+
+import globals from "globals";
+import eslint from "@eslint/js";
+import ts from "typescript-eslint";
+import prettier from "eslint-config-prettier";
+import turboPlugin from "eslint-plugin-turbo";
+
+import { resolve } from "node:path";
+
+const project = resolve(process.cwd(), "tsconfig.json");
+
+export default ts.config(
+ eslint.configs.recommended,
+ ...ts.configs.recommended,
+ prettier,
+ {
+ name: "eslint-config-turbo (recreated flat)",
+ plugins: {
+ turbo: { rules: turboPlugin.rules },
+ },
+ rules: {
+ "turbo/no-undeclared-env-vars": "error",
+ },
+ },
+ {
+ name: "library",
+ languageOptions: {
+ // parserOptions: {
+ // project: resolve(process.cwd(), "tsconfig.json")
+ // },
+ globals: {
+ ...globals.browser,
+ ...globals.node,
+ },
+ },
+ ignores: ["build/", ".svelte-kit/", "dist/"],
+ },
+);
diff --git a/src/packages/eslint-config/library.js b/src/packages/eslint-config/library.js
deleted file mode 100644
index 9b59cc0..0000000
--- a/src/packages/eslint-config/library.js
+++ /dev/null
@@ -1,34 +0,0 @@
-const { resolve } = require("node:path");
-
-const project = resolve(process.cwd(), "tsconfig.json");
-
-/** @type {import("eslint").Linter.Config} */
-module.exports = {
- extends: ["eslint:recommended", "prettier", "turbo"],
- plugins: ["only-warn"],
- globals: {
- React: true,
- JSX: true,
- },
- env: {
- node: true,
- },
- settings: {
- "import/resolver": {
- typescript: {
- project,
- },
- },
- },
- ignorePatterns: [
- // Ignore dotfiles
- ".*.js",
- "node_modules/",
- "dist/",
- ],
- overrides: [
- {
- files: ["*.js?(x)", "*.ts?(x)"],
- },
- ],
-};
diff --git a/src/packages/eslint-config/package.json b/src/packages/eslint-config/package.json
index ba005cf..a05970f 100644
--- a/src/packages/eslint-config/package.json
+++ b/src/packages/eslint-config/package.json
@@ -3,15 +3,19 @@
"version": "0.0.0",
"devDependencies": {
"@typescript-eslint/eslint-plugin": "8.12.2",
- "@typescript-eslint/parser": "8.12.2",
"@vercel/style-guide": "6.0.0",
+ "@types/eslint": "^9.6.0",
+ "eslint": "^9.7.0",
"eslint-config-prettier": "^9.1.0",
"eslint-config-turbo": "^2.2.3",
"eslint-plugin-only-warn": "^1.1.0",
- "typescript": "^5.6.3"
+ "globals": "^15.0.0",
+ "typescript": "^5.6.3",
+ "typescript-eslint": "^8.0.0"
},
"files": [
- "library.js"
+ "library.mjs"
],
+ "type": "module",
"private": true
}