Skip to content

update batch #972

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Jun 2, 2025
Merged
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
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,11 @@ The [below section](#rules) gives details on which rules are enabled by each rul

### No Exceptions

| Name | Description | 💼 | ⚠️ | 🚫 | 🔧 | 💡 | 💭 | ❌ |
| :------------------------------------------------------- | :----------------------------------------------------- | :------------------------------- | :-- | :---- | :-- | :-- | :-- | :-- |
| [no-promise-reject](docs/rules/no-promise-reject.md) | Disallow rejecting promises. | | | | | | | |
| [no-throw-statements](docs/rules/no-throw-statements.md) | Disallow throwing exceptions. | ☑️ ✅ 🔒 ![badge-noExceptions][] | | | | | | |
| [no-try-statements](docs/rules/no-try-statements.md) | Disallow try-catch[-finally] and try-finally patterns. | 🔒 ![badge-noExceptions][] | | ☑️ ✅ | | | | |
| Name | Description | 💼 | ⚠️ | 🚫 | 🔧 | 💡 | 💭 | ❌ |
| :------------------------------------------------------- | :----------------------------------------------------- | :------------------------------- | :-- | :---------------------------- | :-- | :-- | :-- | :-- |
| [no-promise-reject](docs/rules/no-promise-reject.md) | Disallow rejecting promises. | | | | | | | |
| [no-throw-statements](docs/rules/no-throw-statements.md) | Disallow throwing exceptions. | ☑️ ✅ 🔒 ![badge-noExceptions][] | | ![badge-disableTypeChecked][] | | | 💭 | |
| [no-try-statements](docs/rules/no-try-statements.md) | Disallow try-catch[-finally] and try-finally patterns. | 🔒 ![badge-noExceptions][] | | ☑️ ✅ | | | | |

### No Mutations

Expand Down
4 changes: 3 additions & 1 deletion docs/rules/no-throw-statements.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@

# Disallow throwing exceptions (`functional/no-throw-statements`)

💼 This rule is enabled in the following configs: ☑️ `lite`, `noExceptions`, ✅ `recommended`, 🔒 `strict`.
💼🚫 This rule is enabled in the following configs: ☑️ `lite`, `noExceptions`, ✅ `recommended`, 🔒 `strict`. This rule is _disabled_ in the `disableTypeChecked` config.

💭 This rule requires [type information](https://typescript-eslint.io/linting/typed-linting).

<!-- end auto-generated rule header -->
<!-- markdownlint-restore -->
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,13 @@
"@semantic-release/github": "11.0.3",
"@semantic-release/npm": "12.0.1",
"@semantic-release/release-notes-generator": "14.0.3",
"@stylistic/eslint-plugin": "4.2.0",
"@stylistic/eslint-plugin": "4.4.0",
"@types/node": "18.19.100",
"@typescript-eslint/eslint-plugin": "8.31.1",
"@typescript-eslint/parser": "8.31.1",
"@vitest/coverage-v8": "3.1.2",
"@vitest/eslint-plugin": "1.1.44",
"cspell": "8.19.4",
"cspell": "9.0.2",
"dedent": "1.6.0",
"eslint": "9.25.1",
"eslint-config-prettier": "10.1.5",
Expand Down Expand Up @@ -136,7 +136,7 @@
"husky": "9.1.7",
"jsonc-eslint-parser": "2.4.0",
"knip": "5.55.1",
"lint-staged": "15.5.2",
"lint-staged": "16.1.0",
"markdownlint-cli2": "0.18.0",
"prettier": "3.5.3",
"rimraf": "6.0.1",
Expand Down
612 changes: 359 additions & 253 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/rules/no-throw-statements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const meta: NamedCreateRuleCustomMeta<keyof typeof errorMessages, RawOptions> =
description: "Disallow throwing exceptions.",
recommended: "recommended",
recommendedSeverity: "error",
requiresTypeChecking: false,
requiresTypeChecking: true,
},
messages: errorMessages,
schema,
Expand Down
19 changes: 19 additions & 0 deletions src/rules/prefer-tacit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,18 @@ function isCallerViolation(
.some((signature) => signature.parameters.length === caller.arguments.length);
}

/**
* Is the given node a direct child of a getter.
*/
function isDirectChildOfGetter(node: TSESTree.Node): boolean {
const { parent } = node;
if (parent?.type !== TSESTree.AST_NODE_TYPES.Property) {
return false;
}

return parent.kind === "get";
}

/**
* Get the fixes for a call to a reference violation.
*/
Expand Down Expand Up @@ -260,6 +272,13 @@ function checkFunction(
context: Readonly<RuleContext<keyof typeof errorMessages, RawOptions>>,
options: RawOptions,
): RuleResult<keyof typeof errorMessages, RawOptions> {
if (isDirectChildOfGetter(node)) {
return {
context,
descriptors: [],
};
}

return {
context,
descriptors: [
Expand Down
2 changes: 1 addition & 1 deletion src/settings/immutability.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ declare module "@typescript-eslint/utils" {
from?: Immutability | keyof typeof Immutability;
};

// eslint-disable-next-line ts/consistent-type-definitions, ts/no-shadow
// eslint-disable-next-line ts/consistent-type-definitions
interface SharedConfigurationSettings {
immutability?: {
overrides?:
Expand Down
17 changes: 17 additions & 0 deletions tests/rules/prefer-tacit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,23 @@ describe(name, () => {
`);
});

it("doesn't report getters", async () => {
await valid(dedent`
const foo = () => {
const getBar = () => 1;
const setBar = (value: number) => {};
return {
get baz() {
return getBar();
},
set baz(value) {
setBar(value);
},
};
};
`);
});

describe("options", () => {
describe("checkMemberExpressions", () => {
it("doesn't report member expressions when disabled", async () => {
Expand Down
Loading