This repository has been archived by the owner on Dec 25, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resolves #68
- Loading branch information
Showing
3 changed files
with
80 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// returns custom eslint rules directories | ||
export function getRulesDirs(): Array<string> | null { | ||
const rulesDirs: Array<string> = | ||
nova.config.get("apexskier.eslint.config.eslintRulesDirs", "array") ?? []; | ||
const workspaceRulesDirs = nova.workspace.config.get( | ||
"apexskier.eslint.config.eslintRulesDirs", | ||
"array" | ||
); | ||
if (workspaceRulesDirs) { | ||
for (const dir of workspaceRulesDirs) { | ||
if (!dir.trim()) { | ||
continue; | ||
} | ||
if (nova.path.isAbsolute(dir)) { | ||
rulesDirs.push(dir); | ||
} else if (nova.workspace.path) { | ||
rulesDirs.push(nova.path.join(nova.workspace.path, dir)); | ||
} else { | ||
nova.workspace.showErrorMessage( | ||
"Save your workspace before using a relative ESLint rules directories." | ||
); | ||
return null; | ||
} | ||
} | ||
} | ||
|
||
return rulesDirs.filter((d) => d.trim()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters