Skip to content

Commit cc067a7

Browse files
committed
refactor: minor improvements
1 parent e51e377 commit cc067a7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+271
-280
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.10.11
1+
0.10.12-beta.0

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@eslint-react/monorepo",
3-
"version": "0.10.11",
3+
"version": "0.10.12-beta.0",
44
"description": "ESLint React's monorepo. More than 50 ESLint rules to catch common mistakes and improve your React code. Rewritten from the scratch (mostly).",
55
"keywords": [
66
"eslint",

packages/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@eslint-react/core",
3-
"version": "0.10.11",
3+
"version": "0.10.12-beta.0",
44
"description": "ESLint React's ESLint utility module for static analysis of React core APIs and Patterns.",
55
"homepage": "https://github.com/rel1cx/eslint-react",
66
"bugs": {

packages/plugins/eslint-plugin-debug/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@eslint-react/eslint-plugin-debug",
3-
"version": "0.10.11",
3+
"version": "0.10.12-beta.0",
44
"description": "ESLint React's ESLint plugin for debugging related rules.",
55
"homepage": "https://github.com/rel1cx/eslint-react",
66
"bugs": {

packages/plugins/eslint-plugin-jsx/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@eslint-react/eslint-plugin-jsx",
3-
"version": "0.10.11",
3+
"version": "0.10.12-beta.0",
44
"description": "ESLint React's ESLint plugin for JSX related rules.",
55
"homepage": "https://github.com/rel1cx/eslint-react",
66
"bugs": {

packages/plugins/eslint-plugin-jsx/src/rules/max-depth.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Ported from https://github.com/jsx-eslint/eslint-plugin-react/blob/b4b7497eaf49360449883d5fe80e7590e69ae143/lib/rules/jsx-max-depth.js
22
// with some modifications, credits to the original authors.
33
import { is, isOneOf, NodeType } from "@eslint-react/ast";
4-
import { _, F, O } from "@eslint-react/tools";
4+
import { F, O, Prd } from "@eslint-react/tools";
55
import type { TSESTree } from "@typescript-eslint/types";
66
import type { ESLintUtils } from "@typescript-eslint/utils";
77
import type { JSONSchema4 } from "@typescript-eslint/utils/json-schema";
@@ -106,7 +106,7 @@ export default createRule<Options, MessageID>({
106106
defaultOptions,
107107
create(context) {
108108
const options = context.options[0] ?? defaultOptions[0];
109-
const maxDepth = _.isNumber(options) ? options : options.max ?? defaultOptions[0].max;
109+
const maxDepth = Prd.isNumber(options) ? options : options.max ?? defaultOptions[0].max;
110110

111111
return {
112112
"JSXElement, JSXFragment": F.flow(getChecker(maxDepth), O.map(context.report)),

packages/plugins/eslint-plugin-naming-convention/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@eslint-react/eslint-plugin-naming-convention",
3-
"version": "0.10.11",
3+
"version": "0.10.12-beta.0",
44
"description": "ESLint React's ESLint plugin for naming convention related rules.",
55
"homepage": "https://github.com/rel1cx/eslint-react",
66
"bugs": {

packages/plugins/eslint-plugin-naming-convention/src/rules/component-name.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { getClassIdentifier, getFunctionIdentifier } from "@eslint-react/ast";
22
import { useComponentCollector, useComponentCollectorLegacy } from "@eslint-react/core";
33
import { elementType } from "@eslint-react/jsx";
44
import { RE_CONSTANT_CASE, RE_PASCAL_CASE } from "@eslint-react/shared";
5-
import { _, O } from "@eslint-react/tools";
5+
import { O, Prd } from "@eslint-react/tools";
66
import { type ESLintUtils } from "@typescript-eslint/utils";
77
import type { JSONSchema4 } from "@typescript-eslint/utils/json-schema";
88
import { type ConstantCase } from "string-ts";
@@ -76,8 +76,8 @@ export default createRule<Options, MessageID>({
7676
defaultOptions,
7777
create(context) {
7878
const options = context.options[0] ?? defaultOptions[0];
79-
const excepts = _.isString(options) ? [] : options.excepts ?? [];
80-
const rule = _.isString(options) ? options : options.rule ?? "PascalCase";
79+
const excepts = Prd.isString(options) ? [] : options.excepts ?? [];
80+
const rule = Prd.isString(options) ? options : options.rule ?? "PascalCase";
8181

8282
function validate(name: string, casing: Case = rule, ignores: readonly string[] = excepts) {
8383
// eslint-disable-next-line security/detect-non-literal-regexp

packages/plugins/eslint-plugin-naming-convention/src/rules/filename-extension.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { ESLintSettingsSchema, parseSchema } from "@eslint-react/shared";
2-
import { _, MutRef } from "@eslint-react/tools";
2+
import { MutRef, Prd } from "@eslint-react/tools";
33
import type { ESLintUtils } from "@typescript-eslint/utils";
44
import type { JSONSchema4 } from "@typescript-eslint/utils/json-schema";
55

@@ -77,8 +77,8 @@ export default createRule<Options, MessageID>({
7777
create(context) {
7878
const configs = parseSchema(ESLintSettingsSchema, context.settings).eslintReact;
7979
const options = context.options[0] ?? defaultOptions[0];
80-
const allow = _.isObject(options) ? options.allow : options;
81-
const extensions = _.isObject(options) && "extensions" in options
80+
const allow = Prd.isObject(options) ? options.allow : options;
81+
const extensions = Prd.isObject(options) && "extensions" in options
8282
? options.extensions
8383
: configs?.jsx?.extensions ?? defaultOptions[0].extensions;
8484

packages/plugins/eslint-plugin-naming-convention/src/rules/filename.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
RE_PASCAL_CASE,
77
RE_SNAKE_CASE,
88
} from "@eslint-react/shared";
9-
import { _ } from "@eslint-react/tools";
9+
import { Prd } from "@eslint-react/tools";
1010
import type { ESLintUtils } from "@typescript-eslint/utils";
1111
import type { JSONSchema4 } from "@typescript-eslint/utils/json-schema";
1212
import path from "pathe";
@@ -94,9 +94,9 @@ export default createRule<Options, MessageID>({
9494
create(context) {
9595
const configs = parseSchema(ESLintSettingsSchema, context.settings).eslintReact;
9696
const options = context.options[0] ?? defaultOptions[0];
97-
const rule = _.isString(options) ? options : options.rule ?? "PascalCase";
98-
const excepts = _.isString(options) ? [] : options.excepts ?? [];
99-
const extensions = _.isObject(options) && "extensions" in options
97+
const rule = Prd.isString(options) ? options : options.rule ?? "PascalCase";
98+
const excepts = Prd.isString(options) ? [] : options.excepts ?? [];
99+
const extensions = Prd.isObject(options) && "extensions" in options
100100
? options.extensions
101101
: configs?.jsx?.extensions ?? defaultOptions[0].extensions;
102102

0 commit comments

Comments
 (0)