Skip to content

Commit

Permalink
Fix namespacing and add help
Browse files Browse the repository at this point in the history
  • Loading branch information
apexskier committed Apr 26, 2020
1 parent a30d3f5 commit c0e6b25
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 12 deletions.
4 changes: 2 additions & 2 deletions .nova/Configuration.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"workspace.name": "ESLint Extension",
"editor.default_syntax": "javascript"
"editor.default_syntax": "javascript",
"workspace.name": "ESLint Extension"
}
13 changes: 13 additions & 0 deletions ESLint.novaextension/HELP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Support

## I don't have eslint installed in the normal place

This extension looks for eslint in `$WorkspaceRoot/node_modules`.

If it's not there (e.g., it's installed globally or in a sub-directory), you can configure it's location in your workspace in the `.nova/Configuration.json` file or globally through your extension settings. Make sure your path is properly escaped!

```json
{
"Mecham.ESLint.eslintPath" : "\/Volumes\/Macintosh HD\/Users\/cameronlittle\/Dev\/nova-eslint\/ESLint.novaextension\/extension.png"
}
```
15 changes: 6 additions & 9 deletions Source/Scripts/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export function activate() {

const linter = new Linter();

nova.commands.register("apexskier.eslint.fix", (editor) => {
nova.commands.register("Mecham.ESLint.fix", (editor) => {
if (editor.document.isDirty) {
console.log("after saving");
editor.onDidSave(fix);
Expand All @@ -23,7 +23,7 @@ export function activate() {
}
});

nova.commands.register("apexskier.eslint.setPathForWorkspace", () => {
nova.commands.register("Mecham.ESLint.setPathForWorkspace", () => {
nova.workspace.showFileChooser(
"Choose eslint executable",
{
Expand All @@ -35,14 +35,11 @@ export function activate() {
(paths) => {
if (paths && paths.length) {
nova.workspace.config.set(
"apexskier.eslint.eslintPath",
"Mecham.ESLint.eslintPath",
paths[0]
);
} else {
nova.workspace.config.set(
"apexskier.eslint.eslintPath",
null
);
nova.workspace.config.set("Mecham.ESLint.eslintPath", null);
}
}
);
Expand Down Expand Up @@ -73,12 +70,12 @@ export function activate() {
editor.onWillSave((editor) => {
let shouldFix = false;
let shouldFixWorkspace = nova.workspace.config.get(
"apexskier.eslint.saveOnFix",
"Mecham.ESLint.saveOnFix",
"boolean"
);
if (shouldFixWorkspace == null) {
shouldFix = nova.config.get(
"apexskier.eslint.saveOnFix",
"Mecham.ESLint.saveOnFix",
"boolean"
);
} else {
Expand Down
2 changes: 1 addition & 1 deletion Source/Scripts/process.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { eslintOutputToIssue } from "./eslintOutputToIssue";

let eslintPath = `${nova.workspace.path}/node_modules/.bin/eslint`;
nova.workspace.config.onDidChange("apexskier.eslint.eslintPath", (newValue) => {
nova.workspace.config.onDidChange("Mecham.ESLint.eslintPath", (newValue) => {
eslintPath = newValue || `${nova.workspace.path}/node_modules/.bin/eslint`;
});

Expand Down

0 comments on commit c0e6b25

Please sign in to comment.