This repository has been archived by the owner on Aug 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from AtomLinter/arcanemagus/es2017-rewrite
Rewrite in ES2017
- Loading branch information
Showing
23 changed files
with
301 additions
and
88 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# EditorConfig helps developers define and maintain consistent | ||
# coding styles between different editors and IDEs | ||
# editorconfig.org | ||
|
||
root = true | ||
|
||
[*] | ||
|
||
# Change these settings to your own preference | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
# We recommend you to keep these unchanged | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false |
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,2 @@ | ||
# Auto detect text files and perform LF normalization | ||
* text eol=lf |
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 |
---|---|---|
@@ -1,4 +1,18 @@ | ||
# linter-flint | ||
Lint projects using `flint` | ||
|
||
You can find flint [here](https://github.com/pengwynn/flint). | ||
Lint projects using [`flint`][flint]. | ||
|
||
# Installation | ||
|
||
You need to have [`flint`][flint] installed on your system before using this | ||
package. Once that is setup this package should work right away. If you are | ||
getting messages about `flint` not being available you may need to set the full | ||
path to it in your settings. | ||
|
||
As this package is just a wrapper around `flint`, you will need something to | ||
actually run it. By default the [Linter][] package will be installed for you to | ||
fill this need. | ||
|
||
|
||
[flint]: https://github.com/pengwynn/flint | ||
[Linter]: https://atom.io/packages/linter |
This file was deleted.
Oops, something went wrong.
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,131 @@ | ||
'use babel'; | ||
|
||
// eslint-disable-next-line import/no-extraneous-dependencies, import/extensions | ||
import { CompositeDisposable } from 'atom'; | ||
import { exec } from 'atom-linter'; | ||
import { dirname } from 'path'; | ||
import escapeHTML from 'escape-html'; | ||
|
||
// Internal vars | ||
// Example: https://regex101.com/r/OfS9w0/2/ | ||
const regex = /\[([A-Z]+)\] (.+)(?:\n\[INFO\] ([^\n.]+.)(?: (http:.+))?\n?)?/gm; | ||
|
||
export default { | ||
activate() { | ||
require('atom-package-deps').install('linter-flint'); | ||
|
||
this.subscriptions = new CompositeDisposable(); | ||
|
||
this.subscriptions.add( | ||
atom.config.observe('linter-flint.executablePath', (value) => { | ||
this.executablePath = value; | ||
}), | ||
); | ||
this.subscriptions.add( | ||
atom.config.observe('linter-flint.skipReadme', (value) => { | ||
this.skipReadme = value; | ||
}), | ||
); | ||
this.subscriptions.add( | ||
atom.config.observe('linter-flint.skipContributing', (value) => { | ||
this.skipContributing = value; | ||
}), | ||
); | ||
this.subscriptions.add( | ||
atom.config.observe('linter-flint.skipLicense', (value) => { | ||
this.skipLicense = value; | ||
}), | ||
); | ||
this.subscriptions.add( | ||
atom.config.observe('linter-flint.skipBootstrap', (value) => { | ||
this.skipBootstrap = value; | ||
}), | ||
); | ||
this.subscriptions.add( | ||
atom.config.observe('linter-flint.skipTestScript', (value) => { | ||
this.skipTestScript = value; | ||
}), | ||
); | ||
this.subscriptions.add( | ||
atom.config.observe('linter-flint.skipScripts', (value) => { | ||
this.skipScripts = value; | ||
}), | ||
); | ||
}, | ||
|
||
deactivate() { | ||
this.subscriptions.dispose(); | ||
}, | ||
|
||
provideLinter() { | ||
return { | ||
name: 'Flint', | ||
grammarScopes: ['*'], | ||
scope: 'project', | ||
lintOnFly: false, | ||
lint: async (editor) => { | ||
const filePath = editor.getPath(); | ||
let projectPath = atom.project.relativizePath(filePath)[0]; | ||
if (projectPath === null) { | ||
projectPath = dirname(filePath); | ||
} | ||
|
||
const execArgs = ['--no-color']; | ||
if (this.skipReadme) { | ||
execArgs.push('--skip-readme'); | ||
} | ||
if (this.skipContributing) { | ||
execArgs.push('--skip-contributing'); | ||
} | ||
if (this.skipLicense) { | ||
execArgs.push('--skip-license'); | ||
} | ||
if (this.skipBootstrap) { | ||
execArgs.push('--skip-bootstrap'); | ||
} | ||
if (this.skipTestScript) { | ||
execArgs.push('--skip-test-script'); | ||
} | ||
if (this.skipScripts) { | ||
execArgs.push('--skip-scripts'); | ||
} | ||
|
||
const execOpts = { | ||
cwd: projectPath, | ||
stream: 'stderr', | ||
}; | ||
|
||
const output = await exec(this.executablePath, execArgs, execOpts); | ||
|
||
const toReturn = []; | ||
|
||
let match = regex.exec(output); | ||
while (match !== null) { | ||
const [type, text, info, url] = match.slice(1); | ||
if (type !== 'OK') { | ||
const message = { | ||
type: type === 'WARNING' ? 'Warning' : 'Error', | ||
severity: type === 'WARNING' ? 'warning' : 'error', | ||
text, | ||
}; | ||
if (info) { | ||
const trace = { | ||
type: 'Trace', | ||
severity: 'info', | ||
}; | ||
if (url) { | ||
trace.html = `${escapeHTML(info)} (<a href="${url}">link</a>)`; | ||
} else { | ||
trace.text = info; | ||
} | ||
message.trace = [trace]; | ||
} | ||
toReturn.push(message); | ||
} | ||
match = regex.exec(output); | ||
} | ||
return toReturn; | ||
}, | ||
}; | ||
}, | ||
}; |
This file was deleted.
Oops, something went wrong.
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,6 @@ | ||
module.exports = { | ||
env: { | ||
atomtest: true, | ||
jasmine: true | ||
} | ||
}; |
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
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,3 @@ | ||
{ | ||
"name": "invalid project" | ||
} |
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
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,3 @@ | ||
{ | ||
"name": "invalid project" | ||
} |
Empty file.
Empty file.
Oops, something went wrong.