Skip to content

Commit

Permalink
refactor: use ts imports
Browse files Browse the repository at this point in the history
  • Loading branch information
radiovisual committed Sep 27, 2024
1 parent 4163bfd commit 8128e02
Show file tree
Hide file tree
Showing 54 changed files with 138 additions and 138 deletions.
6 changes: 3 additions & 3 deletions src/classes/logger.class.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ProblemStore } from "./problem-store.class.js";
import { Problem } from "./problem.class.js";
import { ProblemStore } from "./problem-store.class.ts";
import { Problem } from "./problem.class.ts";
import terminalLink from "terminal-link";
import Table, {
HorizontalTableRow,
Expand All @@ -8,7 +8,7 @@ import Table, {
Cell,
} from "cli-table3";
import chalk from "chalk";
import { SEVERITY_LEVEL } from "../constants.js";
import { SEVERITY_LEVEL } from "../constants.ts";

class Logger {
private problemStore: ProblemStore;
Expand Down
4 changes: 2 additions & 2 deletions src/classes/problem-store.class.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { RULE_TYPE, SEVERITY_LEVEL } from "../constants.js";
import { Problem } from "../types.js";
import { RULE_TYPE, SEVERITY_LEVEL } from "../constants.ts";
import { Problem } from "../types.ts";

export class ProblemStore {
// Validation Problems
Expand Down
2 changes: 1 addition & 1 deletion src/classes/problem.class.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RuleMeta, RuleSeverity } from "../types.js";
import { RuleMeta, RuleSeverity } from "../types.ts";

class Problem {
ruleMeta: RuleMeta;
Expand Down
2 changes: 1 addition & 1 deletion src/config/default-config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Config } from "../types.js";
import { Config } from "../types.ts";

const config: Config = {
defaultLocale: "",
Expand Down
14 changes: 7 additions & 7 deletions src/engine/rule-engine.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import type { Config, Rule, TranslationFiles } from "../types.js";
import * as rules from "../rules/index.js";
import { ProblemStore } from "../classes/problem-store.class.js";
import { getRuleIgnoreKeys, getRuleSeverity } from "../utils/rules-helpers.js";
import { RULE_TYPE, SEVERITY_LEVEL } from "../constants.js";
import { loadLanguageFiles } from "../utils/file-helpers.js";
import { Logger } from "../classes/logger.class.js";
import type { Config, Rule, TranslationFiles } from "../types.ts";
import * as rules from "../rules/index.ts";
import { ProblemStore } from "../classes/problem-store.class.ts";
import { getRuleIgnoreKeys, getRuleSeverity } from "../utils/rules-helpers.ts";
import { RULE_TYPE, SEVERITY_LEVEL } from "../constants.ts";
import { loadLanguageFiles } from "../utils/file-helpers.ts";
import { Logger } from "../classes/logger.class.ts";

function runRules(config: Config) {
const problemStore = new ProblemStore();
Expand Down
6 changes: 3 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import fs from "node:fs";
import path from "node:path";
import chalk from "chalk";

import { runRules } from "./engine/rule-engine.js";
import type { Config } from "./types.js";
import { config } from "./config/default-config.js";
import { runRules } from "./engine/rule-engine.ts";
import type { Config } from "./types.ts";
import { config } from "./config/default-config.ts";

const defaultConfig: Config = config;

Expand Down
18 changes: 9 additions & 9 deletions src/rules/index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { noEmptyMessages } from "./no-empty-messages/no-empty-messages.js";
import { noUntranslatedMessages } from "./no-untranslated-messages/index.js";
import { noInvalidVariables } from "./no-invalid-variables/index.js";
import { noHtmlMessages } from "./no-html-messages/index.js";
import { noInvalidConfiguration } from "./no-invalid-configuration/index.js";
import { noMissingKeys } from "./no-missing-keys/index.js";
import { noInvalidSeverity } from "./no-invalid-severity/index.js";
import { noMalformedKeys } from "./no-malformed-keys/index.js";
import { noExtraWhitespace } from "./no-extra-whitespace/index.js";
import { noEmptyMessages } from "./no-empty-messages/no-empty-messages.ts";
import { noUntranslatedMessages } from "./no-untranslated-messages/index.ts";
import { noInvalidVariables } from "./no-invalid-variables/index.ts";
import { noHtmlMessages } from "./no-html-messages/index.ts";
import { noInvalidConfiguration } from "./no-invalid-configuration/index.ts";
import { noMissingKeys } from "./no-missing-keys/index.ts";
import { noInvalidSeverity } from "./no-invalid-severity/index.ts";
import { noMalformedKeys } from "./no-malformed-keys/index.ts";
import { noExtraWhitespace } from "./no-extra-whitespace/index.ts";

export {
noInvalidConfiguration,
Expand Down
2 changes: 1 addition & 1 deletion src/rules/no-empty-messages/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { noEmptyMessages } from "./no-empty-messages.js";
export { noEmptyMessages } from "./no-empty-messages.ts";
8 changes: 4 additions & 4 deletions src/rules/no-empty-messages/no-empty-messages.spec.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { createMockProblemReporter } from "../../utils/test-helpers.js";
import { createMockProblemReporter } from "../../utils/test-helpers.ts";
import {
Config,
RuleContext,
RuleSeverity,
TranslationFiles,
} from "../../types.js";
import { noEmptyMessages } from "./no-empty-messages.js";
} from "../../types.ts";
import { noEmptyMessages } from "./no-empty-messages.ts";
import {
getEmptySourceMessageProblem,
getEmptyTranslatedMessageProblem,
} from "./problems.js";
} from "./problems.ts";

const ruleMeta = noEmptyMessages.meta;
const rule = noEmptyMessages;
Expand Down
6 changes: 3 additions & 3 deletions src/rules/no-empty-messages/no-empty-messages.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { SEVERITY_LEVEL } from "../../constants.js";
import { SEVERITY_LEVEL } from "../../constants.ts";
import {
Config,
Rule,
RuleContext,
RuleMeta,
TranslationFiles,
} from "../../types.js";
} from "../../types.ts";
import {
getEmptySourceMessageProblem,
getEmptyTranslatedMessageProblem,
} from "./problems.js";
} from "./problems.ts";

const ruleMeta: RuleMeta = {
name: "no-empty-messages",
Expand Down
4 changes: 2 additions & 2 deletions src/rules/no-empty-messages/problems.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Problem } from "../../classes/problem.class.js";
import { RuleMeta, RuleSeverity } from "../../types.js";
import { Problem } from "../../classes/problem.class.ts";
import { RuleMeta, RuleSeverity } from "../../types.ts";

type ProblemContext = {
key: string;
Expand Down
2 changes: 1 addition & 1 deletion src/rules/no-extra-whitespace/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { noExtraWhitespace } from "./no-extra-whitespace.js";
export { noExtraWhitespace } from "./no-extra-whitespace.ts";
8 changes: 4 additions & 4 deletions src/rules/no-extra-whitespace/no-extra-whitespace.spec.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { createMockProblemReporter } from "../../utils/test-helpers.js";
import { createMockProblemReporter } from "../../utils/test-helpers.ts";
import {
Config,
RuleContext,
RuleSeverity,
TranslationFiles,
} from "../../types.js";
import { noExtraWhitespace } from "./no-extra-whitespace.js";
import { getExtraWhitespaceFoundInMessageProblem } from "./problems.js";
} from "../../types.ts";
import { noExtraWhitespace } from "./no-extra-whitespace.ts";
import { getExtraWhitespaceFoundInMessageProblem } from "./problems.ts";

const ruleMeta = noExtraWhitespace.meta;
const rule = noExtraWhitespace;
Expand Down
8 changes: 4 additions & 4 deletions src/rules/no-extra-whitespace/no-extra-whitespace.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import { SEVERITY_LEVEL } from "../../constants.js";
import { SEVERITY_LEVEL } from "../../constants.ts";
import {
Config,
Rule,
RuleContext,
RuleMeta,
TranslationFiles,
} from "../../types.js";
} from "../../types.ts";
import {
stringHasExtraneousWhitespace,
stringHasWhitespacePadding,
} from "../../utils/string-helpers.js";
} from "../../utils/string-helpers.ts";

