lintRule error #3284
-
Hi there, I am quite new to the inlang project and I am trying to write my first lintRule. Basically I want to remove certain translation from the checks since they are false positive, for example some statement need to be always equal in all the translations. Since I have not found such an option I tried to write my own lintRule with
(online doc should be update it uses wrong type) and to modifying the file import type { MessageLintRule } from "@inlang/sdk"
import { id, displayName, description } from "../marketplace-manifest.json"
// add all the false positive
const keysToIgnore = [
"multisignatures",
"home"
];
export const messageLintRule: MessageLintRule = {
id: id as MessageLintRule["id"],
displayName,
description,
run: ({ message, settings, report }) => {
if (keysToIgnore.includes(message.id)) {
report({
messageId: message.id,
languageTag: settings.sourceLanguageTag,
body: `False positive for ${message.id}`,
})
}
},
}; In this way it could be easier for me to understand which error are real and which are false postive. After I built it with
and then added it to my settings.json with {
"$schema": "https://inlang.com/schema/project-settings",
"sourceLanguageTag": "en",
"languageTags": ["en", "da", "de", "fr", "it", "pt-BR"],
"modules": [
"./project.inlang/ignore_keys/dist/index.js",
"https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-empty-pattern@latest/dist/index.js",
"https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-identical-pattern@latest/dist/index.js",
"https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-missing-translation@latest/dist/index.js",
"https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-without-source@latest/dist/index.js",
"https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-valid-js-identifier@latest/dist/index.js",
"https://cdn.jsdelivr.net/npm/@inlang/plugin-message-format@latest/dist/index.js",
"https://cdn.jsdelivr.net/npm/@inlang/plugin-m-function-matcher@latest/dist/index.js"
],
"plugin.inlang.messageFormat": {
"pathPattern": "./messages/{languageTag}.json"
}
} As can be seen for the moment I'm trying to do everything local, I have not yet pushed the lintRule to npm. Anyway when I try to run
I get the following error
Thank you in advance for any help and also thank you for all the amazing job you are doing ✨ |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
The problem you have is that the identical pattern lint rule has false positives, correct? |
Beta Was this translation helpful? Give feedback.
Got it. Just in case, there is an
ignore
possibility in the identical pattern rule.You can fix your issue by exporting the lint rule with a default export.
I'll update the docs!