Skip to content
This repository has been archived by the owner on Sep 26, 2024. It is now read-only.

remove biome, update eslint + ts configs #192

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 1 addition & 12 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
// This configuration only applies to the package manager root.
/** @type {import("eslint").Linter.Config} */
module.exports = {
extends: ["@repo/eslint-config/library.js"],
extends: ["@repo/config-eslint/base.js"],
ignorePatterns: ["apps/**", "packages/**"],
parser: "@typescript-eslint/parser",
parserOptions: {
project: true,
},
plugins: ["@typescript-eslint"],
root: true,
rules: {
"@typescript-eslint/no-unused-vars": ["error", { argsIgnorePattern: "^_" }],
"no-unused-vars": "off",
},
};
4 changes: 3 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,7 @@ jobs:
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install --no-frozen-lockfile
- name: Lint
run: pnpm lint
- name: Build artifacts
run: pnpm build
run: pnpm build
65 changes: 0 additions & 65 deletions .github/workflows/ci.yml

This file was deleted.

41 changes: 0 additions & 41 deletions apps/mocksi-lite-next/.eslintrc

This file was deleted.

5 changes: 5 additions & 0 deletions apps/mocksi-lite-next/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/** @type {import("eslint").Linter.Config} */
module.exports = {
extends: ["@repo/config-eslint/web.js"],
root: true,
};
22 changes: 6 additions & 16 deletions apps/mocksi-lite-next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,32 +15,22 @@
"description": "A simple chrome extension template with Vite, React, TypeScript and Tailwind CSS.",
"devDependencies": {
"@crxjs/vite-plugin": "^2.0.0-beta.23",
"@types/chrome": "^0.0.268",
"@types/node": "^20.12.11",
"@types/react": "^18.3.1",
"@types/react-dom": "^18.3.0",
"@types/webextension-polyfill": "^0.10.7",
"@typescript-eslint/eslint-plugin": "^7.8.0",
"@typescript-eslint/parser": "^7.8.0",
"@repo/config-eslint": "workspace:*",
"@repo/config-prettier": "workspace:*",
"@repo/config-typescript": "workspace:*",
"@vitejs/plugin-react": "^4.2.1",
"autoprefixer": "^10.4.19",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jsx-a11y": "^6.8.0",
"eslint-plugin-react": "^7.34.1",
"eslint-plugin-react-hooks": "^4.6.2",
"fs-extra": "^11.2.0",
"nodemon": "^3.1.0",
"postcss": "^8.4.38",
"prettier": "^3.2.5",
"tailwindcss": "^3.4.3",
"ts-node": "^10.9.2",
"typescript": "^5.4.5",
"vite": "^5.2.11"
},
"license": "MIT",
"name": "vite-web-extension",
"name": "web-extension",
"prettier": "@repo/config-prettier",
"repository": {
"type": "git",
"url": "https://github.com/JohnBra/web-extension.git"
Expand All @@ -49,7 +39,7 @@
"build": "vite build --mode '${npm_config_mode}'",
"dev": "nodemon",
"format": "prettier --write \"src/**/*.{tsx,ts}\"",
"lint": "eslint --fix --ext .ts,.tsx"
"lint": "eslint --fix . --ext .ts,.tsx"
},
"type": "module",
"version": "1.2.0"
Expand Down
42 changes: 4 additions & 38 deletions apps/mocksi-lite-next/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,44 +1,10 @@
{
"compilerOptions": {
"allowJs": false,
"allowSyntheticDefaultImports": true,
"baseUrl": ".",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"jsx": "react-jsx",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"module": "esnext",
"moduleResolution": "node",
"noEmit": true,
"noFallthroughCasesInSwitch": true,
"paths": {
"@assets/*": [
"src/assets/*"
],
"@pages/*": [
"src/pages/*"
],
"@src/*": [
"src/*"
]
},
"resolveJsonModule": true,
"skipLibCheck": true,
"strict": true,
"target": "esnext",
"types": [
"vite/client",
"node",
"chrome"
]
},
"extends": "@repo/config-typescript/web-app.json",
"ignore": [
"public"
],
"include": [
"src",
"utils",
"vite.config.ts"
],
}
21 changes: 18 additions & 3 deletions apps/mocksi-lite-next/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,27 @@
import { ManifestV3Export, crx } from "@crxjs/vite-plugin";
import { type ManifestV3Export, crx } from "@crxjs/vite-plugin";
import react from "@vitejs/plugin-react";
import { resolve } from "path";
import { defineConfig, loadEnv } from "vite";
import manifest from "./manifest.json";
import baseManifest from "./manifest.json";
import pkg from "./package.json";

