Enable oxlint restriction ruleset (#34307)
* Remove stale max-len disablements * Remove stale camelCase & naming-convention disablements * Remove stale ban-ts-comment disablements * Remove stale no-var disablements * Remove stale no-empty-property disablements * Remove stale react rule disablements * Remove stale no-constant-condition disablements * Remove stale no-unused-vars disablements * Remove stale disablements for disabled rules * fixup camelcase * Remove dead code * Tidy code * Tweak oxlint config * Use oxlint to apply jsx/tsx extension consistently * Fix import * Fix imports * Rename affected snapshots * Update more imports * Enable restriction ruleset * Make code comply with new rules * Make code comply with react/button-has-type * Make code comply with typescript/non-nullable-type-assertion-style * Comply with node/no-process-env * Comply with unicorn/prefer-node-protocol * Comply with unicorn/import-style * Comply with unicorn/no-process-exit * Comply with no-proto * Comply with node/handle-callback-err * Comply with import/no-commonjs * Comply with node/no-path-concat * Comply with unicorn/no-length-as-slice-end * Comply with unicorn/no-document-cookie * Comply with unicorn/prefer-module * Comply with typescript/prefer-literal-enum-member * Comply with jsx-a11y/anchor-ambiguous-text * Tweak oxlint config * Fix resolves * Iterate * Iterate * Iterate * Iterate * Iterate * Iterate * Iterate
This commit is contained in:
@@ -8,11 +8,16 @@ Please see LICENSE in the repository root for full details.
|
||||
|
||||
import * as fs from "node:fs";
|
||||
import { exec } from "node:child_process";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
const includeJSSDK = process.argv.includes("--include-js-sdk");
|
||||
const ignore: string[] = [];
|
||||
|
||||
ignore.push(...Object.values<string>(JSON.parse(fs.readFileSync(`${__dirname}/../components.json`, "utf-8"))));
|
||||
ignore.push(
|
||||
...Object.values<string>(
|
||||
JSON.parse(fs.readFileSync(fileURLToPath(import.meta.resolve("../components.json")), "utf-8")),
|
||||
),
|
||||
);
|
||||
ignore.push("/index.ts");
|
||||
ignore.push("/jest-matrix-react.tsx");
|
||||
ignore.push("/customisations/");
|
||||
|
||||
@@ -12,13 +12,12 @@ Please see LICENSE files in the repository root for full details.
|
||||
// type-aware usage analysis, but setting names are unique enough in practice.
|
||||
|
||||
import * as fs from "node:fs";
|
||||
import * as path from "node:path";
|
||||
import path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { execFileSync } from "node:child_process";
|
||||
import ts from "typescript";
|
||||
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||
const ROOT = path.resolve(__dirname, "..");
|
||||
const ROOT = fileURLToPath(import.meta.resolve(".."));
|
||||
const SETTINGS_DIR = path.join(ROOT, "apps/web/src/settings");
|
||||
const SETTINGS_FILE = path.join(SETTINGS_DIR, "Settings.tsx");
|
||||
|
||||
|
||||
+11
-11
@@ -14,13 +14,13 @@ Please see LICENSE files in the repository root for full details.
|
||||
// This tool is a helpful substitute to `pnpm link` as that modifies the package.json & pnpm-lock.yaml files.
|
||||
|
||||
import * as fs from "node:fs/promises";
|
||||
import { join, dirname } from "node:path";
|
||||
import path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { execSync } from "node:child_process";
|
||||
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||
const configPath = join(__dirname, "..", ".link-config");
|
||||
const nodeModulesPath = join(__dirname, "..", "node_modules");
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||
const configPath = path.join(__dirname, "..", ".link-config");
|
||||
const nodeModulesPath = path.join(__dirname, "..", "node_modules");
|
||||
|
||||
try {
|
||||
if (process.env.PLAYWRIGHT_COMMON_DOCKER) process.exit(0); // Skip in docker env
|
||||
@@ -28,9 +28,9 @@ try {
|
||||
const configFile = await fs.readFile(configPath, "utf-8");
|
||||
for (const line of configFile.trim().split("\n")) {
|
||||
if (!line || line.startsWith("#")) continue;
|
||||
const [dependency, path, dir] = line.split("=");
|
||||
const nodeModules = dir ? join(dir, "node_modules") : nodeModulesPath;
|
||||
const dependencyPath = join(nodeModules, dependency);
|
||||
const [dependency, targetPath, dir] = line.split("=");
|
||||
const nodeModules = dir ? path.join(dir, "node_modules") : nodeModulesPath;
|
||||
const dependencyPath = path.join(nodeModules, dependency);
|
||||
|
||||
try {
|
||||
try {
|
||||
@@ -38,7 +38,7 @@ try {
|
||||
console.log(`Existing is ${stat.isSymbolicLink() ? "symlink" : "directory"}`);
|
||||
if (stat.isSymbolicLink()) {
|
||||
const linkPath = await fs.readlink(dependencyPath);
|
||||
if (linkPath === path) {
|
||||
if (linkPath === targetPath) {
|
||||
// already done
|
||||
continue;
|
||||
} else {
|
||||
@@ -56,10 +56,10 @@ try {
|
||||
}
|
||||
}
|
||||
|
||||
console.log(`Linking ${dependency} to ${path}`);
|
||||
await fs.symlink(path, dependencyPath, "junction"); // use a junction type to avoid EPERM errors on Windows
|
||||
console.log(`Linking ${dependency} to ${targetPath}`);
|
||||
await fs.symlink(targetPath, dependencyPath, "junction"); // use a junction type to avoid EPERM errors on Windows
|
||||
|
||||
const pkgJson = JSON.parse(await fs.readFile(join(path, "package.json"), "utf-8"));
|
||||
const pkgJson = JSON.parse(await fs.readFile(path.join(targetPath, "package.json"), "utf-8"));
|
||||
const pkgManager =
|
||||
pkgJson.devEngines?.packageManager?.name ?? pkgJson.packageManager?.split("@").at(0) ?? "yarn";
|
||||
// pnpm install may have wiped out the `node_modules` dir so we have to restore it
|
||||
|
||||
Reference in New Issue
Block a user