Skip to content

Commit 3db42e5

Browse files
committed
Update local function rules
1 parent feee406 commit 3db42e5

File tree

5 files changed

+26
-25
lines changed

5 files changed

+26
-25
lines changed

.pkgs/configs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"@stylistic/eslint-plugin": "^5.5.0",
2424
"eslint-plugin-de-morgan": "^2.0.0",
2525
"eslint-plugin-function": "^0.0.33",
26-
"eslint-plugin-function-rule": "^0.0.9",
26+
"eslint-plugin-function-rule": "^0.0.10",
2727
"eslint-plugin-jsdoc": "^61.1.12",
2828
"eslint-plugin-perfectionist": "^4.15.1",
2929
"eslint-plugin-regexp": "^2.10.0",

.pkgs/function-rules/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"lint:ts": "tsc --noEmit"
2222
},
2323
"dependencies": {
24-
"eslint-plugin-function-rule": "^0.0.9"
24+
"eslint-plugin-function-rule": "^0.0.10"
2525
},
2626
"devDependencies": {
2727
"eslint": "^9.39.1",

eslint.config.ts

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
} from "@local/configs/eslint";
1414
import { nullishComparison, templateExpression } from "@local/function-rules";
1515
import { recommended as fastImportRecommended } from "eslint-plugin-fast-import";
16-
import { functionRule } from "eslint-plugin-function-rule";
16+
import { defineRule } from "eslint-plugin-function-rule";
1717
import pluginVitest from "eslint-plugin-vitest";
1818
import { defineConfig, globalIgnores } from "eslint/config";
1919
import tseslint from "typescript-eslint";
@@ -53,18 +53,19 @@ export default defineConfig([
5353
},
5454
},
5555
plugins: {
56-
"nullish-comparison": functionRule("v1", nullishComparison()),
57-
"template-expression": functionRule("v1", templateExpression()),
58-
// "template-expression": functionRule("v1", (context) => ({
59-
// TemplateLiteral(node) {
60-
// if (node.loc?.start.line !== node.loc?.end.line) {
61-
// context.report({
62-
// node,
63-
// message: "Avoid multiline template expressions.",
64-
// });
65-
// }
66-
// },
67-
// })),
56+
"nullish-comparison": defineRule("v1", nullishComparison()),
57+
"template-expression": defineRule("v1", templateExpression()),
58+
59+
custom: defineRule("v1", (context) => ({
60+
TemplateLiteral(node) {
61+
if (node.loc?.start.line !== node.loc?.end.line) {
62+
context.report({
63+
node,
64+
message: "Avoid multiline template expressions.",
65+
});
66+
}
67+
},
68+
})),
6869
},
6970
rules: {
7071
"fast-import/no-unused-exports": "off",

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
"effect": "^3.19.3",
7575
"eslint": "^9.39.1",
7676
"eslint-plugin-fast-import": "^1.5.3",
77-
"eslint-plugin-function-rule": "^0.0.9",
77+
"eslint-plugin-function-rule": "^0.0.10",
7878
"eslint-plugin-vitest": "^0.5.4",
7979
"mdxlint": "^1.0.0",
8080
"publint": "^0.3.15",

pnpm-lock.yaml

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)