import { getExtraWhitespaceFoundInMessageProblem } from "./problems.js";
import { getExtraWhitespaceFoundInMessageProblem } from "./problems.ts";

const ruleMeta: RuleMeta = {
name: "no-extra-whitespace",
Expand Down
4 changes: 2 additions & 2 deletions src/rules/no-extra-whitespace/problems.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Problem } from "../../classes/problem.class.js";
import { RuleMeta, RuleSeverity } from "../../types.js";
import { Problem } from "../../classes/problem.class.ts";
import { RuleMeta, RuleSeverity } from "../../types.ts";

type ProblemContext = {
key: string;
Expand Down
2 changes: 1 addition & 1 deletion src/rules/no-html-messages/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { noHtmlMessages } from "./no-html-messages.js";
export { noHtmlMessages } from "./no-html-messages.ts";
8 changes: 4 additions & 4 deletions src/rules/no-html-messages/no-html-messages.spec.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { createMockProblemReporter } from "../../utils/test-helpers.js";
import { createMockProblemReporter } from "../../utils/test-helpers.ts";
import {
Config,
RuleContext,
RuleSeverity,
TranslationFiles,
} from "../../types.js";
import { noHtmlMessages } from "./no-html-messages.js";
import { getHtmlFoundInMessageProblem } from "./problems.js";
} from "../../types.ts";
import { noHtmlMessages } from "./no-html-messages.ts";
import { getHtmlFoundInMessageProblem } from "./problems.ts";

