Skip to content

Commit

Permalink
fix: fixed invalid rules for 'disable-debug', 'disable-dom', and 'dis…
Browse files Browse the repository at this point in the history
…able-web-apis' configs, closes #923
  • Loading branch information
Rel1cx committed Jan 21, 2025
1 parent 3a81b53 commit d24418f
Show file tree
Hide file tree
Showing 27 changed files with 31 additions and 127 deletions.
5 changes: 0 additions & 5 deletions eslint.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import eslintPluginJsdoc from "eslint-plugin-jsdoc";
import eslintPluginLocal from "@workspace/eslint-plugin-local";
import eslintPluginPerfectionist from "eslint-plugin-perfectionist";
import eslintPluginRegexp from "eslint-plugin-regexp";
import eslintPluginSafeTypeScript from "@susisu/eslint-plugin-safe-typescript";
import eslintPluginSimpleImportSort from "eslint-plugin-simple-import-sort";
import eslintPluginUnicorn from "eslint-plugin-unicorn";
import eslintPluginVitest from "eslint-plugin-vitest";
Expand Down Expand Up @@ -68,9 +67,6 @@ const enableTypeCheckedRules = {
...tseslint.configs.strictTypeCheckedOnly
.map((x) => x.rules)
.reduce((a, b) => ({ ...a, ...b }), {}),
...eslintPluginSafeTypeScript.configs.recommended.rules,
"@susisu/safe-typescript/no-unsafe-object-property-check": "off",
"@susisu/safe-typescript/no-unsafe-object-property-overwrite": "off",
"@typescript-eslint/consistent-type-exports": "error",
"@typescript-eslint/strict-boolean-expressions": ["error", {
allowAny: false,
Expand Down Expand Up @@ -133,7 +129,6 @@ export default tseslint.config(
},
plugins: {
["@stylistic"]: eslintStylistic,
["@susisu/safe-typescript"]: eslintPluginSafeTypeScript,
["local"]: eslintPluginLocal,
["simple-import-sort"]: eslintPluginSimpleImportSort,
["unicorn"]: eslintPluginUnicorn,
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@eslint-react/monorepo",
"version": "1.24.1-next.0",
"version": "1.24.1-beta.0",
"private": true,
"description": "Monorepo for eslint-plugin-react-[x, dom, web-api, hooks-extra, naming-convention].",
"keywords": [
Expand Down Expand Up @@ -56,7 +56,6 @@
"@eslint/markdown": "^6.2.1",
"@napi-rs/canvas": "^0.1.65",
"@stylistic/eslint-plugin": "^2.13.0",
"@susisu/eslint-plugin-safe-typescript": "^0.9.2",
"@swc/core": "^1.10.9",
"@tsconfig/node22": "^22.0.0",
"@tsconfig/strictest": "^2.0.5",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@eslint-react/core",
"version": "1.24.1-next.0",
"version": "1.24.1-beta.0",
"description": "ESLint React's ESLint utility module for static analysis of React core APIs and Patterns.",
"homepage": "https://github.com/Rel1cx/eslint-react",
"bugs": {
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/eslint-plugin-react-debug/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eslint-plugin-react-debug",
"version": "1.24.1-next.0",
"version": "1.24.1-beta.0",
"description": "ESLint React's ESLint plugin for debugging related rules.",
"keywords": [
"react",
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/eslint-plugin-react-dom/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eslint-plugin-react-dom",
"version": "1.24.1-next.0",
"version": "1.24.1-beta.0",
"description": "ESLint React's ESLint plugin for React DOM related rules.",
"keywords": [
"react",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eslint-plugin-react-hooks-extra",
"version": "1.24.1-next.0",
"version": "1.24.1-beta.0",
"description": "ESLint React's ESLint plugin for React Hooks related rules.",
"keywords": [
"react",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eslint-plugin-react-naming-convention",
"version": "1.24.1-next.0",
"version": "1.24.1-beta.0",
"description": "ESLint React's ESLint plugin for naming convention related rules.",
"keywords": [
"react",
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/eslint-plugin-react-web-api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eslint-plugin-react-web-api",
"version": "1.24.1-next.0",
"version": "1.24.1-beta.0",
"description": "ESLint React's ESLint plugin for interacting with Web APIs",
"keywords": [
"react",
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/eslint-plugin-react-x/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eslint-plugin-react-x",
"version": "1.24.1-next.0",
"version": "1.24.1-beta.0",
"description": "A set of composable ESLint rules for libraries and frameworks that use React as a UI runtime.",
"keywords": [
"react",
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/eslint-plugin/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@eslint-react/eslint-plugin",
"version": "1.24.1-next.0",
"version": "1.24.1-beta.0",
"description": "A set of composable ESLint rules for libraries and frameworks that use React as a UI runtime.",
"keywords": [
"react",
Expand Down
5 changes: 3 additions & 2 deletions packages/plugins/eslint-plugin/src/configs/disable-debug.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { entries, fromEntries } from "../utils";
import type { RulePreset } from "@eslint-react/shared";

import { rules as debugRules } from "./debug";

export const name = "@eslint-react/disable-debug";

export const rules = fromEntries(entries(debugRules).map(([key]) => [key, "off"] as const));
export const rules: RulePreset = Object.fromEntries(Object.entries(debugRules).map(([rule]) => [rule, "off"]));
5 changes: 3 additions & 2 deletions packages/plugins/eslint-plugin/src/configs/disable-dom.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { entries, fromEntries } from "../utils";
import type { RulePreset } from "@eslint-react/shared";

import { rules as domRules } from "./dom";

export const name = "@eslint-react/disable-dom";

export const rules = fromEntries(entries(domRules).map(([key]) => [key, "off"] as const));
export const rules: RulePreset = Object.fromEntries(Object.entries(domRules).map(([key]) => [key, "off"] as const));
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { RulePreset } from "@eslint-react/shared";

export const name = "@eslint-react/disable-type-checked";

export const rules = {
export const rules: RulePreset = {
"@eslint-react/no-leaked-conditional-rendering": "off",
"@eslint-react/prefer-read-only-props": "off",
} as const satisfies RulePreset;
};
5 changes: 3 additions & 2 deletions packages/plugins/eslint-plugin/src/configs/disable-web-api.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { entries, fromEntries } from "../utils";
import type { RulePreset } from "@eslint-react/shared";

import { rules as webApiRules } from "./web-api";

export const name = "@eslint-react/disable-web-api";

export const rules = fromEntries(entries(webApiRules).map(([key]) => [key, "off"] as const));
export const rules: RulePreset = Object.fromEntries(Object.entries(webApiRules).map(([key]) => [key, "off"] as const));
7 changes: 4 additions & 3 deletions packages/plugins/eslint-plugin/src/configs/off.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { entries, fromEntries } from "../utils";
import type { RulePreset } from "@eslint-react/shared";

import { rules as allRules } from "./all";
import { rules as disableTypeCheckedRules } from "./disable-type-checked";

export const name = "@eslint-react/off";

export const rules = {
...fromEntries(entries(allRules).map(([key]) => [key, "off"] as const)),
export const rules: RulePreset = {
...Object.fromEntries(Object.entries(allRules).map(([key]) => [key, "off"] as const)),
...disableTypeCheckedRules,
};
54 changes: 0 additions & 54 deletions packages/plugins/eslint-plugin/src/utils/entries.ts

This file was deleted.

1 change: 0 additions & 1 deletion packages/plugins/eslint-plugin/src/utils/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export * from "./entries";
export * from "./pad-keys-left";
export * from "./transform-keys";
export * from "./type-of";
1 change: 0 additions & 1 deletion packages/plugins/eslint-plugin/src/utils/pad-keys-left.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@ export function padKeysLeft<const A, const B extends string = "">(
obj: A,
left: B,
): PadKeysLeft<A, B> {
// eslint-disable-next-line @susisu/safe-typescript/no-type-assertion
return transformKeys(obj, (key) => `${left}${key}`) as never;
}
1 change: 0 additions & 1 deletion packages/plugins/eslint-plugin/src/utils/transform-keys.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @susisu/safe-typescript/no-type-assertion */
// Copied from https://github.com/gustavoguichard/string-ts/blob/9dd444f03fdfa225f1643e6f1f8c18f9480224bb/src/utils/object-keys/transform-keys.ts#L12

import { typeOf } from "./type-of";
Expand Down
1 change: 0 additions & 1 deletion packages/plugins/eslint-plugin/src/utils/type-of.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @susisu/safe-typescript/no-type-assertion */
/**
* This is an enhanced version of the typeof operator to check the type of more complex values.
* In this case we just mind about arrays and objects. We can add more on demand.
Expand Down
2 changes: 1 addition & 1 deletion packages/shared/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@eslint-react/shared",
"version": "1.24.1-next.0",
"version": "1.24.1-beta.0",
"description": "ESLint React's Shared constants and functions.",
"homepage": "https://github.com/Rel1cx/eslint-react",
"bugs": {
Expand Down
1 change: 0 additions & 1 deletion packages/shared/src/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ export interface ESLintReactSettingsNormalized {
*/
export function unsafeDecodeSettings(data: unknown): PartialDeep<ESLintReactSettings> {
// @ts-expect-error - skip type checking for unsafe cast
// eslint-disable-next-line @susisu/safe-typescript/no-type-assertion
return (data?.["react-x"] ?? {}) as PartialDeep<ESLintReactSettings>;
}

Expand Down
2 changes: 1 addition & 1 deletion packages/utilities/ast/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@eslint-react/ast",
"version": "1.24.1-next.0",
"version": "1.24.1-beta.0",
"description": "ESLint React's TSESTree AST utility module.",
"homepage": "https://github.com/Rel1cx/eslint-react",
"bugs": {
Expand Down
2 changes: 1 addition & 1 deletion packages/utilities/eff/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@eslint-react/eff",
"version": "1.24.1-next.0",
"version": "1.24.1-beta.0",
"description": "JavaScript and TypeScript utilities (previously some re-exports of the effect library).",
"homepage": "https://github.com/Rel1cx/eslint-react",
"bugs": {
Expand Down
2 changes: 1 addition & 1 deletion packages/utilities/jsx/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@eslint-react/jsx",
"version": "1.24.1-next.0",
"version": "1.24.1-beta.0",
"description": "ESLint React's TSESTree AST utility module for static analysis of JSX.",
"homepage": "https://github.com/Rel1cx/eslint-react",
"bugs": {
Expand Down
2 changes: 1 addition & 1 deletion packages/utilities/var/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@eslint-react/var",
"version": "1.24.1-next.0",
"version": "1.24.1-beta.0",
"description": "ESLint React's TSESTree AST utility module for static analysis of variables",
"homepage": "https://github.com/Rel1cx/eslint-react",
"bugs": {
Expand Down
39 changes: 2 additions & 37 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d24418f

Please sign in to comment.