diff --git a/lib/init.js b/lib/init.js index 5c50283..f00c549 100644 --- a/lib/init.js +++ b/lib/init.js @@ -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() { @@ -20,6 +22,11 @@ export default { executablePath = value; }, )); + this.subscriptions.add(atom.config.observe('linter-moonscript.omitGlobalCheck', + (value) => { + omitGlobalCheck = value; + }, + )); }, deactivate() { @@ -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', diff --git a/package.json b/package.json index 07eadae..c0756f0 100644 --- a/package.json +++ b/package.json @@ -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",