const ruleMeta = noHtmlMessages.meta;
const rule = noHtmlMessages;
Expand Down
8 changes: 4 additions & 4 deletions src/rules/no-html-messages/no-html-messages.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { SEVERITY_LEVEL } from "../../constants.js";
import { SEVERITY_LEVEL } from "../../constants.ts";
import {
Config,
Rule,
RuleContext,
RuleMeta,
TranslationFiles,
} from "../../types.js";
import { getMessageHasHtml } from "../../utils/message-helpers.js";
} from "../../types.ts";
import { getMessageHasHtml } from "../../utils/message-helpers.ts";

import { getHtmlFoundInMessageProblem } from "./problems.js";
import { getHtmlFoundInMessageProblem } from "./problems.ts";

const ruleMeta: RuleMeta = {
name: "no-html-messages",
Expand Down
4 changes: 2 additions & 2 deletions src/rules/no-html-messages/problems.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Problem } from "../../classes/problem.class.js";
import { RuleMeta, RuleSeverity } from "../../types.js";
import { Problem } from "../../classes/problem.class.ts";
import { RuleMeta, RuleSeverity } from "../../types.ts";

type ProblemContext = {
key: string;
Expand Down
2 changes: 1 addition & 1 deletion src/rules/no-invalid-configuration/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { noInvalidConfiguration } from "./no-invalid-configuration.js";
export { noInvalidConfiguration } from "./no-invalid-configuration.ts";
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import { createMockProblemReporter } from "../../utils/test-helpers.js";
import { createMockProblemReporter } from "../../utils/test-helpers.ts";
import {
Config,
RuleContext,
RuleSeverity,
TranslationFiles,
} from "../../types.js";
import { noInvalidConfiguration } from "./no-invalid-configuration.js";
} from "../../types.ts";
import { noInvalidConfiguration } from "./no-invalid-configuration.ts";
import {
getInvalidPathToTranslatedFilesProblem,
getInvalidTranslationFilesProblem,
getMissingDefaultLocaleProblem,
getMissingSourceFileProblem,
getUnConfigurableRuleFoundInConfigProblem,
getUnknownRuleConfigurationProblem,
} from "./problems.js";
} from "./problems.ts";

const ruleMeta = noInvalidConfiguration.meta;
const rule = noInvalidConfiguration;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@ import {
RuleContext,
RuleMeta,
TranslationFiles,
} from "../../types.js";
import { isEmptyString } from "../../utils/string-helpers.js";
} from "../../types.ts";
import { isEmptyString } from "../../utils/string-helpers.ts";
import {
configurableRuleNames,
unConfigurableRuleNames,
} from "../../constants.js";
} from "../../constants.ts";
import {
getInvalidTranslationFilesProblem,
getMissingSourceFileProblem,
getMissingDefaultLocaleProblem,
getInvalidPathToTranslatedFilesProblem,
getUnknownRuleConfigurationProblem,
getUnConfigurableRuleFoundInConfigProblem,
} from "./problems.js";
} from "./problems.ts";

const ruleMeta: RuleMeta = {
name: "no-invalid-configuration",
Expand Down
4 changes: 2 additions & 2 deletions src/rules/no-invalid-configuration/problems.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Problem } from "../../classes/problem.class.js";
import { RuleMeta, RuleSeverity } from "../../types.js";
import { Problem } from "../../classes/problem.class.ts";
import { RuleMeta, RuleSeverity } from "../../types.ts";

