Skip to content
This repository has been archived by the owner on Aug 7, 2023. It is now read-only.

Commit

Permalink
Optionally omit globals warning (#10)
Browse files Browse the repository at this point in the history
* Optionally omit globals warning
  • Loading branch information
nbredikhin authored and Arcanemagus committed Jan 12, 2017
1 parent 772d30b commit d742eb3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ import * as helpers from 'atom-linter';
import { CompositeDisposable } from 'atom';

const parseRegex = /^(?:line)? \[?(\d+)]?(?:: (.+))?/gm;
const globalRegex = /accessing global/g;
let executablePath;
let omitGlobalCheck;

export default {
activate() {
Expand All @@ -20,6 +22,11 @@ export default {
executablePath = value;
},
));
this.subscriptions.add(atom.config.observe('linter-moonscript.omitGlobalCheck',
(value) => {
omitGlobalCheck = value;
},
));
},

deactivate() {
Expand Down Expand Up @@ -76,7 +83,7 @@ export default {
text: 'Syntax error',
range: helpers.rangeFromLineNumber(textEditor, line),
});
} else {
} else if (!omitGlobalCheck || !globalRegex.test(match[2])) {
// Regular lint warning
messages.push({
type: 'Warning',
Expand Down
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
"type": "string",
"default": "moonc",
"description": "Full path to the moonscript compiler."
},
"omitGlobalCheck": {
"type": "boolean",
"default": false,
"description": "Omit \"accessing global\" warnings."
}
},
"license": "MIT",
Expand Down

0 comments on commit d742eb3

Please sign in to comment.