Skip to content

Commit

Permalink
refactor: overall code optimisation (#241)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rel1cx authored Dec 18, 2023
1 parent 61b30bd commit c70b435
Show file tree
Hide file tree
Showing 168 changed files with 5,022 additions and 13,288 deletions.
6 changes: 1 addition & 5 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,6 @@ module.exports = defineConfig({
varsIgnorePattern: "(^_)|(^ESLintUtils$)",
},
],
"@typescript-eslint/prefer-readonly": "warn",
"@typescript-eslint/prefer-nullish-coalescing": "warn",
"@typescript-eslint/strict-boolean-expressions": "error",
"@typescript-eslint/no-empty-interface": "off",
"@typescript-eslint/consistent-type-definitions": ["error", "interface"],
"@susisu/safe-typescript/no-unsafe-object-property-check": "off",
"import-access/jsdoc": ["error"],
"jsdoc/require-jsdoc": "off",
Expand All @@ -82,6 +77,7 @@ module.exports = defineConfig({
"perfectionist/sort-exports": "off",
"perfectionist/sort-imports": "off",
"perfectionist/sort-named-imports": "off",
"perfectionist/sort-named-exports": "off",
"perfectionist/sort-object-types": "off",
"perfectionist/sort-objects": [
"warn",
Expand Down
2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ ESLint React does not accept contributions of a purely utilitarian nature.
- `@eslint-react/tools`: Std library and primitives.
- `@eslint-react/types`: Type definitions.
- `@eslint-react/shared`: Shared data and constants.
- `@eslint-react/utils`: Utilities for ESLint React.
- `@eslint-react/eslint-utils`: Utilities for ESLint React.
- `@eslint-react/ast`: TSESTree AST primitive utility module.
- `@eslint-react/jsx`: TSESTree AST utility module for static analysis of JSX.
- `@eslint-react/core`: ESLint utility module for static analysis of React core API and Patterns.
Expand Down
3 changes: 2 additions & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
save-exact=true
registry=https://registry.npmjs.org
auto-install-peers=true
save-exact=true
shell-emulator=true
8 changes: 4 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,11 @@

- `@eslint-react/shared`
- ⚠️ Change `ESLintReactSettingsSchema`.
- Move utils from `@eslint-react/shared` to `@eslint-react/utils`.
- Move utils from `@eslint-react/shared` to `@eslint-react/eslint-utils`.
- Remove `JSX_EXTENSIONS` from `@eslint-react/shared`.

- `@eslint-react/monorepo`
- Add `@eslint-react/utils` package.
- Add `@eslint-react/eslint-utils` package.
- Add `format:package-json` script.
- Update `bun` to `1.0.17`.
- Update `vitest` to `1.0.4`.
Expand Down Expand Up @@ -145,10 +145,10 @@
#### 🏠 Internal

- `@eslint-react/shared`
- Move utils from `@eslint-react/shared` to `@eslint-react/utils`.
- Move utils from `@eslint-react/shared` to `@eslint-react/eslint-utils`.

- `@eslint-react/monorepo`
- Add `@eslint-react/utils` package.
- Add `@eslint-react/eslint-utils` package.

#### Authors: 1

Expand Down
4 changes: 2 additions & 2 deletions examples/with-flat-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
"@tsconfig/strictest": "2.0.2",
"@types/react": "18.2.45",
"@types/react-dom": "18.2.17",
"@typescript-eslint/eslint-plugin": "6.14.0",
"@typescript-eslint/parser": ">=6.14.0",
"@typescript-eslint/eslint-plugin": "6.15.0",
"@typescript-eslint/parser": ">=6.15.0",
"@vitejs/plugin-react": "4.2.1",
"eslint": ">=8.56.0",
"eslint-plugin-react-hooks": "4.6.0",
Expand Down
4 changes: 2 additions & 2 deletions examples/with-legacy-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
"@tsconfig/strictest": "2.0.2",
"@types/react": "18.2.45",
"@types/react-dom": "18.2.17",
"@typescript-eslint/eslint-plugin": "6.14.0",
"@typescript-eslint/parser": ">=6.14.0",
"@typescript-eslint/eslint-plugin": "6.15.0",
"@typescript-eslint/parser": ">=6.15.0",
"@vitejs/plugin-react": "4.2.1",
"eslint": ">=8.56.0",
"eslint-plugin-react-hooks": "4.6.0",
Expand Down
6 changes: 0 additions & 6 deletions knip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@ export default {
"eslint-plugin-jsdoc",
"swc3",
"@eslint-react/types",
"dedent",
"effect",
"rambda",
"string-ts",
"ts-pattern",
"tslib",
],
ignoreWorkspaces: [
"examples/*",
Expand Down
32 changes: 16 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,31 +61,31 @@
"@rollup/plugin-json": "6.1.0",
"@rollup/plugin-node-resolve": "15.2.3",
"@rollup/plugin-typescript": "11.1.5",
"@swc/core": "1.3.100",
"@swc/core": "1.3.101",
"@tsconfig/node20": "20.1.2",
"@tsconfig/strictest": "2.0.2",
"@types/node": "20.10.4",
"@typescript-eslint/eslint-plugin": "6.14.0",
"@typescript-eslint/parser": ">=6.14.0",
"@typescript-eslint/rule-tester": "6.14.0",
"@types/node": "20.10.5",
"@typescript-eslint/eslint-plugin": "6.15.0",
"@typescript-eslint/parser": ">=6.15.0",
"@typescript-eslint/rule-tester": "6.15.0",
"@vitest/ui": "1.0.4",
"bun": "1.0.18",
"bun-types": "1.0.18",
"cspell": "8.1.3",
"dedent": "1.5.1",
"dprint": "0.43.2",
"dprint": "0.44.0",
"effect": "2.0.0-next.60",
"eslint": ">=8.56.0",
"eslint-config-with-tsconfig": "2.9.170",
"eslint-config-with-tsconfig": "2.9.200",
"eslint-plugin-eslint-plugin": "5.2.1",
"eslint-plugin-filenames-simple": "0.9.0",
"eslint-plugin-functional": "6.0.0",
"eslint-plugin-jsdoc": "46.9.1",
"eslint-plugin-total-functions": "7.1.0",
"eslint-plugin-vitest": "0.3.17",
"eslint-plugin-vitest": "0.3.18",
"fast-equals": "5.0.1",
"husky": "8.0.3",
"knip": "3.8.1",
"knip": "3.8.2",
"markdownlint": "0.32.1",
"pathe": "1.1.1",
"publint": "0.2.6",
Expand All @@ -108,7 +108,7 @@
"vitest": "1.0.4"
},
"peerDependencies": {
"@typescript-eslint/parser": ">=6.14.0",
"@typescript-eslint/parser": ">=6.15.0",
"eslint": ">=8.56.0",
"typescript": ">=5.3.3"
},
Expand All @@ -122,12 +122,12 @@
},
"pnpm": {
"overrides": {
"@typescript-eslint/parser": ">=6.14.0",
"@typescript-eslint/scope-manager": "6.14.0",
"@typescript-eslint/type-utils": "6.14.0",
"@typescript-eslint/types": "6.14.0",
"@typescript-eslint/utils": "6.14.0",
"@typescript-eslint/eslint-plugin": "6.14.0",
"@typescript-eslint/parser": ">=6.15.0",
"@typescript-eslint/scope-manager": "6.15.0",
"@typescript-eslint/type-utils": "6.15.0",
"@typescript-eslint/types": "6.15.0",
"@typescript-eslint/utils": "6.15.0",
"@typescript-eslint/eslint-plugin": "6.15.0",
"eslint": ">=8.56.0",
"effect": "2.0.0-next.60",
"next": "14.0.4",
Expand Down
251 changes: 6 additions & 245 deletions packages/ast/docs/README.md

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions packages/ast/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,12 @@
"publish": "pnpm run build && pnpm run lint:publish"
},
"dependencies": {
"@eslint-community/eslint-utils": "4.4.0",
"@eslint-react/shared": "workspace:*",
"@eslint-react/tools": "workspace:*",
"@eslint-react/types": "workspace:*",
"@typescript-eslint/scope-manager": "6.14.0",
"@typescript-eslint/types": "6.14.0",
"@typescript-eslint/utils": "6.14.0",
"@typescript-eslint/scope-manager": "6.15.0",
"@typescript-eslint/types": "6.15.0",
"@typescript-eslint/utils": "6.15.0",
"rambda": "8.6.0",
"string-ts": "1.3.3"
}
Expand Down
1 change: 0 additions & 1 deletion packages/ast/src/assignment/index.ts

This file was deleted.

34 changes: 0 additions & 34 deletions packages/ast/src/assignment/is-unstable-assignment-pattern.ts

This file was deleted.

10 changes: 5 additions & 5 deletions packages/ast/src/call/is.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { M } from "@eslint-react/tools";
import type { TSESTree } from "@typescript-eslint/types";
import { isMatching } from "ts-pattern";

import { NodeType } from "../node";

Expand All @@ -11,7 +11,7 @@ export function unsafeIsToStringCall(node: TSESTree.Node): node is
& { property: TSESTree.Identifier & { name: "toString" } };
}
{
return M.isMatching({
return isMatching({
type: NodeType.CallExpression,
callee: {
type: NodeType.MemberExpression,
Expand All @@ -29,7 +29,7 @@ export function unsafeIsStringCall(node: TSESTree.Node): node is
callee: TSESTree.Identifier & { name: "String" };
}
{
return M.isMatching({
return isMatching({
type: NodeType.CallExpression,
callee: {
type: NodeType.Identifier,
Expand All @@ -44,7 +44,7 @@ export function unsafeIsStringCall(node: TSESTree.Node): node is
* @returns `true` if node is directly inside `Array.from` call, `false` if not
*/
export function unsafeIsArrayFromCall(node: TSESTree.Node | null): node is TSESTree.CallExpression {
return M.isMatching({
return isMatching({
type: NodeType.CallExpression,
callee: {
type: NodeType.MemberExpression,
Expand All @@ -64,7 +64,7 @@ export function unsafeIsArrayFromCall(node: TSESTree.Node | null): node is TSEST
* @returns `true` if node is directly inside `map` call, `false` if not
*/
export function unsafeIsMapCall(node: TSESTree.Node | null): node is TSESTree.CallExpression {
return M.isMatching({
return isMatching({
callee: {
type: NodeType.MemberExpression,
property: {
Expand Down
119 changes: 0 additions & 119 deletions packages/ast/src/eslint-community-eslint-utils.ts

This file was deleted.

Loading

0 comments on commit c70b435

Please sign in to comment.