type ProblemContext = {
severity: RuleSeverity;
Expand Down
2 changes: 1 addition & 1 deletion src/rules/no-invalid-severity/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { noInvalidSeverity } from "./no-invalid-severity.js";
export { noInvalidSeverity } from "./no-invalid-severity.ts";
8 changes: 4 additions & 4 deletions src/rules/no-invalid-severity/no-invalid-severity.spec.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { createMockProblemReporter } from "../../utils/test-helpers.js";
import { createMockProblemReporter } from "../../utils/test-helpers.ts";
import {
Config,
RuleContext,
RuleSeverity,
TranslationFiles,
} from "../../types.js";
import { noInvalidSeverity } from "./no-invalid-severity.js";
import { getInvalidSeverityProblem } from "./problems.js";
} from "../../types.ts";
import { noInvalidSeverity } from "./no-invalid-severity.ts";
import { getInvalidSeverityProblem } from "./problems.ts";

const ruleMeta = noInvalidSeverity.meta;
const rule = noInvalidSeverity;
Expand Down
6 changes: 3 additions & 3 deletions src/rules/no-invalid-severity/no-invalid-severity.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { validSeverities } from "../../constants.js";
import { validSeverities } from "../../constants.ts";
import {
Config,
Rule,
RuleContext,
RuleMeta,
TranslationFiles,
} from "../../types.js";
import { getInvalidSeverityProblem } from "./problems.js";
} from "../../types.ts";
import { getInvalidSeverityProblem } from "./problems.ts";

const ruleMeta: RuleMeta = {
name: "no-invalid-severity",
Expand Down
6 changes: 3 additions & 3 deletions src/rules/no-invalid-severity/problems.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Problem } from "../../classes/problem.class.js";
import { RuleMeta, RuleSeverity } from "../../types.js";
import { SEVERITY_LEVEL } from "../../constants.js";
import { Problem } from "../../classes/problem.class.ts";
import { RuleMeta, RuleSeverity } from "../../types.ts";
import { SEVERITY_LEVEL } from "../../constants.ts";

const validSeverities = Object.values(SEVERITY_LEVEL);

Expand Down
2 changes: 1 addition & 1 deletion src/rules/no-invalid-variables/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { noInvalidVariables } from "./no-invalid-variables.js";
export { noInvalidVariables } from "./no-invalid-variables.ts";
8 changes: 4 additions & 4 deletions src/rules/no-invalid-variables/no-invalid-variables.spec.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import { createMockProblemReporter } from "../../utils/test-helpers.js";
import { createMockProblemReporter } from "../../utils/test-helpers.ts";
import {
Config,
RuleContext,
RuleSeverity,
TranslationFiles,
} from "../../types.js";
import { noInvalidVariables } from "./no-invalid-variables.js";
} from "../../types.ts";
import { noInvalidVariables } from "./no-invalid-variables.ts";
import {
getMismatchedVariableFromSourceProblem,
getMissingVariableFromSourceProblem,
getInvalidVariableSyntaxProblem,
getUnbalancedVariableBracketsSyntaxProblem,
} from "./problems.js";
} from "./problems.ts";

const ruleMeta = noInvalidVariables.meta;
const rule = noInvalidVariables;
Expand Down
8 changes: 4 additions & 4 deletions src/rules/no-invalid-variables/no-invalid-variables.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
import { SEVERITY_LEVEL } from "../../constants.js";
import { SEVERITY_LEVEL } from "../../constants.ts";
import {
Config,
Rule,
RuleContext,
RuleMeta,
TranslationFiles,
} from "../../types.js";
} from "../../types.ts";
import {
extractVariableNamesFromMessage,
extractVariablesFromLocaleData,
hasUnbalancedBrackets,
} from "../../utils/variable-helpers.js";
} from "../../utils/variable-helpers.ts";
import {
getMissingVariableFromSourceProblem,
getMismatchedVariableFromSourceProblem,
getInvalidVariableSyntaxProblem,
getUnbalancedVariableBracketsSyntaxProblem,
} from "./problems.js";
} from "./problems.ts";

const ruleMeta: RuleMeta = {
name: "no-invalid-variables",
Expand Down
Loading

0 comments on commit 8128e02

Please sign in to comment.