interface ManifestConfig {
content_security_policy: {
extension_pages: string;
};
externally_connectable: {
matches: string[];
};
key?: string;
name: string;
web_accessible_resources: { matches: string[]; resources: string[] }[];
}

const root = resolve(__dirname, "src");
const pagesDir = resolve(root, "pages");

const assetsDir = resolve(root, "assets");
const outDir = resolve(__dirname, "dist");
const pagesDir = resolve(root, "pages");
const publicDir = resolve(__dirname, "public");

export default defineConfig(({ mode }) => {
Expand All @@ -35,6 +48,8 @@ export default defineConfig(({ mode }) => {
);
}

const manifest: ManifestConfig = baseManifest;

// Dev note: make sure these urls are what you expect them to be for current mode!
manifest.externally_connectable.matches = [`${env.VITE_NEST_APP}/*`];
manifest.content_security_policy.extension_pages = `object-src 'none'; child-src ${env.VITE_NEST_APP}; frame-src ${env.VITE_NEST_APP}; script-src 'self'`;
Expand Down
26 changes: 14 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
{
"name": "harlighter",
"private": true,
"scripts": {
"build": "turbo build",
"dev": "turbo dev"
"dependencies": {
"@repo/reactor": "workspace:*"
},
"devDependencies": {
"@repo/eslint-config": "workspace:*",
"@repo/typescript-config": "workspace:*",
"prettier": "^3.2.5",
"turbo": "1.13.3"
"@repo/config-eslint": "workspace:*",
"@repo/config-prettier": "workspace:*",
"@repo/config-typescript": "workspace:*",
"turbo": "latest"
},
"packageManager": "[email protected]",
"engines": {
"node": ">=18"
},
"dependencies": {
"@repo/reactor": "workspace:*"
"name": "harlighter",
"packageManager": "[email protected]",
"private": true,
"scripts": {
"build": "turbo build",
"dev": "turbo dev",
"format": "turbo format",
"lint": "turbo lint"
}
}
Comment on lines 1 to 23
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Biome configurations still present in the codebase.

Please ensure that all references to biome have been removed or are intentional:

  • biome.json
  • packages/reactor/utils.ts
  • packages/reactor/main.ts
  • packages/reactor/modifications.ts
  • packages/reactor/tests/main.test.ts
Analysis chain

Verify complete removal of biome.

The changes in this file align well with the PR objectives. However, to ensure a complete transition from biome to ESLint and updated TypeScript configs:

Run the following script to check for any remaining biome configurations:

If any results are found, ensure that these are intentional or remove them as part of this PR.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any remaining biome configurations

# Test: Search for biome-related files or configurations
echo "Searching for biome-related files or configurations:"
fd -H 'biome' -t f

# Test: Search for biome mentions in other configuration files
echo "Searching for biome mentions in configuration files:"
rg -i 'biome' -g '*.json' -g '*.js' -g '*.ts'

Length of output: 759

Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# `@turbo/eslint-config`
# `@turbo/config-eslint`

Collection of internal eslint configurations.
35 changes: 19 additions & 16 deletions packages/eslint-config/next.js → packages/config-eslint/base.js
Original file line number Diff line number Diff line change
@@ -1,35 +1,38 @@
const { resolve } = require("node:path");

const project = resolve(process.cwd(), "tsconfig.json");

/** @type {import("eslint").Linter.Config} */
module.exports = {
extends: [
"eslint:recommended",
"prettier",
require.resolve("@vercel/style-guide/eslint/next"),
"eslint-config-turbo",
"eslint-config-prettier",
"prettier",
],
ignorePatterns: [
// Ignore dotfiles
".*.js",
"node_modules/",
"dist/",
],
globals: {
React: true,
JSX: true,
overrides: [{ files: ["*.js?(x)", "*.ts?(x)"] }],
parser: "@typescript-eslint/parser",
parserOptions: {
project: true,
},
env: {
node: true,
browser: true,
plugins: ["only-warn", "@typescript-eslint/eslint-plugin"],
rules: {
"@typescript-eslint/no-unused-vars": ["error", { argsIgnorePattern: "^_" }],
"no-unused-vars": "off",
},
plugins: ["only-warn"],
settings: {
"import/resolver": {
node: {
extensions: ["•js", ".jsx,", ".ts", ".tsx"],
},
typescript: {
project,
},
},
},
ignorePatterns: [
// Ignore dotfiles
".*.js",
"node_modules/",
],
overrides: [{ files: ["*.js?(x)", "*.ts?(x)"] }],
};
18 changes: 18 additions & 0 deletions packages/config-eslint/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"devDependencies": {
"@eslint/js": "latest",
"@typescript-eslint/eslint-plugin": "latest",
"@typescript-eslint/parser": "latest",
"eslint": "latest",
"eslint-config-turbo": "^1.13.4",
"eslint-plugin-only-warn": "^1.1.0",
"typescript": "^5.3.3"
},
Comment on lines +2 to +10
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Consider pinning dependency versions for better reproducibility.

While using "latest" for dependencies allows you to always have the most recent updates, it can lead to unexpected breaking changes and make builds less reproducible. Consider pinning all dependency versions to specific numbers.

Here's a suggested change:

 {
   "devDependencies": {
-    "@eslint/js": "latest",
-    "@typescript-eslint/eslint-plugin": "latest",
-    "@typescript-eslint/parser": "latest",
-    "eslint": "latest",
+    "@eslint/js": "^8.56.0",
+    "@typescript-eslint/eslint-plugin": "^6.21.0",
+    "@typescript-eslint/parser": "^6.21.0",
+    "eslint": "^8.56.0",
     "eslint-config-turbo": "^1.13.4",
     "eslint-plugin-only-warn": "^1.1.0",
     "typescript": "^5.3.3"
   },
   ...
 }

Note: The versions I've suggested are the latest as of my knowledge cutoff. Please verify and use the most recent stable versions when implementing this change.

Committable suggestion was skipped due to low confidence.

"files": [
"web.js",
"base.js"
],
Comment on lines +11 to +14
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Duplicate module.exports found in configuration files.

Both web.js and base.js contain multiple module.exports declarations, which can cause ESLint to ignore initial configurations. Please consolidate each file to have only one module.exports to ensure configurations are applied correctly.

Analysis chain

Verify the existence of configuration files.

The package includes "web.js" and "base.js" files. Please ensure these files exist in the repository and contain the appropriate ESLint configurations.

Let's verify the existence of these files:


Verify the contents of configuration files.

Please ensure that "web.js" and "base.js" contain the correct ESLint configurations.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if web.js and base.js exist in the packages/config-eslint directory

# Test: Check for the existence of web.js and base.js
fd -p "packages/config-eslint/(web|base).js"

Length of output: 107


Script:

#!/bin/bash
# Description: Output the contents of web.js and base.js for verification

cat packages/config-eslint/web.js packages/config-eslint/base.js

Length of output: 1447

"name": "@repo/config-eslint",
"private": true,
"version": "1.0.0"
}
Loading
Loading